Date: Fri, 9 Oct 2015 19:40:27 -0700 From: Mark Millard <markmi@dsl-only.net> To: FreeBSD PowerPC ML <freebsd-ppc@freebsd.org>, FreeBSD Toolchain <freebsd-toolchain@freebsd.org> Subject: powerpc64-xtoolchain/powerpc64-gcc lacks lib32 support, so fails boot1.elf link (for example) Message-ID: <CE734646-79DA-4ED2-A650-4ABC0732A47C@dsl-only.net>
next in thread | raw e-mail | index | archive | help
For an amd64 11.0 context with powerpc64-xtoolchain-gcc in place: doing make -j 7 CROSS_TOOLCHAIN=3Dpowerpc64-gcc \ -DWITHOUT_GCC -DWITHOUT_GCC_BOOTSTRAP -DWITHOUT_GNUCXX \ -DWITHOUT_CLANG -DWITHOUT_CLANG_BOOTSTRAP -DWITHOUT_CLANG_FULL = -DWITHOUT_CLANG_IS_CC \ -DWITHOUT_CLANG_EXTRAS -DWITHOUT_LLDB \ buildworld buildkernel KERNCONF=3DGENERIC64-NODBG \ TARGET=3Dpowerpc TARGET_ARCH=3Dpowerpc64 the result is the following during WITH_BOOT's build activity: --- boot1.elf --- /usr/local/bin/powerpc64-portbld-freebsd11.0-gcc -isystem = /usr/obj/powerpc.powerpc64/usr/src/tmp/usr/include = -L/usr/obj/powerpc.powerpc64/usr/src/tmp/usr/lib = --sysroot=3D/usr/obj/powerpc.powerpc64/usr/src/tmp = -B/usr/local/powerpc64-freebsd/bin/ -ffreestanding -msoft-float -Os = -I/usr/src/sys/boot/powerpc/boot1.chrp/../../common = -I/usr/src/sys/boot/powerpc/boot1.chrp/../../../ -D_STANDALONE -m32 = -mcpu=3Dpowerpc -m32 -mcpu=3Dpowerpc -std=3Dgnu99 -nostdlib -static = -Wl,-N -Wl,-m -Wl,elf32ppc_fbsd -Wl,-m -Wl,elf32ppc_fbsd -o boot1.elf = boot1.o ashldi3.o syncicache.o=20 boot1.o: In function `__puts': boot1.c:(.text+0xf4): undefined reference to `_restgpr_28_x' boot1.o: In function `__printf': boot1.c:(.text+0x50c): undefined reference to `_restgpr_24_x' boot1.o: In function `ofw_getprop': boot1.c:(.text+0x638): undefined reference to `_restgpr_31_x' boot1.o: In function `ofw_close': boot1.c:(.text+0x6a4): undefined reference to `_restgpr_31_x' boot1.o: In function `dskread': boot1.c:(.text+0x7ac): undefined reference to `_restgpr_25_x' boot1.o: In function `fsread': boot1.c:(.text+0xcb4): undefined reference to `_restgpr_16_x' boot1.o: In function `domount': boot1.c:(.text+0xd88): undefined reference to `_restgpr_28_x' boot1.o: In function `ofw_write.constprop.2': boot1.c:(.text+0xe10): undefined reference to `_restgpr_30_x' boot1.o: In function `putchar': boot1.c:(.text+0xe60): undefined reference to `_restgpr_30_x' boot1.o: In function `main': boot1.c:(.text.startup+0x538): undefined reference to `_restgpr_18_x' collect2: error: ld returned 1 exit status *** [boot1.elf] Error code 1 This is from there being no lib32-like libgcc or its use from what I can = tell. For example a normal gcc 4.2.1 build WITH_LIB32=3D has the = following that a CROSS_TOOLCHAIN=3Dpowerpc64-gcc does not have: . . . --- _lib-eh-install --- sh /usr/src/tools/install.sh -C -o root -g wheel -m 444 libgcc_eh.a = /usr/obj/powerpc.powerpc64/usr/src/lib32/usr/lib32 . . . --- _lib-eh-install --- sh /usr/src/tools/install.sh -C -o root -g wheel -m 444 libgcc_eh.a = /usr/obj/powerpc.powerpc64/usr/src/lib32/usr/lib32 sh /usr/src/tools/install.sh -C -o root -g wheel -m 444 libgcc_eh_p.a = /usr/obj/powerpc.powerpc64/usr/src/lib32/usr/lib32 --- _libinstall --- sh /usr/src/tools/install.sh -s -o root -g wheel -m 444 = libgcc_s.so.1 /usr/obj/powerpc.powerpc64/usr/src/lib32/usr/lib32 sh /usr/src/tools/install.sh -l s libgcc_s.so.1 = /usr/obj/powerpc.powerpc64/usr/src/lib32/usr/lib32/libgcc_s.so . . . --- _lib-eh-install --- sh /usr/src/tools/install.sh -C -o root -g wheel -m 444 libgcc_eh.a = /usr/obj/powerpc.powerpc64/usr/src/lib32/usr/lib32 sh /usr/src/tools/install.sh -C -o root -g wheel -m 444 libgcc_eh_p.a = /usr/obj/powerpc.powerpc64/usr/src/lib32/usr/lib32 . . . --- gnu/lib__L --- sh /usr/src/tools/install.sh -s -o root -g wheel -m 444 = libgcc_s.so.1 /usr/obj/powerpc.powerpc64/usr/src/lib32/usr/lib32 sh /usr/src/tools/install.sh -l s libgcc_s.so.1 = /usr/obj/powerpc.powerpc64/usr/src/lib32/usr/lib32/libgcc_s.so Some of which would be assocaited with the -m32 use in (for a normal gcc = 4.2.1 based build): --- boot1.elf --- cc -ffreestanding -msoft-float -Os = -I/usr/src/sys/boot/powerpc/boot1.chrp/../../common = -I/usr/src/sys/boot/powerpc/boot1.chrp/../../../ -D_STANDALONE -m32 = -mcpu=3Dpowerpc -m32 -mcpu=3Dpowerpc -std=3Dgnu99 -nostdlib -static = -Wl,-N -Wl,-m -Wl,elf32ppc_fbsd -Wl,-m -Wl,elf32ppc_fbsd -o boot1.elf = boot1.o ashldi3.o syncicache.o=20 The failing powerpc64-xtoolchain-gcc case lists the following when = -Wl,-M,--verbose is used: --- sys.all__D --- /usr/local/bin/powerpc64-portbld-freebsd11.0-gcc -isystem = /usr/obj/powerpc.powerpc64/usr/src/tmp/usr/include = -L/usr/obj/powerpc.powerpc64/usr/src/tmp/usr/lib = --sysroot=3D/usr/obj/powerpc.powerpc64/usr/src/tmp = -B/usr/local/powerpc64-freebsd/bin/ -ffreestanding -msoft-float -Os = -I/usr/src/sys/boot/powerpc/boot1.chrp/../../common = -I/usr/src/sys/boot/powerpc/boot1.chrp/../../../ -D_STANDALONE -m32 = -mcpu=3Dpowerpc -m32 -mcpu=3Dpowerpc -std=3Dgnu99 -nostdlib -static = -Wl,-N -Wl,-m -Wl,elf32ppc_fbsd -Wl,-M,--verbose -Wl,-m = -Wl,elf32ppc_fbsd -Wl,-M,--verbose -o boot1.elf boot1.o ashldi3.o = syncicache.o=20 . . . --- sys.all__D --- GNU ld (GNU Binutils) 2.25.1 Supported emulations: elf64ppc_fbsd elf64ppc elf32ppc_fbsd elf32ppc using internal linker script: =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= /* Script for -N: mix text and data on same page; don't align data */ /* Copyright (C) 2014 Free Software Foundation, Inc. Copying and distribution of this script, with or without = modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. */ OUTPUT_FORMAT("elf32-powerpc-freebsd", "elf32-powerpc-freebsd", "elf32-powerpc-freebsd") OUTPUT_ARCH(powerpc:common) ENTRY(_start) SEARCH_DIR("=3D/usr/local/powerpc-freebsd/lib32"); = SEARCH_DIR("=3D/lib32"); SEARCH_DIR("=3D/usr/lib32"); = SEARCH_DIR("=3D/usr/local/lib32"); = SEARCH_DIR("=3D/usr/local/powerpc-freebsd/lib"); SEARCH_DIR("=3D/lib"); = SEARCH_DIR("=3D/usr/lib"); SEARCH_DIR("=3D/usr/local/lib"); PROVIDE (__stack =3D 0); PROVIDE (___stack =3D 0); . . . However: root@FreeBSDx64:/usr/src # ls /usr/local/powerpc-freebsd/lib32 ls: /usr/local/powerpc-freebsd/lib32: No such file or directory root@FreeBSDx64:/usr/src # ls /lib32 ls: /lib32: No such file or directory root@FreeBSDx64:/usr/src # ls /usr/lib32 . . . (list from amd64's context) . . . root@FreeBSDx64:/usr/src # ls /usr/local/lib32 ls: /usr/local/lib32: No such file or directory root@FreeBSDx64:/usr/src # ls /usr/local/powerpc-freebsd/lib ls: /usr/local/powerpc-freebsd/lib: No such file or directory root@FreeBSDx64:/usr/src # ls /usr/lib . . . (list from amd64's context) . . . root@FreeBSDx64:/usr/src # ls /usr/local/lib . . . (list from amd64's context) . . . so powerpc64-xtoolchain and its powerpc64 do not have any lib32 specific = search areas populated but for /usr/lib32: none powerpc64 specific. The context details follow. Mac OS X 10.10.5 using a VirtualBox V5.0.4 VM with. . . root@FreeBSDx64:/usr/src # freebsd-version -ku; uname -aKU 11.0-CURRENT 11.0-CURRENT FreeBSD FreeBSDx64 11.0-CURRENT FreeBSD 11.0-CURRENT #0 r288459: Sat Oct = 3 03:42:08 PDT 2015 = root@FreeBSDx64:/usr/obj/usr/src/sys/GENERIC-NODEBUG amd64 1100079 = 1100079 root@FreeBSDx64:/usr/src # svnlite info /usr/src Path: . Working Copy Root Path: /usr/src URL: https://svn.freebsd.org/base/head Relative URL: ^/head Repository Root: https://svn.freebsd.org/base Repository UUID: ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f Revision: 288459 Node Kind: directory Schedule: normal Last Changed Author: gjb Last Changed Rev: 288459 Last Changed Date: 2015-10-01 12:48:10 -0700 (Thu, 01 Oct 2015) root@FreeBSDx64:/usr/src # more /etc/src.conf # World: NO_WERROR=3D # Kernel: WERROR=3D root@FreeBSDx64:/usr/src # more /etc/make.conf /etc/make.conf: No such file or directory root@FreeBSDx64:/usr/src # svnlite info /usr/ports Path: /usr/ports Working Copy Root Path: /usr/ports URL: https://svn.freebsd.org/ports/head Relative URL: ^/head Repository Root: https://svn.freebsd.org/ports Repository UUID: 35697150-7ecd-e111-bb59-0022644237b5 Revision: 398559 Node Kind: directory Schedule: normal Last Changed Author: jbeich Last Changed Rev: 398559 Last Changed Date: 2015-10-03 17:42:55 -0700 (Sat, 03 Oct 2015) root@FreeBSDx64:/usr/src # portmaster --list-origins net/avahi devel/boost-all lang/clang37 ports-mgmt/dialog4ports lang/gcc5 devel/git-lite x11/lumina sysutils/lxterminal www/midori net/netatalk3 ports-mgmt/pkg ports-mgmt/portmaster devel/powerpc64-xtoolchain-gcc devel/qtcreator security/sudo mail/thunderbird emulators/virtualbox-ose-additions Very little is non-default source code. . . root@FreeBSDx64:/usr/src # svnlite status M lib/csu/powerpc64/Makefile ? sys/arm/conf/RPI2-NODBG M sys/boot/powerpc/Makefile.inc ? sys/powerpc/conf/GENERIC64-NODBG root@FreeBSDx64:/usr/src # svnlite status /usr/ports ? /usr/ports/ion root@FreeBSDx64:/usr/src # more = /usr/src/sys/powerpc/conf/GENERIC64-NODBG=20 . . . (comments omitted) . . . include GENERIC64 ident GENERIC-NODBG nooptions INVARIANTS nooptions INVARIANT_SUPPORT nooptions WITNESS nooptions WITNESS_SKIPSPIN nooptions DEADLKRES (The copy->paste sequence for the below diffs likely turned tabs into = spaces.) root@FreeBSDx64:/usr/src # svnlite diff sys/boot/powerpc/Makefile.inc=20 Index: sys/boot/powerpc/Makefile.inc =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- sys/boot/powerpc/Makefile.inc (revision 288459) +++ sys/boot/powerpc/Makefile.inc (working copy) @@ -2,7 +2,7 @@ =20 .if ${MACHINE_ARCH} =3D=3D "powerpc64" CFLAGS+=3D -m32 -mcpu=3Dpowerpc -LDFLAGS+=3D -m elf32ppc_fbsd +LDFLAGS+=3D -Wl,-m -Wl,elf32ppc_fbsd -Wl,-M,--verbose .endif =20 .include "../Makefile.inc" The following is my personal, local workaround for = /usr/src/lib/csu/powerpc64/Makefile forcing use of the gcc command even = when the context does not have one. root@FreeBSDx64:/usr/src # svnlite diff /usr/src Index: /usr/src/lib/csu/powerpc64/Makefile =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- /usr/src/lib/csu/powerpc64/Makefile (revision 288459) +++ /usr/src/lib/csu/powerpc64/Makefile (working copy) @@ -13,8 +13,8 @@ # clang doesn't support -mlongcall, and testing shows a clang linked = with a # clang-built csu segfaults, this must currently be compiled with gcc. = Once # clang supports -mlongcall, or we get a fixed ld, this can be = revisited. -CC:=3D gcc -COMPILER_TYPE:=3D gcc +#CC:=3D gcc +#COMPILER_TYPE:=3D gcc FILES=3D ${OBJS} FILESMODE=3D ${LIBMODE} =3D=3D=3D Mark Millard markmi at dsl-only.net
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CE734646-79DA-4ED2-A650-4ABC0732A47C>