Skip to content

"unrecognized relocation" error in FreeBSD with GCC 4 and 5 #158

@giordano

Description

@giordano

We recently started observing a new bug in the FreeBSD toolchain with GCC 4 and 5:

% julia -e 'using BinaryBuilderBase; BinaryBuilderBase.runshell(Platform("x86_64", "freebsd"); preferred_gcc_version=v"4")'
sandbox:${WORKSPACE} # make -C /usr/share/testsuite/
make: Entering directory '/usr/share/testsuite'
make[1]: Entering directory '/usr/share/testsuite/c/dyn_link'
x86_64-unknown-freebsd11.1-cc -shared -o /tmp/testsuite/x86_64-unknown-freebsd11.1/c/dyn_link/libfoo/libfoo.so -fPIC -g -O2 -lm libfoo/libfoo.c
x86_64-unknown-freebsd11.1-cc -o /tmp/testsuite/x86_64-unknown-freebsd11.1/c/dyn_link/dyn_link -I/usr/share/testsuite/c/dyn_link/libfoo -fPIC -g -O2 -Wl,-z,origin -Wl,-rpath,$ORIGIN/libfoo -L/tmp/testsuite/x86_64-unknown-freebsd11.1/c/dyn_link/libfoo -lfoo dyn_link.c
make[1]: Leaving directory '/usr/share/testsuite/c/dyn_link'
make[1]: Entering directory '/usr/share/testsuite/c/hello_world'
x86_64-unknown-freebsd11.1-cc -o /tmp/testsuite/x86_64-unknown-freebsd11.1/c/hello_world/hello_world -g -O2 hello_world.c
make[1]: Leaving directory '/usr/share/testsuite/c/hello_world'
make[1]: Entering directory '/usr/share/testsuite/c/openmp'
gcc -o /tmp/testsuite/x86_64-unknown-freebsd11.1/c/openmp/openmp -g -O2 -fopenmp openmp.c
make[1]: Leaving directory '/usr/share/testsuite/c/openmp'
make[1]: Entering directory '/usr/share/testsuite/cxx/dyn_link'
x86_64-unknown-freebsd11.1-c++ -shared -o /tmp/testsuite/x86_64-unknown-freebsd11.1/cxx/dyn_link/librepeater/librepeater.so -fPIC -g -O2 -lm librepeater/librepeater.cc
x86_64-unknown-freebsd11.1-c++ -o /tmp/testsuite/x86_64-unknown-freebsd11.1/cxx/dyn_link/dyn_link -I/usr/share/testsuite/cxx/dyn_link/librepeater -fPIC -g -O2 -Wl,-z,origin -Wl,-rpath,$ORIGIN/librepeater -L/tmp/testsuite/x86_64-unknown-freebsd11.1/cxx/dyn_link/librepeater -lrepeater dyn_link.cc
/opt/x86_64-unknown-freebsd11.1/bin/x86_64-unknown-freebsd11.1-ld: /tmp/dyn_link-4e028c.o: unrecognized relocation (0x2a) in section `.text'
/opt/x86_64-unknown-freebsd11.1/bin/x86_64-unknown-freebsd11.1-ld: final link failed: Bad value
clang-12: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [Makefile:8: /tmp/testsuite/x86_64-unknown-freebsd11.1/cxx/dyn_link/dyn_link] Error 1
make[1]: Leaving directory '/usr/share/testsuite/cxx/dyn_link'
make: *** [Makefile:45: build-project-cxx-dyn_link] Error 2
make: Leaving directory '/usr/share/testsuite'
sandbox:${WORKSPACE} #

You can observe the same with preferred_gcc_version=v"5", but no other versions. I'm not really sure why this depends on the version of GCC, maybe that's a proxy for something like binutils? Also, I have no clue why we're seeing this now (v0.6.10 currently), I believe this wasn't an issue until some time ago and we didn't change anything in FreeBSD specifically lately. I'll try to bisect the issue.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions