Bug 205663 Clang getting Bus Errors (arm SCLTR Bit[12]==1 context): Reported fixed on llvm's trunk

Mark Millard markmi at dsl-only.net
Sat Jan 9 03:46:15 UTC 2016


On 2016-Jan-7, at 2:57 PM, Dimitry Andric <dim at FreeBSD.org> wrote:
> 
> On 05 Jan 2016, at 19:53, Ian Lepore <ian at FreeBSD.org> wrote:
>> 
>> On Tue, 2016-01-05 at 11:35 -0700, Warner Losh wrote:
> ...
>>> There's a projects/clang-380-import that you might want to try...
>> 
>> It's a non-starter for us, because unfortunately they appear to have
>> removed support for the -arm-use-movt=0 command line option, so now we
>> can't build ubldr or kernel modules.
> 
> FYI, I have added a -mno-movt option for this purpose upstream, and
> imported a newer snapshot into the clang380-import branch.  As of
> r293384, it now uses the new option spelling for modules, if your clang
> is 3.8.0 or higher.
> 
> -Dimitry

I've not been able to get to the point of running clang++ 3.8 on the rpi2 yet: R_ARM_CALL and R_ARM_JUMP24 relocation truncations during the cross build's buildworld interfere.

I've no clue just what you expect the status of things to be so this note is just an FYI on what happened when I tried to cross build from an amd64 context targetting an armv6 context, also using "-march=armv7a -mcpu=cortex-a7 -mno-unaligned-access".



Yesterday I cloned an amd64 virtual box virtual machine that I run FreeBSD 11.0-CURRENT in  and updated the cloned copy's /usr/src/ to base/projects/clang380-import -r293417. buildworld, buildkernel and the installs for amd64 went fine.

Then today I updated /usr/src to -r293430 and attempted buildworld buildkernel targeting armv6 with "-march=armv7a -mcpu=cortex-a7 -mno-unaligned-access". I ended up with:

> --- all_subdir_clang ---
> clang++: error: linker command failed with exit code 1 (use -v to see invocation)
> *** [clang.full] Error code 1

Looking in the script output I find relocation truncation notices for R_ARM_CALL and R_ARM_JUMP24 usage:

> --- all_subdir_usr.bin ---
> /usr/obj/clang/arm.armv6/usr/src/tmp/usr/lib/crt1.o: In function `__start':
. . .
> --- all_subdir_usr.bin ---
> /usr/src/lib/csu/arm/crt1.c:(.text+0xc4): relocation truncated to fit: R_ARM_CALL against symbol `atexit' defined in .text section in /usr/obj/clang/arm.armv6/usr/src/tmp/usr/lib/libc.a(atexit.o)
. . .
> --- all_subdir_usr.bin ---
> /usr/src/lib/csu/arm/crt1.c:(.text+0xcc): relocation truncated to fit: R_ARM_CALL against symbol `_init_tls' defined in .text section in /usr/obj/clang/arm.armv6/usr/src/tmp/usr/lib/libc.a(tls.o)
> /usr/src/lib/csu/arm/crt1.c:(.text+0xe0): relocation truncated to fit: R_ARM_CALL against symbol `atexit' defined in .text section in /usr/obj/clang/arm.armv6/usr/src/tmp/usr/lib/libc.a(atexit.o)
> /usr/src/lib/csu/arm/crt1.c:(.text+0x19c): relocation truncated to fit: R_ARM_JUMP24 against symbol `exit' defined in .text section in /usr/obj/clang/arm.armv6/usr/src/tmp/usr/lib/libc.a(exit.o)
> /usr/obj/clang/arm.armv6/usr/src/tmp/usr/lib/crt1.o: In function `finalizer':
> /usr/src/lib/csu/arm/crt1.c:(.text+0x1f8): relocation truncated to fit: R_ARM_JUMP24 against symbol `_fini' defined in .fini section in /usr/obj/clang/arm.armv6/usr/src/tmp/usr/lib/crti.o

. . .
> --- all_subdir_usr.bin ---
> cc1_main.o: In function `cc1_main(llvm::ArrayRef<char const*>, char const*, void*)':
. . .
> --- all_subdir_usr.bin ---
> /usr/src/usr.bin/clang/clang/../../../contrib/llvm/tools/clang/tools/driver/cc1_main.cpp:68: relocation truncated to fit: R_ARM_CALL against symbol `operator new(unsigned int)' defined in .text section in /usr/obj/clang/arm.armv6/usr/src/tmp/usr/lib/libc++.a(new.o)
. . .
> --- all_subdir_usr.bin ---
> cc1_main.o: In function `std::__1::__allocate(unsigned int)':
> /usr/obj/clang/arm.armv6/usr/src/tmp/usr/include/c++/v1/new:168: relocation truncated to fit: R_ARM_CALL against symbol `operator new(unsigned int)' defined in .text section in /usr/obj/clang/arm.armv6/usr/src/tmp/usr/lib/libc++.a(new.o)
. . .
> --- all_subdir_usr.bin ---
> cc1_main.o: In function `~shared_ptr':
> /usr/obj/clang/arm.armv6/usr/src/tmp/usr/include/c++/v1/memory:4567: relocation truncated to fit: R_ARM_CALL against symbol `std::__1::__shared_weak_count::__release_shared()' defined in .text section in /usr/obj/clang/arm.armv6/usr/src/tmp/usr/lib/libc++.a(memory.o)
> cc1_main.o: In function `cc1_main(llvm::ArrayRef<char const*>, char const*, void*)':
> /usr/src/usr.bin/clang/clang/../../../contrib/llvm/tools/clang/tools/driver/cc1_main.cpp:69: relocation truncated to fit: R_ARM_CALL against symbol `operator new(unsigned int)' defined in .text section in /usr/obj/clang/arm.armv6/usr/src/tmp/usr/lib/libc++.a(new.o)
> cc1_main.o: In function `shared_ptr':
> /usr/obj/clang/arm.armv6/usr/src/tmp/usr/include/c++/v1/memory:4254: relocation truncated to fit: R_ARM_CALL against symbol `std::__1::__shared_weak_count::__add_shared()' defined in .text section in /usr/obj/clang/arm.armv6/usr/src/tmp/usr/lib/libc++.a(memory.o)
> cc1_main.o: In function `_ZN4llvm11make_uniqueIN5clang28ObjectFilePCHContainerWriterEJEEENSt3__19enable_ifIXntsr3std8is_arrayIT_EE5valueENS3_10unique_ptrIS5_NS3_14default_deleteIS5_EEEEE4typeEDpOT0_':
> /usr/src/usr.bin/clang/clang/../../../contrib/llvm/include/llvm/ADT/STLExtras.h:405: additional relocation overflows omitted from the output



I have -v in the command line options. I later show the link command and -v output (with lots of paths omitted). First I show my src.conf content:

> TO_TYPE=armv6
> TOOLS_TO_TYPE=arm-gnueabi
> #
> KERNCONF=RPI2-NODBG
> TARGET=arm
> .if ${.MAKE.LEVEL} == 0
> TARGET_ARCH=${TO_TYPE}
> .export TARGET_ARCH
> .endif
> #
> WITH_FAST_DEPEND=
> WITH_LIBCPLUSPLUS=
> WITH_BINTOOLS_BOOTSTRAP=
> WITH_CLANG=
> WITH_CLANG_IS_CC=
> WITH_CLANG_FULL=
> WITH_LLDB=
> WITH_CLANG_EXTRAS=
> WITH_BOOT=
> #
> WITHOUT_LIB32=
> WITHOUT_ELFTOOLCHAIN_BOOTSTRAP=
> WITHOUT_CLANG_BOOTSTRAP=
> WITHOUT_GCC_BOOTSTRAP=
> WITHOUT_GCC=
> WITHOUT_GNUCXX=
> #
> NO_WERROR=
> MALLOC_PRODUCTION=
> #
> WITH_DEBUG=
> WITH_DEBUG_FILES=
> #
> .if ${.MAKE.LEVEL} == 0
> XCC=/usr/bin/clang -v -target ${TO_TYPE}--freebsd11.0-gnueabi -march=armv7a -mcpu=cortex-a7 -mno-unaligned-access
> XCXX=/usr/bin/clang++ -v -target ${TO_TYPE}--freebsd11.0-gnueabi -march=armv7a -mcpu=cortex-a7 -mno-unaligned-access
> XCPP=/usr/bin/clang-cpp -v -target ${TO_TYPE}--freebsd11.0-gnueabi -march=armv7a -mcpu=cortex-a7 -mno-unaligned-access
> .export XCC
> .export XCXX
> .export XCPP
> .endif
> #
> .if ${.MAKE.LEVEL} == 0
> CC=/usr/bin/clang -v
> CXX=/usr/bin/clang++ -v
> CPP=/usr/bin/clang-cpp -v
> .export CC
> .export CXX
> .export CPP
> .endif

As for the link command:

> --- clang.full ---
> /usr/bin/clang++ -v -target armv6--freebsd11.0-gnueabi -march=armv7a -mcpu=cortex-a7 -mno-unaligned-access -target armv6-gnueabi-freebsd11.0 --sysroot=/usr/obj/clang/arm.armv6/usr/src/tmp -B/usr/obj/clang/arm.armv6/usr/src/tmp/usr/bin --sysroot=/usr/obj/clang/arm.armv6/usr/src/tmp -B/usr/obj/clang/arm.armv6/usr/src/tmp/usr/bin -O -pipe -mfloat-abi=softfp -I/usr/src/usr.bin/clang/clang/../../../contrib/llvm/include -I/usr/src/usr.bin/clang/clang/../../../contrib/llvm/tools/clang/include -I/usr/src/usr.bin/clang/clang/../../../contrib/llvm/tools/clang/tools/driver -I. -I/usr/src/usr.bin/clang/clang/../../../contrib/llvm/../../lib/clang/include -DLLVM_ON_UNIX -DLLVM_ON_FREEBSD -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -DCLANG_ENABLE_ARCMT -DCLANG_ENABLE_STATIC_ANALYZER -fno-strict-aliasing -DLLVM_DEFAULT_TARGET_TRIPLE=\"armv6-gnueabi-freebsd11.0\" -DLLVM_HOST_TRIPLE=\"armv6-unknown-freebsd11.0\" -DDEFAULT_SYSROOT=\"\" -g -Qunused-arguments -std=c++11 -fno-exceptions -fno-rtti -stdlib=libc++ -Wno-c++11-extensions  -static -o clang.full  cc1_main.o cc1as_main.o driver.o /usr/obj/clang/arm.armv6/usr/src/usr.bin/clang/clang/../../../lib/clang/libclangfrontendtool/libclangfrontendtool.a
. . .
> /usr/obj/clang/arm.armv6/usr/src/usr.bin/clang/clang/../../../lib/clang/libllvmsupport/libllvmsupport.a  -lz  -lncursesw  -lpthread
> FreeBSD clang version 3.8.0 (trunk 256945) (based on LLVM 3.8.0svn)
> Target: armv6--freebsd11.0-gnueabi
> Thread model: posix
> InstalledDir: /usr/bin
>  "/usr/obj/clang/arm.armv6/usr/src/tmp/usr/bin/ld" --sysroot=/usr/obj/clang/arm.armv6/usr/src/tmp -Bstatic -o clang.full /usr/obj/clang/arm.armv6/usr/src/tmp/usr/lib/crt1.o 
. . .
>  /usr/obj/clang/arm.armv6/usr/src/usr.bin/clang/clang/../../../lib/clang/libllvmsupport/libllvmsupport.a -lz -lncursesw -lpthread -lc++ -lm -lgcc -lgcc_eh -lc -lgcc -lgcc_eh /usr/obj/clang/arm.armv6/usr/src/tmp/usr/lib/crtend.o /usr/obj/clang/arm.armv6/usr/src/tmp/usr/lib/crtn.o


===
Mark Millard
markmi at dsl-only.net



More information about the freebsd-toolchain mailing list