What fails when devel/xtoolchain-llvm60 attempts to build powerpc64's lib32 in buildworld cross builds (from amd64 here)

Mark Millard marklmi26-fbsd at yahoo.com
Fri May 11 23:09:07 UTC 2018


[I experiment with targeting powerpc family members with
modern tool chains. In this case trying to use
devel/xtoolchain-llvm60 . This was indirectly reached via
commenting on a bugzilla entry for something else powerpc
family related.]

BEGIN setup notes:

Because of (at least) lld problems for targeting powerpc family members,
the following is based on an alternate toolchains/*.mk :

 # diff /usr/local/share/toolchains/llvm60.mk /usr/local/share/toolchains/llvm60_altbinutils.mk
 4,5c4,5
 < XLD=/usr/local/llvm60/bin/ld.lld
 < CROSS_BINUTILS_PREFIX=/var/empty
 ---
 
 > #XLD=/usr/local/llvm60/bin/ld.lld
 > #CROSS_BINUTILS_PREFIX=/var/empty

This is to allow setting up the use of:

CROSS_BINUTILS_PREFIX=/usr/local/powerpc64-unknown-freebsd12.0/bin/

END Setup notes.

The below is from adding a -v to what the .meta file showed for the failing command.
Note the "-cc1as -triple i386-portbld-freebsd12.0" and "-target-cpu i486" that results
from buildworld’s lib32 related command that tries to compile assembly source for
powerpc.


# /usr/local/bin/clang60 -v -DCOMPAT_32BIT -mcpu=powerpc -m32 -L/usr/obj/powerpc64vtsc_xtoolchain-llvm/powerpc.powerpc64/usr/src/powerpc.powerpc64/obj-lib32/tmp/usr/lib32 tosysroot=/usr/obj/powerpc64vtsc_xtoolchain-llvm/powerpc.powerpc64/usr/src/powerpc.powerpc64/obj-lib32/tmp -B/usr/local/powerpc64-unknown-freebsd12.0/bin -B/usr/obj/powerpc64vtsc_x -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wunused-parameter -Wcast-align -Wchar-subscripts -Winline -Wnested-externs -Wredundant-decls -Wold-style-definition -Wno-pointer-sign -Wthread-safety -Wno-empty-body -Wno-string-plus-int -Wno-unused-const-variable  -Qunused-arguments    -c /usr/src/lib/csu/powerpc/crtn.S -o crtn.ole-definition -Wno-pointer-sign -Wthread-safety -Wno-empty-body -Wno-string-plus-int -Wno-unus
clang version 6.0.0 (tags/RELEASE_600/final)/usr/src/lib/csu/powerpc/crtn.S -o crtn.o
Target: i386-portbld-freebsd12.0
Thread model: posix
InstalledDir: /usr/local/llvm60/bin
"/usr/local/llvm60/bin/clang-6.0" -cc1 -triple i386-portbld-freebsd12.0 -E -disable-free -main-file-name crtn.S -mrelocation-model static -mthread-model posix -mdisable-fp-elim -masm-verbose -mconstructor-aliases -target-cpu i486 -dwarf-column-info -debug-info-kind=standalone -dwarf-version=2 -debugger-tuning=gdb -v -coverage-notes-file /usr/src/crtn.gcno -resource-dir /usr/local/llvm60/lib/clang/6.0.0 -D COMPAT_32BIT -I /usr/src/lib/csu/common -I /usr/src/lib/libc/include -isysroot /usr/obj/powerpc64vtsc_xtoolchain-llvm/powerpc.powerpc64/usr/src/powerpc.powerpc64/obj-lib32/tmp -O2 -Wsystem-headers -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wunused-parameter -Wcast-align -Wchar-subscripts -Winline -Wnested-externs -Wredundant-decls -Wold-style-definition -Wno-pointer-sign -Wthread-safety -Wno-empty-body -Wno-string-plus-int -Wno-unused-const-variable -std=gnu99 -fconst-strings -fdebug-compilation-dir /usr/src -ferror-limit 19 -fmessage-length 180 -fobjc-runtime=gnustep -fdiagnostics-show-option -vectorize-loops -vectorize-slp -o /tmp/crtn-d80df9.s -x assembler-with-cpp /usr/src/lib/csu/powerpc/crtn.S
clang -cc1 version 6.0.0 based upon LLVM 6.0.0 default target x86_64-portbld-freebsd12.0
#include "..." search starts here:
#include <...> search starts here:
/usr/src/lib/csu/common
/usr/src/lib/libc/include
/usr/local/llvm60/lib/clang/6.0.0/include
/usr/obj/powerpc64vtsc_xtoolchain-llvm/powerpc.powerpc64/usr/src/powerpc.powerpc64/obj-lib32/tmp/usr/include
End of search list.
"/usr/local/llvm60/bin/clang-6.0" -cc1as -triple i386-portbld-freebsd12.0 -filetype obj -main-file-name crtn.S -target-cpu i486 -I /usr/src/lib/csu/common -I /usr/src/lib/libc/include -fdebug-compilation-dir /usr/src -dwarf-debug-producer clang version 6.0.0 (tags/RELEASE_600/final) -I /usr/src/lib/csu/common -I /usr/src/lib/libc/include -debug-info-kind=limited -dwarf-version=2 -mrelocation-model static -o crtn.o /tmp/crtn-d80df9.s
/usr/src/lib/csu/powerpc/crtn.S:29:2: warning: DWARF2 only supports one section per compilation unit
.section .init,"ax", at progbits
^
/usr/src/lib/csu/powerpc/crtn.S:30:11: error: unexpected token in memory operand
lwz 11,0(1)
         ^
/usr/src/lib/csu/powerpc/crtn.S:31:10: error: unexpected token in memory operand
lwz 0,4(11)
        ^
/usr/src/lib/csu/powerpc/crtn.S:32:2: error: invalid instruction mnemonic 'mtlr'
mtlr 0
^~~~
. . .



It would appear that a -triple may be missing in the /usr/local/bin/clang60
command line that would specify the specific ABI to target. It appears that
the -mcpu=powerpc is not enough to even get the cpu family right as far as
what assembler notation to process.

I do not know if an appropriate -triple addition would currently be
sufficient for things to start working.

Something needs to cause the right assembler notation to be processed for
lib32 if WITH_LIB32= is to be supported for cross builds.


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








More information about the freebsd-toolchain mailing list