Jason A. Donenfeld
2018-10-01 01:27:49 UTC
Hello,
Compiling with "-march=armv7-a -mtune=cortex-a15 -mbe8" produces code
that appears to change the order of words. For example, the word-wise
optimized strcpy in musl changes "/dev/fd/" into "/fd//dev". Removing
"mtune=cortex-a15" works around the problem. Presumably this is due to
some instructions used in cortex-a15 mode that assume little endian
data, when -mbe8 requires otherwise.
Thanks,
Jason
$ armeb-pc-linux-gnueabi-gcc -v
Using built-in specs.
COLLECT_GCC=armeb-pc-linux-gnueabi-gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/armeb-pc-linux-gnueabi/8.2.0/lto-wrapper
Target: armeb-pc-linux-gnueabi
Configured with:
/var/tmp/portage/cross-armeb-pc-linux-gnueabi/gcc-8.2.0-r3/work/gcc-8.2.0/configure
--host=x86_64-p
c-linux-gnu --target=armeb-pc-linux-gnueabi
--build=x86_64-pc-linux-gnu --prefix=/usr
--bindir=/usr/x86_64-pc-linux-
gnu/armeb-pc-linux-gnueabi/gcc-bin/8.2.0
--includedir=/usr/lib/gcc/armeb-pc-linux-gnueabi/8.2.0/include
--datadir=/u
sr/share/gcc-data/armeb-pc-linux-gnueabi/8.2.0
--mandir=/usr/share/gcc-data/armeb-pc-linux-gnueabi/8.2.0/man --infod
ir=/usr/share/gcc-data/armeb-pc-linux-gnueabi/8.2.0/info
--with-gxx-include-dir=/usr/lib/gcc/armeb-pc-linux-gnueabi/
8.2.0/include/g++-v8
--with-python-dir=/share/gcc-data/armeb-pc-linux-gnueabi/8.2.0/python
--enable-languages=c,c++,
fortran --enable-obsolete --enable-secureplt --disable-werror
--with-system-zlib --enable-nls --without-included-get
text --enable-checking=release --with-bugurl=https://bugs.gentoo.org/
--with-pkgversion='Gentoo 8.2.0-r3 p1.3' --dis
able-esp --enable-libstdcxx-time --enable-poison-system-directories
--with-sysroot=/usr/armeb-pc-linux-gnueabi --dis
able-bootstrap --enable-__cxa_atexit --enable-clocale=gnu
--disable-multilib --disable-altivec --disable-fixed-point
--with-float=soft --enable-libgomp --disable-libmudflap
--disable-libssp --disable-libmpx --disable-systemtap --ena
ble-vtable-verify --enable-libvtv --enable-lto --without-isl
--enable-libsanitizer --enable-default-pie --enable-def
ault-ssp
Thread model: posix
gcc version 8.2.0 (Gentoo 8.2.0-r3 p1.3)
Compiling with "-march=armv7-a -mtune=cortex-a15 -mbe8" produces code
that appears to change the order of words. For example, the word-wise
optimized strcpy in musl changes "/dev/fd/" into "/fd//dev". Removing
"mtune=cortex-a15" works around the problem. Presumably this is due to
some instructions used in cortex-a15 mode that assume little endian
data, when -mbe8 requires otherwise.
Thanks,
Jason
$ armeb-pc-linux-gnueabi-gcc -v
Using built-in specs.
COLLECT_GCC=armeb-pc-linux-gnueabi-gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/armeb-pc-linux-gnueabi/8.2.0/lto-wrapper
Target: armeb-pc-linux-gnueabi
Configured with:
/var/tmp/portage/cross-armeb-pc-linux-gnueabi/gcc-8.2.0-r3/work/gcc-8.2.0/configure
--host=x86_64-p
c-linux-gnu --target=armeb-pc-linux-gnueabi
--build=x86_64-pc-linux-gnu --prefix=/usr
--bindir=/usr/x86_64-pc-linux-
gnu/armeb-pc-linux-gnueabi/gcc-bin/8.2.0
--includedir=/usr/lib/gcc/armeb-pc-linux-gnueabi/8.2.0/include
--datadir=/u
sr/share/gcc-data/armeb-pc-linux-gnueabi/8.2.0
--mandir=/usr/share/gcc-data/armeb-pc-linux-gnueabi/8.2.0/man --infod
ir=/usr/share/gcc-data/armeb-pc-linux-gnueabi/8.2.0/info
--with-gxx-include-dir=/usr/lib/gcc/armeb-pc-linux-gnueabi/
8.2.0/include/g++-v8
--with-python-dir=/share/gcc-data/armeb-pc-linux-gnueabi/8.2.0/python
--enable-languages=c,c++,
fortran --enable-obsolete --enable-secureplt --disable-werror
--with-system-zlib --enable-nls --without-included-get
text --enable-checking=release --with-bugurl=https://bugs.gentoo.org/
--with-pkgversion='Gentoo 8.2.0-r3 p1.3' --dis
able-esp --enable-libstdcxx-time --enable-poison-system-directories
--with-sysroot=/usr/armeb-pc-linux-gnueabi --dis
able-bootstrap --enable-__cxa_atexit --enable-clocale=gnu
--disable-multilib --disable-altivec --disable-fixed-point
--with-float=soft --enable-libgomp --disable-libmudflap
--disable-libssp --disable-libmpx --disable-systemtap --ena
ble-vtable-verify --enable-libvtv --enable-lto --without-isl
--enable-libsanitizer --enable-default-pie --enable-def
ault-ssp
Thread model: posix
gcc version 8.2.0 (Gentoo 8.2.0-r3 p1.3)