Bug 215691 - head -r310854: lldb.full gets various "relocation truncated to fit: R_ARM_CALL against symbol ... defined in .plt section in ..." failure messages
Summary: head -r310854: lldb.full gets various "relocation truncated to fit: R_ARM_CAL...
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: CURRENT
Hardware: arm Any
: --- Affects Only Me
Assignee: Ed Maste
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-01-01 07:59 UTC by Mark Millard
Modified: 2022-04-20 14:28 UTC (History)
1 user (show)

See Also:
koobs: maintainer-feedback? (emaste)
koobs: mfc-stable13?
koobs: mfc-stable12?


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Millard 2017-01-01 07:59:16 UTC
My attempted -r310854 based amd64 -> armv6 cross buildworld failed with:

--- lldb.full ---
/usr/obj/rpi2_clang/arm.armv6/usr/src/lib/clang/libllvm/libllvm.a(regexec.o): In function `llvm_regexec':
/usr/src/contrib/llvm/lib/Support/regexec.c:(.text+0x80): relocation truncated to fit: R_ARM_CALL against symbol `strlen@@FBSD_1.0' defined in .plt section in /usr/obj/rpi2_clang/arm.armv6/usr/src/lib/clang/libllvm/libllvm.a(regexec.o)
/usr/src/contrib/llvm/lib/Support/regexec.c:(.text+0xbc): relocation truncated to fit: R_ARM_CALL against symbol `strlen@@FBSD_1.0' defined in .plt section in /usr/obj/rpi2_clang/arm.armv6/usr/src/lib/clang/libllvm/libllvm.a(regexec.o)
/usr/src/contrib/llvm/lib/Support/regexec.c:(.text+0x144): relocation truncated to fit: R_ARM_CALL against symbol `memcmp@@FBSD_1.0' defined in .plt section in /usr/obj/rpi2_clang/arm.armv6/usr/src/lib/clang/libllvm/libllvm.a(regexec.o)
/usr/src/contrib/llvm/lib/Support/regexec.c:(.text+0x21c): relocation truncated to fit: R_ARM_CALL against symbol `__aeabi_read_tp@@FBSDprivate_1.0' defined in .plt section in /usr/obj/rpi2_clang/arm.armv6/usr/src/lib/clang/libllvm/libllvm.a(regexec.o)
/usr/src/contrib/llvm/lib/Support/regexec.c:(.text+0x624): relocation truncated to fit: R_ARM_CALL against symbol `malloc@@FBSD_1.0' defined in .plt section in /usr/obj/rpi2_clang/arm.armv6/usr/src/lib/clang/libllvm/libllvm.a(regexec.o)
/usr/src/contrib/llvm/lib/Support/regexec.c:(.text+0x6bc): relocation truncated to fit: R_ARM_CALL against symbol `malloc@@FBSD_1.0' defined in .plt section in /usr/obj/rpi2_clang/arm.armv6/usr/src/lib/clang/libllvm/libllvm.a(regexec.o)
/usr/src/contrib/llvm/lib/Support/regexec.c:(.text+0x840): relocation truncated to fit: R_ARM_CALL against symbol `free@@FBSD_1.0' defined in .plt section in /usr/obj/rpi2_clang/arm.armv6/usr/src/lib/clang/libllvm/libllvm.a(regexec.o)
/usr/src/contrib/llvm/lib/Support/regexec.c:(.text+0x8c4): relocation truncated to fit: R_ARM_CALL against symbol `memcmp@@FBSD_1.0' defined in .plt section in /usr/obj/rpi2_clang/arm.armv6/usr/src/lib/clang/libllvm/libllvm.a(regexec.o)
/usr/src/contrib/llvm/lib/Support/regexec.c:(.text+0x918): relocation truncated to fit: R_ARM_CALL against symbol `malloc@@FBSD_1.0' defined in .plt section in /usr/obj/rpi2_clang/arm.armv6/usr/src/lib/clang/libllvm/libllvm.a(regexec.o)
/usr/src/contrib/llvm/lib/Support/regexec.c:(.text+0x970): relocation truncated to fit: R_ARM_CALL against symbol `memset@@FBSD_1.0' defined in .plt section in /usr/obj/rpi2_clang/arm.armv6/usr/src/lib/clang/libllvm/libllvm.a(regexec.o)
/usr/src/contrib/llvm/lib/Support/regexec.c:(.text+0x9f0): additional relocation overflows omitted from the output



# Meta data file /usr/obj/rpi2_clang/arm.armv6/usr/src/usr.bin/clang/lldb/lldb.full.meta
CMD c++ -mcpu=cortex-a7 -mcpu=cortex-a7 -target armv6-gnueabihf-freebsd12.0 --sysroot=/usr/obj/rpi2_clang/arm.armv6/usr/src/tmp -B/usr/obj/rpi2_clang/arm.armv6/usr/src/tmp/usr/bin -O -pipe -I/usr/src/contrib/llvm/tools/lldb/include -I/usr/src/contrib/llvm/tools/clang/include -DCLANG_ENABLE_ARCMT -DCLANG_ENABLE_STATIC_ANALYZER -I/usr/src/lib/clang/include -I/usr/src/contrib/llvm/include -DLLVM_ON_UNIX -DLLVM_ON_FREEBSD -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -DLLVM_DEFAULT_TARGET_TRIPLE=\"armv6-gnueabihf-freebsd12.0\" -DLLVM_HOST_TRIPLE=\"armv6-unknown-freebsd12.0\" -DDEFAULT_SYSROOT=\"\" -g -Wno-empty-body -Wno-string-plus-int -Wno-unused-const-variable -Wno-tautological-compare -Wno-unused-value -Wno-parentheses-equality -Wno-unused-function -Wno-enum-conversion -Wno-unused-local-typedef -Wno-switch -Wno-switch-enum -Wno-knr-promoted-parameter -Wno-parentheses -Qunused-arguments -std=c++11 -fno-exceptions -fno-rtti -stdlib=libc++ -Wno-c++11-extensions  -o lldb.full  Driver.o /usr/obj/rpi2_clang/arm.armv6/usr/src/lib/clang/liblldb/liblldb.a /usr/obj/rpi2_clang/arm.armv6/usr/src/lib/clang/libclang/libclang.a /usr/obj/rpi2_clang/arm.armv6/usr/src/lib/clang/libllvm/libllvm.a  -ledit  -lpanel  -lncursesw   -lz -lpthread
CWD /usr/obj/rpi2_clang/arm.armv6/usr/src/usr.bin/clang/lldb
TARGET lldb.full
-- command output --
/usr/obj/rpi2_clang/arm.armv6/usr/src/lib/clang/libllvm/libllvm.a(regexec.o): In function `llvm_regexec':
/usr/src/contrib/llvm/lib/Support/regexec.c:(.text+0x80): relocation truncated to fit: R_ARM_CALL against symbol `strlen@@FBSD_1.0' defined in .plt section in /usr/obj/rpi2_clang/arm.armv6/usr/src/lib/clang/libllvm/libllvm.a(regexec.o)
/usr/src/contrib/llvm/lib/Support/regexec.c:(.text+0xbc): relocation truncated to fit: R_ARM_CALL against symbol `strlen@@FBSD_1.0' defined in .plt section in /usr/obj/rpi2_clang/arm.armv6/usr/src/lib/clang/libllvm/libllvm.a(regexec.o)
/usr/src/contrib/llvm/lib/Support/regexec.c:(.text+0x144): relocation truncated to fit: R_ARM_CALL against symbol `memcmp@@FBSD_1.0' defined in .plt section in /usr/obj/rpi2_clang/arm.armv6/usr/src/lib/clang/libllvm/libllvm.a(regexec.o)
/usr/src/contrib/llvm/lib/Support/regexec.c:(.text+0x21c): relocation truncated to fit: R_ARM_CALL against symbol `__aeabi_read_tp@@FBSDprivate_1.0' defined in .plt section in /usr/obj/rpi2_clang/arm.armv6/usr/src/lib/clang/libllvm/libllvm.a(regexec.o)
/usr/src/contrib/llvm/lib/Support/regexec.c:(.text+0x624): relocation truncated to fit: R_ARM_CALL against symbol `malloc@@FBSD_1.0' defined in .plt section in /usr/obj/rpi2_clang/arm.armv6/usr/src/lib/clang/libllvm/libllvm.a(regexec.o)
/usr/src/contrib/llvm/lib/Support/regexec.c:(.text+0x6bc): relocation truncated to fit: R_ARM_CALL against symbol `malloc@@FBSD_1.0' defined in .plt section in /usr/obj/rpi2_clang/arm.armv6/usr/src/lib/clang/libllvm/libllvm.a(regexec.o)
/usr/src/contrib/llvm/lib/Support/regexec.c:(.text+0x840): relocation truncated to fit: R_ARM_CALL against symbol `free@@FBSD_1.0' defined in .plt section in /usr/obj/rpi2_clang/arm.armv6/usr/src/lib/clang/libllvm/libllvm.a(regexec.o)
/usr/src/contrib/llvm/lib/Support/regexec.c:(.text+0x8c4): relocation truncated to fit: R_ARM_CALL against symbol `memcmp@@FBSD_1.0' defined in .plt section in /usr/obj/rpi2_clang/arm.armv6/usr/src/lib/clang/libllvm/libllvm.a(regexec.o)
/usr/src/contrib/llvm/lib/Support/regexec.c:(.text+0x918): relocation truncated to fit: R_ARM_CALL against symbol `malloc@@FBSD_1.0' defined in .plt section in /usr/obj/rpi2_clang/arm.armv6/usr/src/lib/clang/libllvm/libllvm.a(regexec.o)
/usr/src/contrib/llvm/lib/Support/regexec.c:(.text+0x970): relocation truncated to fit: R_ARM_CALL against symbol `memset@@FBSD_1.0' defined in .plt section in /usr/obj/rpi2_clang/arm.armv6/usr/src/lib/clang/libllvm/libllvm.a(regexec.o)
/usr/src/contrib/llvm/lib/Support/regexec.c:(.text+0x9f0): additional relocation overflows omitted from the output
c++: error: linker command failed with exit code 1 (use -v to see invocation)
*** Error code 1



