You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Mosh's file src/crypto/ocb.cc fails to build on Ubuntu 12.04 LTS (Precise Pangolin) for architectures armel and armhf (build logs: 1, 2). The problem is the same in both cases.
ARM processors support three different instruction sets:
The original ARM instruction set. All instructions are 32 bits. Any instruction can be conditional.
Thumb, a compact 16-bit encoding for a subset of ARM instructions. Only branches may be conditional. Thumb code has worse performance per instruction, and is expected to call ARM code for CPU-intensive tasks.
Thumb-2, which adds some 32-bit instructions to Thumb, and is considered a full replacement for ARM. Any instruction can be conditional, but a block of conditional instructions must be introduced by an instruction such as IT (if-then), ITE (if-then-else), etc.
Ted Krovetz's ocb.c contains inline ARM assembly with a conditional instruction eorcs (exclusive OR if carry set). It lacks an IT instruction and so can only be assembled in ARM mode. But GCC on Ubuntu 12.04 is compiled with --with-arch=armv7-a--with-mode=thumb, so it will emit Thumb-2 code by default.
Steps to reproduce:
$ wget http://www.cs.ucdavis.edu/~rogaway/ocb/{ocb-ref/rijndael-alg-fst.h,news/code/{ae.h,ocb.c}}
$ sed -i '/^#define USE_.*$/ d' ocb.c
$ gcc -DUSE_REFERENCE_AES=1 -c ocb.c
/tmp/ccLgYjJc.s: Assembler messages:
/tmp/ccLgYjJc.s:269: Error: thumb conditional instruction should be in IT block -- `eorcs r2,r2,#135'
This will build in ARM mode too, but presumably not on a sufficiently old as.
Besides this patch, we have a few other options:
Remove the inline assembly and use the C version of this function.
Override distribution preferences and build Mosh in ARM mode, using gcc -marm.
Build just ocb.cc in ARM mode. ARM-Thumb interworking is supposed to work, but there might be bugs down this road.
Pass -Wa,-mimplicit-it=thumb to GCC, telling the assembler to insert IT instructions as necessary. Ubuntu warns that it "is not implemented as of gcc-4.4 4.4.2-3ubuntu1, but [sic] it's probably best to avoid manually adding this flag to packages which encounter build problems".
I've confirmed that CXXFLAGS=-marm, CXXFLAGS=-Wa,-mimplicit-it=thumb, and the patch are each sufficient to build mosh-1.1 (using ./configure; make) on Ubuntu 12.04 armel. You can set up your own armelQEMUlated chroot on Debian using roughly:
Mosh's file
src/crypto/ocb.cc
fails to build on Ubuntu 12.04 LTS (Precise Pangolin) for architecturesarmel
andarmhf
(build logs: 1, 2). The problem is the same in both cases.ARM processors support three different instruction sets:
IT
(if-then),ITE
(if-then-else), etc.Ted Krovetz's
ocb.c
contains inline ARM assembly with a conditional instructioneorcs
(exclusive OR if carry set). It lacks anIT
instruction and so can only be assembled in ARM mode. But GCC on Ubuntu 12.04 is compiled with--with-arch=armv7-a
--with-mode=thumb
, so it will emit Thumb-2 code by default.Steps to reproduce:
Adding an
IT
instruction solves the problem:This will build in ARM mode too, but presumably not on a sufficiently old
as
.Besides this patch, we have a few other options:
gcc -marm
.ocb.cc
in ARM mode. ARM-Thumb interworking is supposed to work, but there might be bugs down this road.-Wa,-mimplicit-it=thumb
to GCC, telling the assembler to insertIT
instructions as necessary. Ubuntu warns that it "is not implemented as of gcc-4.4 4.4.2-3ubuntu1, but [sic] it's probably best to avoid manually adding this flag to packages which encounter build problems".I've confirmed that
CXXFLAGS=-marm
,CXXFLAGS=-Wa,-mimplicit-it=thumb
, and the patch are each sufficient to buildmosh-1.1
(using./configure; make
) on Ubuntu 12.04armel
. You can set up your ownarmel
QEMUlated chroot on Debian using roughly:The text was updated successfully, but these errors were encountered: