Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 8 Jan 2016 19:46:06 -0800
From:      Mark Millard <markmi@dsl-only.net>
To:        Dimitry Andric <dim@FreeBSD.org>
Cc:        Ian Lepore <ian@FreeBSD.org>, Warner Losh <imp@bsdimp.com>, freebsd-arm <freebsd-arm@freebsd.org>, FreeBSD Toolchain <freebsd-toolchain@freebsd.org>
Subject:   Re: Bug 205663 Clang getting Bus Errors (arm SCLTR Bit[12]==1 context): Reported fixed on llvm's trunk
Message-ID:  <92264003-CF0E-4624-A28A-8AFB7C663BFB@dsl-only.net>
In-Reply-To: <7EE8F65E-7485-4FA9-A136-F22090DB107F@FreeBSD.org>
References:  <C90F0ABA-3C59-4FE1-AAB4-99F8FF32FB24@dsl-only.net> <CANCZdfoWDg_ZX8zxqRV2-Q6teYf_Ef4f3VKB0fhb0sikcW3hUA@mail.gmail.com> <1452020032.1320.21.camel@freebsd.org> <7EE8F65E-7485-4FA9-A136-F22090DB107F@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help

On 2016-Jan-7, at 2:57 PM, Dimitry Andric <dim at FreeBSD.org> wrote:
>=20
> On 05 Jan 2016, at 19:53, Ian Lepore <ian at FreeBSD.org> wrote:
>>=20
>> 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...
>>=20
>> It's a non-starter for us, because unfortunately they appear to have
>> removed support for the -arm-use-movt=3D0 command line option, so now =
we
>> can't build ubldr or kernel modules.
>=20
> 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.
>=20
> -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=3Darmv7a =
-mcpu=3Dcortex-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=3Darmv7a -mcpu=3Dcortex-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/drive=
r/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/drive=
r/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__19e=
nable_ifIXntsr3std8is_arrayIT_EE5valueENS3_10unique_ptrIS5_NS3_14default_d=
eleteIS5_EEEEE4typeEDpOT0_':
> =
/usr/src/usr.bin/clang/clang/../../../contrib/llvm/include/llvm/ADT/STLExt=
ras.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=3Darmv6
> TOOLS_TO_TYPE=3Darm-gnueabi
> #
> KERNCONF=3DRPI2-NODBG
> TARGET=3Darm
> .if ${.MAKE.LEVEL} =3D=3D 0
> TARGET_ARCH=3D${TO_TYPE}
> .export TARGET_ARCH
> .endif
> #
> WITH_FAST_DEPEND=3D
> WITH_LIBCPLUSPLUS=3D
> WITH_BINTOOLS_BOOTSTRAP=3D
> WITH_CLANG=3D
> WITH_CLANG_IS_CC=3D
> WITH_CLANG_FULL=3D
> WITH_LLDB=3D
> WITH_CLANG_EXTRAS=3D
> WITH_BOOT=3D
> #
> WITHOUT_LIB32=3D
> WITHOUT_ELFTOOLCHAIN_BOOTSTRAP=3D
> WITHOUT_CLANG_BOOTSTRAP=3D
> WITHOUT_GCC_BOOTSTRAP=3D
> WITHOUT_GCC=3D
> WITHOUT_GNUCXX=3D
> #
> NO_WERROR=3D
> MALLOC_PRODUCTION=3D
> #
> WITH_DEBUG=3D
> WITH_DEBUG_FILES=3D
> #
> .if ${.MAKE.LEVEL} =3D=3D 0
> XCC=3D/usr/bin/clang -v -target ${TO_TYPE}--freebsd11.0-gnueabi =
-march=3Darmv7a -mcpu=3Dcortex-a7 -mno-unaligned-access
> XCXX=3D/usr/bin/clang++ -v -target ${TO_TYPE}--freebsd11.0-gnueabi =
-march=3Darmv7a -mcpu=3Dcortex-a7 -mno-unaligned-access
> XCPP=3D/usr/bin/clang-cpp -v -target ${TO_TYPE}--freebsd11.0-gnueabi =
-march=3Darmv7a -mcpu=3Dcortex-a7 -mno-unaligned-access
> .export XCC
> .export XCXX
> .export XCPP
> .endif
> #
> .if ${.MAKE.LEVEL} =3D=3D 0
> CC=3D/usr/bin/clang -v
> CXX=3D/usr/bin/clang++ -v
> CPP=3D/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=3Darmv7a =
-mcpu=3Dcortex-a7 -mno-unaligned-access -target =
armv6-gnueabi-freebsd11.0 --sysroot=3D/usr/obj/clang/arm.armv6/usr/src/tmp=
 -B/usr/obj/clang/arm.armv6/usr/src/tmp/usr/bin =
--sysroot=3D/usr/obj/clang/arm.armv6/usr/src/tmp =
-B/usr/obj/clang/arm.armv6/usr/src/tmp/usr/bin -O -pipe =
-mfloat-abi=3Dsoftfp =
-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/dri=
ver -I. =
-I/usr/src/usr.bin/clang/clang/../../../contrib/llvm/../../lib/clang/inclu=
de -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=3D\"armv6-gnueabi-freebsd11.0\" =
-DLLVM_HOST_TRIPLE=3D\"armv6-unknown-freebsd11.0\" =
-DDEFAULT_SYSROOT=3D\"\" -g -Qunused-arguments -std=3Dc++11 =
-fno-exceptions -fno-rtti -stdlib=3Dlibc++ -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/li=
bclangfrontendtool/libclangfrontendtool.a
. . .
> =
/usr/obj/clang/arm.armv6/usr/src/usr.bin/clang/clang/../../../lib/clang/li=
bllvmsupport/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=3D/usr/obj/clang/arm.armv6/usr/src/tmp -Bstatic -o clang.full =
/usr/obj/clang/arm.armv6/usr/src/tmp/usr/lib/crt1.o=20
. . .
>  =
/usr/obj/clang/arm.armv6/usr/src/usr.bin/clang/clang/../../../lib/clang/li=
bllvmsupport/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


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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?92264003-CF0E-4624-A28A-8AFB7C663BFB>