Script started on Sat Dec 31 18:35:07 2016
Command: env __MAKE_CONF=/root/src.configs/make.conf SRCCONF=/dev/null SRC_ENV_CONF=/root/src.configs/src.conf.rpi2-clang-bootstrap.amd64-host WITH_META_MODE=yes MAKEOBJDIRPREFIX=/usr/obj/rpi2_clang make -j 4 buildworld buildkernel



# more /root/src.configs/src.conf.rpi2-clang-bootstrap.amd64-host
TO_TYPE=armv6
#
KERNCONF=RPI2-NODBG
TARGET=arm
.if ${.MAKE.LEVEL} == 0
TARGET_ARCH=${TO_TYPE}
.export TARGET_ARCH
.endif
#
WITH_CROSS_COMPILER=
WITHOUT_SYSTEM_COMPILER=
#
#CPUTYPE=soft
WITH_LIBCPLUSPLUS=
WITH_BINUTILS_BOOTSTRAP=
WITH_CLANG_BOOTSTRAP=
WITH_CLANG=
WITH_CLANG_IS_CC=
WITH_CLANG_FULL=
WITH_CLANG_EXTRAS=
WITH_LLDB=
#
WITH_BOOT=
WITHOUT_LIB32=
WITHOUT_LIBSOFT=
#
WITHOUT_ELFTOOLCHAIN_BOOTSTRAP=
WITHOUT_GCC_BOOTSTRAP=
WITHOUT_GCC=
WITHOUT_GCC_IS_CC=
WITHOUT_GNUCXX=
#
NO_WERROR=
#WERROR=
MALLOC_PRODUCTION=
#
WITH_DEBUG_FILES=
#
XCFLAGS+= -mcpu=cortex-a7
XCXXFLAGS+= -mcpu=cortex-a7
# There is no XCPPFLAGS but XCPP gets XCFLAGS content.


