system-clang system-lld used to amd64->powerpc (32-bit) cross-build: lld with "-m" "elf32ppc_fbsd" is not enough to allow --secure-plt

Mark Millard marklmi at yahoo.com
Mon Jul 8 02:57:58 UTC 2019


Sometime at or before head -r349444 my historical src.conf variant
that I use to attempt amd64->powerpc cross-build to using system-ld
(lld) started reporting:

--- buildworld ---
make[1]: "/usr/src/Makefile.inc1" line 347: SYSTEM_COMPILER: Determined that CC=cc matches the source tree.  Not bootstrapping a cross-compiler.
make[1]: "/usr/src/Makefile.inc1" line 352: SYSTEM_LINKER: Determined that LD=ld matches the source tree.  Not bootstrapping a cross-linker.
. . .
--- libc.so.7.full ---
ld: error: unknown argument: --secure-plt
cc: error: linker command failed with exit code 1 (use -v to see invocation)
*** [libc.so.7.full] Error code 1

The libc.so.7.full.meta file reports the CMD as (ignoring the part for the
huge *.pico file list):

cc -target powerpc-unknown-freebsd13.0 --sysroot=/usr/obj/powerpcvtsc_clang/powerpc.powerpc/usr/src/powerpc.powerpc/tmp -B/usr/obj/powerpcvtsc_clang/powerpc.powerpc/usr/src/powerpc.powerpc/tmp/usr/bin  -Wl,--secure-plt -nodefaultlibs -Wl,--version-script=Version.map -Wl,--no-threads   -shared -Wl,-x -Wl,--fatal-warnings -Wl,--warn-shared-textrel  -o libc.so.7.full -Wl,-soname,libc.so.7

Adding -### and executing that reports ( on -r349794 ):
(lines split for readability)

FreeBSD clang version 8.0.1 (branches/release_80 364487) (based on LLVM 8.0.1)
Target: powerpc-unknown-freebsd13.0
Thread model: posix
InstalledDir: /usr/bin
 "/usr/bin/ld" \
"--sysroot=/usr/obj/powerpcvtsc_clang/powerpc.powerpc/usr/src/powerpc.powerpc/tmp" \
"--eh-frame-hdr" "-Bshareable" "--enable-new-dtags" \
"-m" "elf32ppc_fbsd" \
"-o" "libc.so.7.full" \
"/usr/obj/powerpcvtsc_clang/powerpc.powerpc/usr/src/powerpc.powerpc/tmp/usr/lib/crti.o" \
"/usr/obj/powerpcvtsc_clang/powerpc.powerpc/usr/src/powerpc.powerpc/tmp/usr/lib/crtbeginS.o" \
"-L/usr/obj/powerpcvtsc_clang/powerpc.powerpc/usr/src/powerpc.powerpc/tmp/usr/lib" \
"--secure-plt" \
"--version-script=Version.map" "--no-threads" "-x" "--fatal-warnings" "--warn-shared-textrel" \
"-soname" "libc.so.7" \
"/usr/obj/powerpcvtsc_clang/powerpc.powerpc/usr/src/powerpc.powerpc/tmp/usr/lib/crtendS.o" \
"/usr/obj/powerpcvtsc_clang/powerpc.powerpc/usr/src/powerpc.powerpc/tmp/usr/lib/crtn.o"


Executing the full reported "/usr/bin/ld" produces:

ld: error: unknown argument: --secure-plt

So "-m" "elf32ppc_fbsd" was insufficient to enable allowing --secure-plt (a powerpc
32-bit specific option).


===
Mark Millard
marklmi at yahoo.com
( dsl-only.net went
away in early 2018-Mar)



More information about the freebsd-toolchain mailing list