make buildworld failed with error "relocation truncated to fit: R_ARM_JUMP24 against symbol `_fini'"

Mark Millard markmi at dsl-only.net
Mon Jan 18 07:31:41 UTC 2016


The jump distances involved in those cases are larger than the offset encoding in the instructions can indicate. The compiler must be told to do more than just set up for such "small" constant offsets plugged in to instructions by the linker/loader.

For arm the option used for this for static linking contexts is: -mlong-calls
(But mips can also have -mlong-calls.)

However the -mlong-calls are all in place in base/head as of: -r294031


An explanation of why you hit a problem anyway might be that you have an odd mix of paths in your note. For example:

> /usr/local/raspbsd/src/common/lib/csu/arm/crt1.c

is apparently not inside the tree starting at

> /usr/src

But your "steps" show /usr/src use:

> # svnlite checkout svn://svn.freebsd.org/base/head /usr/src
> . . .
> # cd /usr/src
> # svnlite update
> . . .
> # svnlite info
> Path: .
> Working Copy Root Path: /usr/src
> . . .
> # make buildworld


May be something not shown from your /etc/src.conf or some place else redirected things? May be you are picking up some old files from a prior build?



Notes about where -mlong-calls are used. . . 

The clang 3.8.0 investigation ran into this for building clang and lldb. A quick scan of materials checked out from that branch (my /usr/src is bound to that branch) shows the following as far as what 4 Makefile* or 2 *.mk files list the option someplace:

> # find /usr/src/ -name .svn -prune -o -name 'Makefile*' -exec grep mlong-calls {} \; -print
> STATIC_CXXFLAGS+= -mlong-calls
> /usr/src/lib/libc++/Makefile
> STATIC_CFLAGS+= -mlong-calls
> /usr/src/lib/csu/arm/Makefile
> CFLAGS+=        -mlong-calls
> /usr/src/usr.bin/clang/lldb/Makefile
> CFLAGS+= -mlong-calls
> /usr/src/usr.bin/clang/clang/Makefile

> # find /usr/src/ -name .svn -prune -o -name '*.mk' -exec grep mlong-calls {} \; -print
> STATIC_CXXFLAGS+= -mlong-calls
> /usr/src/lib/clang/clang.lib.mk
> CFLAGS+=        -G0 -fno-pic -mno-abicalls -mlong-calls
> /usr/src/sys/conf/kmod.mk

(That last one is for mips instead of arm and has been around a long time.)

They all are in -r294031 on base/head . (One of the 5 arm specific ones has been there a little longer: -r293648 .)

In order to also show the usage of the flags with the STATIC_C prefixes:

> # find /usr/src/ -name .svn -prune -o -name 'Makefile*' -exec grep -E 'STATIC_C[XL]|mlong-calls' {} \; -print
> STATIC_CXXFLAGS+= -mlong-calls
> /usr/src/lib/libc++/Makefile
> STATIC_CFLAGS+= -mlong-calls
> /usr/src/lib/csu/arm/Makefile
> CFLAGS+=        -mlong-calls
> /usr/src/usr.bin/clang/lldb/Makefile
> CFLAGS+= -mlong-calls
> /usr/src/usr.bin/clang/clang/Makefile

> # find /usr/src/ -name .svn -prune -o -name '*.mk' -exec grep -E 'STATIC_C[XL]|mlong-calls' {} \; -print
> STATIC_CXXFLAGS+= -mlong-calls
> /usr/src/lib/clang/clang.lib.mk
>         ${CC} ${STATIC_CFLAGS} ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET}
>         ${CC} ${PO_FLAG} ${STATIC_CFLAGS} ${PO_CFLAGS} -c ${.IMPSRC} -o ${.TARGET}
>         ${CXX} ${STATIC_CXXFLAGS} ${CXXFLAGS} -c ${.IMPSRC} -o ${.TARGET}
>         ${CXX} ${PO_FLAG} ${STATIC_CXXFLAGS} ${PO_CXXFLAGS} -c ${.IMPSRC} -o ${.TARGET}
> /usr/src/share/mk/bsd.lib.mk
> CFLAGS+=        -G0 -fno-pic -mno-abicalls -mlong-calls
> /usr/src/sys/conf/kmod.mk

(That last one is again for mips instead of arm and has been around a long time.)

(I used the base/projects/clang380-import branch materials only because that is what my /usr/src is currently bound to.)


While clang 3.8.0 builds normally have this large-distance issue, as far as I know normal clang 3.7.1 builds do not normally have large enough distances to create the issue. But the paths in your notes suggest something is not normal about your context.

Separately: I agree with Andreas Schwarz's note that doing builds and installs while having a tiny /tmp is likely not going to work: /tmp will likely run out of space even though elsewhere has lots of space available.

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



More information about the freebsd-arm mailing list