# more /usr/src/sys/arm/conf/RPI2-NODBG 
#
# RPI2 -- Custom configuration for the Raspberry Pi 2
#

include "RPI2"

ident   RPI2-NODBG

makeoptions     DEBUG=-g                # Build kernel with gdb(1) debug symbols

options         ALT_BREAK_TO_DEBUGGER

options         KDB                     # Enable kernel debugger support

# For minimum debugger support (stable branch) use:
options         KDB_TRACE               # Print a stack trace for a panic
options         DDB                     # Enable the kernel debugger

# Extra stuff:
#options        VERBOSE_SYSINIT         # Enable verbose sysinit messages
#options        BOOTVERBOSE=1
#options        BOOTHOWTO=RB_VERBOSE
#options        KTR
#options        KTR_MASK=KTR_TRAP
##options       KTR_CPUMASK=0xF
#options        KTR_VERBOSE

# Disable any extra checking for. . .
nooptions       DEADLKRES               # Enable the deadlock resolver
nooptions       INVARIANTS              # Enable calls of extra sanity checking
nooptions       INVARIANT_SUPPORT       # Extra sanity checks of internal structures, required by INVARIANTS
nooptions       WITNESS                 # Enable checks to detect deadlocks and cycles
nooptions       WITNESS_SKIPSPIN        # Don't run witness on spinlocks for speed
nooptions       DIAGNOSTIC
Comment 1 Ed Maste freebsd_committer freebsd_triage 2017-08-18 13:20:51 UTC
The issue is that lldb is too large and requires a linker that supports range extension thunks. I believe you're linking with in-tree GNU ld and that it does not support them.

