[Bug 230240] import clang 7.0.0 (tracking PR)

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Sun Aug 5 21:32:19 UTC 2018


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=230240

--- Comment #5 from Dimitry Andric <dim at FreeBSD.org> ---
Most of universe builds now, but two rather trick problems remain:
1) i386's lldb now requires atomic 64 bit libcalls, so it doesn't link
2) arm's lld doesn't link due to "relocation truncated to fit"

Regarding 1), we have always had the problem that i386 didn't support atomic 64
bit operations, at least not with the default CPU (i486) that we target.  Now
clang 7.0 does correctly emit some libcalls for __atomic_load_8 and friends,
and this causes lldb to fail to link.  We need to either provide some sort of
atomic wrappers in libc, a separate libatomic, or force lldb to be compiled
with at least CPUTYPE=i586?

Regarding 2), I'm getting the following with 'make buildworld TARGET=arm':

/home/dim/obj/clang700-import/home/dim/src/clang700-import/arm.arm/tmp/usr/lib/libgcc.a(floatundidf.o):
In function `__floatundidf':
/home/dim/src/clang700-import/contrib/compiler-rt/lib/builtins/floatundidf.c:43:
relocation truncated to fit: R_ARM_CALL against symbol
`__aeabi_dadd@@FBSDprivate_1.0' defined in .plt section in /h
ome/dim/obj/clang700-import/home/dim/src/clang700-import/arm.arm/lib/clang/libllvm/libllvm.a(regexec.o)
/home/dim/src/clang700-import/contrib/compiler-rt/lib/builtins/floatundidf.c:43:
relocation truncated to fit: R_ARM_CALL against symbol
`__aeabi_dadd@@FBSDprivate_1.0' defined in .plt section in /h
ome/dim/obj/clang700-import/home/dim/src/clang700-import/arm.arm/lib/clang/libllvm/libllvm.a(regexec.o)
/home/dim/obj/clang700-import/home/dim/src/clang700-import/arm.arm/tmp/usr/lib/libgcc.a(floatdidf.o):
In function `__floatdidf':
/home/dim/src/clang700-import/contrib/compiler-rt/lib/builtins/floatdidf.c:38:
relocation truncated to fit: R_ARM_CALL against symbol
`__aeabi_i2d@@FBSDprivate_1.0' defined in .plt section in /home
/dim/obj/clang700-import/home/dim/src/clang700-import/arm.arm/lib/clang/libllvm/libllvm.a(regexec.o)
/home/dim/src/clang700-import/contrib/compiler-rt/lib/builtins/floatdidf.c:38:
relocation truncated to fit: R_ARM_CALL against symbol
`__aeabi_dmul@@FBSDprivate_1.0' defined in .plt section in /hom
e/dim/obj/clang700-import/home/dim/src/clang700-import/arm.arm/lib/clang/libllvm/libllvm.a(regexec.o)
/home/dim/src/clang700-import/contrib/compiler-rt/lib/builtins/floatdidf.c:41:
relocation truncated to fit: R_ARM_CALL against symbol
`__aeabi_dadd@@FBSDprivate_1.0' defined in .plt section in /hom
e/dim/obj/clang700-import/home/dim/src/clang700-import/arm.arm/lib/clang/libllvm/libllvm.a(regexec.o)
/home/dim/src/clang700-import/contrib/compiler-rt/lib/builtins/floatdidf.c:41:
relocation truncated to fit: R_ARM_CALL against symbol
`__aeabi_dadd@@FBSDprivate_1.0' defined in .plt section in /hom
e/dim/obj/clang700-import/home/dim/src/clang700-import/arm.arm/lib/clang/libllvm/libllvm.a(regexec.o)
/home/dim/obj/clang700-import/home/dim/src/clang700-import/arm.arm/tmp/usr/lib/libgcc.a(clear_cache.o):
In function `__clear_cache':
/home/dim/src/clang700-import/contrib/compiler-rt/lib/builtins/clear_cache.c:113:
relocation truncated to fit: R_ARM_CALL against symbol `sysarch@@FBSD_1.0'
defined in .plt section in /home/dim/obj
/clang700-import/home/dim/src/clang700-import/arm.arm/lib/clang/libllvm/libllvm.a(regexec.o)
/home/dim/obj/clang700-import/home/dim/src/clang700-import/arm.arm/tmp/usr/lib/libgcc.a(fixunsdfdi.o):
In function `__fixunsdfdi':
/home/dim/src/clang700-import/contrib/compiler-rt/lib/builtins/fixunsdfdi.c:22:
relocation truncated to fit: R_ARM_CALL against symbol
`__aeabi_dcmple@@FBSDprivate_1.0' defined in .plt section in /
home/dim/obj/clang700-import/home/dim/src/clang700-import/arm.arm/lib/clang/libllvm/libllvm.a(regexec.o)
/home/dim/src/clang700-import/contrib/compiler-rt/lib/builtins/fixunsdfdi.c:23:
relocation truncated to fit: R_ARM_CALL against symbol
`__aeabi_dmul@@FBSDprivate_1.0' defined in .plt section in /ho
me/dim/obj/clang700-import/home/dim/src/clang700-import/arm.arm/lib/clang/libllvm/libllvm.a(regexec.o)
/home/dim/src/clang700-import/contrib/compiler-rt/lib/builtins/fixunsdfdi.c:24:
relocation truncated to fit: R_ARM_CALL against symbol
`__aeabi_dmul@@FBSDprivate_1.0' defined in .plt section in /ho
me/dim/obj/clang700-import/home/dim/src/clang700-import/arm.arm/lib/clang/libllvm/libllvm.a(regexec.o)
/home/dim/src/clang700-import/contrib/compiler-rt/lib/builtins/fixunsdfdi.c:24:
additional relocation overflows omitted from the output
c++: error: linker command failed with exit code 1 (use -v to see invocation)
*** [ld.lld.full] Error code 1

I suspected that the distance between the functions is getting too large, so I
tried adding -mlong-calls to lib/libcompiler-rt's Makefile, but that made
things worse: clang started crashing with a message to the effect of "can't use
-mlong-calls and -fPIC!".

E.g., everything in libcompiler-rt.a is still compiled with -fPIC, probably to
support linking it statically into .so files and PIE executables, so it can't
use -mlong-calls at all.

I have no idea how to get out of this conundrum.  Maybe attempt to add
-mlong-calls to lld's Makefile?  Compile the entirety of libllvm.a with -fPIC?

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-bugs mailing list