Right now you could try using a cross-binutils port.

There are lld patches in review for range extension thunks:

1. https://reviews.llvm.org/D34689
2. https://reviews.llvm.org/D34691
3. https://reviews.llvm.org/D34692
4. https://reviews.llvm.org/D35413

1 and 2 are probably sufficient to address this issue, 3 and 4 are part of a complete & more optimized implementation.

I'm not quite sure what they're waiting on upstream, but presumably they will be committed to lld head soon and we will most likely backport them to lld 5.0.0 in FreeBSD-current.
Comment 2 Ed Maste freebsd_committer freebsd_triage 2018-09-05 12:52:54 UTC
This should be working for armv7 with lld 6.0. More work is still needed for arm/armv6 - see PR 229050.
Comment 3 Mark Millard 2020-03-14 05:26:17 UTC
(In reply to Ed Maste from comment #2)

I tried building head -r358996 lldb for armv7 and
the build reported no errors. (So, based on system
llvm 10 materials.) (I do, by default, use
-mcpu=cortex-a7 explicitly for armv7.)

I also tried building world (lldb included) and
kernel for armv6 and the build reported no errors.
(no -mcpu or other such additions).

I've not tested operation but this report was
about the build failure, not operation.

I do not know the status of this for system llvm9
or before materials or for stable/11 or stable/12 .
It looks like llvm10 materials are planned to be
MFC'd (to at least 12?). So I'm not sure about
if the context is sufficient to close this as
fixed overall (yet).

Relative to head it could be closed as fixed.
Comment 4 Kubilay Kocak freebsd_committer freebsd_triage 2021-12-14 22:08:00 UTC
@Ed Is this now resolved? If so, please assign to committer that resolves and set relevent mfc-stable branches (to + if merged, or - if mfc did not apply).