[My previous build was based on head -r337400 and did not have this problem. I experiment with powerpc64 and powerpc builds via fairly modern compilers and toolchains, although I currently do nto have access to such hardware.]
Despite the amd64 and i386 focused comment in: QUOTE # Slim down the image. This saves about 15% in size with clang 6 on x86 # Our most constrained /boot/loader env is BIOS booting on x86, where # our text + data + BTX have to fit into 640k below the ISA hole. # Experience has shown that problems arise between ~520k to ~530k. CFLAGS.clang+= -Oz CFLAGS.gcc+= -Os ENDQUOTE the code is not conditional on such a context being involved. This changes the powerpc64 to fail for a devel/powerpc64-gcc and devel/powerpc64-binutil based build when boot1.elf is attempted: --- boot1.elf --- Using built-in specs. COLLECT_GCC=/usr/local/bin/powerpc64-unknown-freebsd12.0-gcc COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/powerpc64-unknown-freebsd12.0/6.4.0/lto-wrapper Target: powerpc64-unknown-freebsd12.0 Configured with: /wrkdirs/usr/ports/devel/powerpc64-gcc/work/gcc-6.4.0/configure --target=powerpc64-unknown-freebsd12.0 --disable-nls --enable-languages=c,c++ --enable-gnu-indirect-function --without-headers --with-gmp=/usr/local --with-pkgversion='FreeBSD Ports Collection for powerpc64' --with-system-zlib --with-gxx-include-dir=/usr/include/c++/v1/ --with-sysroot=/ --with-as=/usr/local/bin/powerpc64-unknown-freebsd12.0-as --with-ld=/usr/local/bin/powerpc64-unknown-freebsd12.0-ld --enable-initfini-array --prefix=/usr/local --localstatedir=/var --mandir=/usr/local/man --infodir=/usr/local/info/ --build=x86_64-unknown-freebsd12.0 Thread model: posix gcc version 6.4.0 (FreeBSD Ports Collection for powerpc64) COMPILER_PATH=/usr/local/powerpc64-unknown-freebsd12.0/bin/:/usr/local/libexec/gcc/powerpc64-unknown-freebsd12.0/6.4.0/:/usr/local/libexec/gcc/powerpc64-unknown-freebsd12.0/6.4.0/:/usr/local/libexec/gcc/powerpc64-unknown-freebsd12.0/:/usr/local/lib/gcc/powerpc64-unknown-freebsd12.0/6.4.0/:/usr/local/lib/gcc/powerpc64-unknown-freebsd12.0/:/usr/local/lib/gcc/powerpc64-unknown-freebsd12.0/6.4.0/../../../../powerpc64-unknown-freebsd12.0/bin/ LIBRARY_PATH=/usr/local/powerpc64-unknown-freebsd12.0/bin/:/usr/local/lib/gcc/powerpc64-unknown-freebsd12.0/6.4.0/:/usr/local/lib/gcc/powerpc64-unknown-freebsd12.0/6.4.0/../../../../powerpc64-unknown-freebsd12.0/lib/:/usr/obj/powerpc64vtsc_xtoolchain-gcc-no_toolchain/powerpc.powerpc64/usr/src/powerpc.powerpc64/tmp/lib/:/usr/obj/powerpc64vtsc_xtoolchain-gcc-no_toolchain/powerpc.powerpc64/usr/src/powerpc.powerpc64/tmp/usr/lib/ COLLECT_GCC_OPTIONS='-B' '/usr/local/powerpc64-unknown-freebsd12.0/bin/' '-O2' '-pipe' '-nostdinc' '-I' '/usr/obj/powerpc64vtsc_xtoolchain-gcc-no_toolchain/powerpc.powerpc64/usr/src/powerpc.powerpc64/stand/libsa' '-I' '/usr/src/stand/libsa' '-D' '_STANDALONE' '-I' '/usr/src/sys' '-D' 'double=jagged-little-pill' '-D' 'float=floaty-mcfloatface' '-D' 'LOADER_GELI_SUPPORT' '-I' '/usr/src/stand/libsa/geli' '-D' 'LOADER_DISK_SUPPORT' '-m32' '-mcpu=powerpc' '-ffreestanding' '-msoft-float' '-I' '.' '-I' '/usr/src/stand/common' '-std=gnu99' '-Wsystem-headers' '-Wno-pointer-sign' '-Wno-error=address' '-Wno-error=array-bounds' '-Wno-error=attributes' '-Wno-error=bool-compare' '-Wno-error=cast-align' '-Wno-error=clobbered' '-Wno-error=enum-compare' '-Wno-error=extra' '-Wno-error=inline' '-Wno-error=logical-not-parentheses' '-Wno-error=strict-aliasing' '-Wno-error=uninitialized' '-Wno-error=unused-but-set-variable' '-Wno-error=unused-function' '-Wno-error=unused-value' '-Wno-error=misleading-inde ntation' '-Wno-error=nonnull-compare' '-Wno-error=shift-negative-value' '-Wno-error=tautological-compare' '-Wno-error=unused-const-variable' '-v' '-Os' '-nostdlib' '-static' '-o' 'boot1.elf' /usr/local/libexec/gcc/powerpc64-unknown-freebsd12.0/6.4.0/collect2 -plugin /usr/local/libexec/gcc/powerpc64-unknown-freebsd12.0/6.4.0/liblto_plugin.so -plugin-opt=/usr/local/libexec/gcc/powerpc64-unknown-freebsd12.0/6.4.0/lto-wrapper -plugin-opt=-fresolution=/tmp//cco6MSov.res --sysroot=/usr/obj/powerpc64vtsc_xtoolchain-gcc-no_toolchain/powerpc.powerpc64/usr/src/powerpc.powerpc64/tmp -V -static -melf32ppc_fbsd -V -Bstatic -o boot1.elf -L/usr/local/powerpc64-unknown-freebsd12.0/bin -L/usr/local/lib/gcc/powerpc64-unknown-freebsd12.0/6.4.0 -L/usr/local/lib/gcc/powerpc64-unknown-freebsd12.0/6.4.0/../../../../powerpc64-unknown-freebsd12.0/lib -L/usr/obj/powerpc64vtsc_xtoolchain-gcc-no_toolchain/powerpc.powerpc64/usr/src/powerpc.powerpc64/tmp/lib -L/usr/obj/powerpc64vtsc_xtoolchain-gcc-no_toolchain/powerpc.powerpc64/usr/src/powerpc.powerpc64/tmp/usr/lib -N boot1.o qdivrem.o udivdi3.o ashldi3.o syncicache.o GNU ld (GNU Binutils) 2.30 Supported emulations: elf64ppc_fbsd elf64ppc elf32ppc_fbsd elf32ppc GNU ld (GNU Binutils) 2.30 Supported emulations: elf64ppc_fbsd elf64ppc elf32ppc_fbsd elf32ppcboot1.o: In function `__puts': boot1.c:(.text+0xe0): undefined reference to `_restgpr_28_x' boot1.o: In function `__printf': boot1.c:(.text+0x1a0): undefined reference to `_restgpr_24_x' boot1.o: In function `ofw_getprop': boot1.c:(.text+0x5fc): undefined reference to `_restgpr_31_x' boot1.o: In function `ofw_close': boot1.c:(.text+0x668): undefined reference to `_restgpr_31_x' boot1.o: In function `dskread': boot1.c:(.text+0x76c): undefined reference to `_restgpr_25_x' boot1.o: In function `ofw_write.constprop.2': boot1.c:(.text+0x7f4): undefined reference to `_restgpr_30_x' boot1.o: In function `putchar': boot1.c:(.text+0x844): undefined reference to `_restgpr_30_x' boot1.o: In function `fsread_size.constprop.11': boot1.c:(.text+0x904): undefined reference to `_restgpr_17_x' boot1.o: In function `domount.constprop.4': boot1.c:(.text+0xe98): undefined reference to `_restgpr_30_x' boot1.o: In function `main': boot1.c:(.text.startup+0x3c0): undefined reference to `_restgpr_19_x' qdivrem.o: In function `__qdivrem': qdivrem.c:(.text+0xb8): undefined reference to `_restgpr_25_x' collect2: error: ld returned 1 exit status *** [boot1.elf] Error code 1 make[5]: stopped in /usr/src/stand/powerpc/boot1.chrp .ERROR_TARGET='boot1.elf' .ERROR_META_FILE='/usr/obj/powerpc64vtsc_xtoolchain-gcc-no_toolchain/powerpc.powerpc64/usr/src/powerpc.powerpc64/stand/powerpc/boot1.chrp/boot1.elf.meta' .MAKE.LEVEL='5' MAKEFILE='' .MAKE.MODE='meta missing-filemon=yes missing-meta=yes silent=yes verbose' _ERROR_CMD='/usr/local/bin/powerpc64-unknown-freebsd12.0-gcc --sysroot=/usr/obj/powerpc64vtsc_xtoolchain-gcc-no_toolchain/powerpc.powerpc64/usr/src/powerpc.powerpc64/tmp -B/usr/local/powerpc64-unknown-freebsd12.0/bin/ -O2 -pipe -nostdinc -I/usr/obj/powerpc64vtsc_xtoolchain-gcc-no_toolchain/powerpc.powerpc64/usr/src/powerpc.powerpc64/stand/libsa -I/usr/src/stand/libsa -D_STANDALONE -I/usr/src/sys -Ddouble=jagged-little-pill -Dfloat=floaty-mcfloatface -DLOADER_GELI_SUPPORT -I/usr/src/stand/libsa/geli -DLOADER_DISK_SUPPORT -m32 -mcpu=powerpc -ffreestanding -msoft-float -I. -I/usr/src/stand/common -std=gnu99 -Wsystem-headers -Wno-pointer-sign -Wno-error=address -Wno-error=array-bounds -Wno-error=attributes -Wno-error=bool-compare -Wno-error=cast-align -Wno-error=clobbered -Wno-error=enum-compare -Wno-error=extra -Wno-error=inline -Wno-error=logical-not-parentheses -Wno-error=strict-aliasing -Wno-error=uninitialized -Wno-error=unused-but-set-variable -Wno-error=unused-function -Wno-error= unused-value -Wno-error=misleading-indentation -Wno-error=nonnull-compare -Wno-error=shift-negative-value -Wno-error=tautological-compare -Wno-error=unused-const-variable -v -Os -nostdlib -static -Wl,-N -o boot1.elf boot1.o qdivrem.o udivdi3.o ashldi3.o syncicache.o ;' .CURDIR='/usr/src/stand/powerpc/boot1.chrp' .MAKE='make' .OBJDIR='/usr/obj/powerpc64vtsc_xtoolchain-gcc-no_toolchain/powerpc.powerpc64/usr/src/powerpc.powerpc64/stand/powerpc/boot1.chrp' .TARGETS='all' DESTDIR='/usr/obj/powerpc64vtsc_xtoolchain-gcc-no_toolchain/powerpc.powerpc64/usr/src/powerpc.powerpc64/tmp' LD_LIBRARY_PATH='' MACHINE='powerpc' MACHINE_ARCH='powerpc64' MAKEOBJDIRPREFIX='' MAKESYSPATH='/usr/src/share/mk' MAKE_VERSION='20180512' PATH='/usr/obj/powerpc64vtsc_xtoolchain-gcc-no_toolchain/powerpc.powerpc64/usr/src/powerpc.powerpc64/tmp/legacy/usr/sbin:/usr/obj/powerpc64vtsc_xtoolchain-gcc-no_toolchain/powerpc.powerpc64/usr/src/powerpc.powerpc64/tmp/legacy/usr/bin:/usr/obj/powerpc64vtsc_xtoolchain-gcc-no_toolchain/powerpc.powerpc64/usr/src/powerpc.powerpc64/tmp/legacy/bin:/usr/obj/powerpc64vtsc_xtoolchain-gcc-no_toolchain/powerpc.powerpc64/usr/src/powerpc.powerpc64/tmp/usr/sbin:/usr/obj/powerpc64vtsc_xtoolchain-gcc-no_toolchain/powerpc.powerpc64/usr/src/powerpc.powerpc64/tmp/usr/bin:/sbin:/bin:/usr/sbin:/usr/bin' SRCTOP='/usr/src' OBJTOP='/usr/obj/powerpc64vtsc_xtoolchain-gcc-no_toolchain/powerpc.powerpc64/usr/src/powerpc.powerpc64' .MAKE.MAKEFILES='/usr/src/share/mk/sys.mk /usr/src/share/mk/local.sys.env.mk /usr/src/share/mk/src.sys.env.mk /root/src.configs/src.conf.powerpc64-xtoolchain-gcc-no_toolchain.amd64-host /usr/src/share/mk/bsd.mkopt.mk /usr/src/share/mk/src.sys.obj.mk /usr/src/share/mk/auto.obj.mk /usr/src/share/mk/bsd.suffixes.mk /root/src.configs/make.conf /usr/src/share/mk/local.sys.mk /usr/src/share/mk/src.sys.mk /dev/null /usr/src/stand/powerpc/boot1.chrp/Makefile /usr/src/share/mk/bsd.init.mk /usr/src/share/mk/bsd.opts.mk /usr/src/share/mk/bsd.cpu.mk /usr/src/share/mk/local.init.mk /usr/src/share/mk/src.init.mk /usr/src/stand/powerpc/boot1.chrp/../Makefile.inc /usr/src/stand/powerpc/boot1.chrp/../../Makefile.inc /usr/src/stand/powerpc/boot1.chrp/../../defs.mk /usr/src/share/mk/src.opts.mk /usr/src/share/mk/bsd.own.mk /usr/src/share/mk/bsd.compiler.mk /usr/src/share/mk/bsd.linker.mk /usr/src/stand/powerpc/boot1.chrp/Makefile.hfs /usr/src/share/mk/bsd.prog.mk /usr/src/share/mk/bsd.libnames.mk /usr/ src/share/mk/src.libnames.mk /usr/src/share/mk/bsd.nls.mk /usr/src/share/mk/bsd.confs.mk /usr/src/share/mk/bsd.files.mk /usr/src/share/mk/bsd.dirs.mk /usr/src/share/mk/bsd.incs.mk /usr/src/share/mk/bsd.links.mk /usr/src/share/mk/bsd.man.mk /usr/src/share/mk/bsd.dep.mk /usr/src/share/mk/bsd.clang-analyze.mk /usr/src/share/mk/bsd.obj.mk /usr/src/share/mk/bsd.subdir.mk /usr/src/share/mk/bsd.sys.mk' .PATH='. /usr/src/stand/powerpc/boot1.chrp /usr/src/sys/libkern /usr/src/lib/libc/powerpc/gen /usr/src/stand/powerpc/boot1.chrp' 1 error The following patch was sufficient to show that the -Os use made the difference (but I do not know about other TARGET_ARCH= alternatives so it may not be appropriate overall). # svnlite diff /usr/src/stand/defs.mk Index: /usr/src/stand/defs.mk =================================================================== --- /usr/src/stand/defs.mk (revision 338319) +++ /usr/src/stand/defs.mk (working copy) @@ -53,6 +53,7 @@ CFLAGS+= -I${SYSDIR} # Spike the floating point interfaces CFLAGS+= -Ddouble=jagged-little-pill -Dfloat=floaty-mcfloatface +.if ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "i386" # Slim down the image. This saves about 15% in size with clang 6 on x86 # Our most constrained /boot/loader env is BIOS booting on x86, where # our text + data + BTX have to fit into 640k below the ISA hole. @@ -59,6 +60,7 @@ # Experience has shown that problems arise between ~520k to ~530k. CFLAGS.clang+= -Oz CFLAGS.gcc+= -Os +.endif # GELI Support, with backward compat hooks (mostly) .if defined(LOADER_NO_GELI_SUPPORT) @@ -87,6 +89,7 @@ # or powerpc64. .if ${MACHINE_ARCH} == "powerpc64" CFLAGS+= -m32 -mcpu=powerpc +LFLAGS+= -Wl,-m -Wl,elf32ppc_fbsd .endif # For amd64, there's a bit of mixed bag. Some of the tree (i386, lib*32) is Note: The "LFLAGS+= -Wl,-m -Wl,elf32ppc_fbsd" is a long-standing item in my powerpc64 experimental environment and is not the point here. For reference: # more ~/src.configs/src.conf.powerpc64-xtoolchain-gcc-no_toolchain.amd64-host TO_TYPE=powerpc64 TOOLS_TO_TYPE=${TO_TYPE} VERSION_CONTEXT=12.0 # KERNCONF=GENERIC64vtsc-NODBG TARGET=powerpc .if ${.MAKE.LEVEL} == 0 TARGET_ARCH=${TO_TYPE} .export TARGET_ARCH .endif # WITHOUT_CROSS_COMPILER= WITHOUT_SYSTEM_COMPILER= WITHOUT_SYSTEM_LINKER= # WITH_LIBCPLUSPLUS= WITHOUT_LLD_BOOTSTRAP= WITHOUT_BINUTILS_BOOTSTRAP= WITHOUT_ELFTOOLCHAIN_BOOTSTRAP= WITHOUT_CLANG_BOOTSTRAP= WITHOUT_CLANG_IS_CC= WITHOUT_CLANG= WITHOUT_CLANG_FULL= WITHOUT_CLANG_EXTRAS= WITHOUT_LLD= WITHOUT_BINUTILS= WITHOUT_LLDB= # WITH_BOOT= # powerpc64 LIB32 builds via gcc 4.9 or later variants that I've tried # but the LIB32 does not work [crtbeginS code problem(s): bad R30 use] #WITHOUT_LIB32= WITH_LIB32= # WITHOUT_GCC_BOOTSTRAP= WITHOUT_GCC= WITHOUT_GCC_IS_CC= WITHOUT_GNUCXX= # NO_WERROR= # # Avoid db_trace.o getting: # calling '__builtin_frame_address' with a nonzero argument is unsafe # as an error? Other such points as well. #WERROR= MALLOC_PRODUCTION= # WITH_REPRODUCIBLE_BUILD= WITH_DEBUG_FILES= # # # For TO (so-called "cross") stages . . . # So-called-cross via ${TO_TYPE}-xtoolchain-gcc/${TO_TYPE}-gcc. . . # TOOLS_TO_TYPE based on ${TO_TYPE}-xtoolchain-gcc related binutils. . . # CROSS_TOOLCHAIN=${TO_TYPE}-gcc X_COMPILER_TYPE=gcc CROSS_BINUTILS_PREFIX=/usr/local/${TOOLS_TO_TYPE}-unknown-freebsd${VERSION_CONTEXT}/bin/ .if ${.MAKE.LEVEL} == 0 XCC=/usr/local/bin/${TOOLS_TO_TYPE}-unknown-freebsd${VERSION_CONTEXT}-gcc XCXX=/usr/local/bin/${TOOLS_TO_TYPE}-unknown-freebsd${VERSION_CONTEXT}-g++ XCPP=/usr/local/bin/${TOOLS_TO_TYPE}-unknown-freebsd${VERSION_CONTEXT}-cpp .export XCC .export XCXX .export XCPP XAS=/usr/local/${TOOLS_TO_TYPE}-unknown-freebsd${VERSION_CONTEXT}/bin/as XAR=/usr/local/${TOOLS_TO_TYPE}-unknown-freebsd${VERSION_CONTEXT}/bin/ar XLD=/usr/local/${TOOLS_TO_TYPE}-unknown-freebsd${VERSION_CONTEXT}/bin/ld XNM=/usr/local/${TOOLS_TO_TYPE}-unknown-freebsd${VERSION_CONTEXT}/bin/nm XOBJCOPY=/usr/local/${TOOLS_TO_TYPE}-unknown-freebsd${VERSION_CONTEXT}/bin/objcopy XOBJDUMP=/usr/local/${TOOLS_TO_TYPE}-unknown-freebsd${VERSION_CONTEXT}/bin/objdump XRANLIB=/usr/local/${TOOLS_TO_TYPE}-unknown-freebsd${VERSION_CONTEXT}/bin/ranlib XSIZE=/usr/local/${TOOLS_TO_TYPE}-unknown-freebsd${VERSION_CONTEXT}/bin/size #NO-SUCH: XSTRINGS=/usr/local/${TOOLS_TO_TYPE}-unknown-freebsd${VERSION_CONTEXT}/bin/strings XSTRINGS=/usr/local/bin/${TOOLS_TO_TYPE}-unknown-freebsd${VERSION_CONTEXT}-strings .export XAS .export XAR .export XLD .export XNM .export XOBJCOPY .export XOBJDUMP .export XRANLIB .export XSIZE .export XSTRINGS .endif # # # From based on clang (via system). . . # .if ${.MAKE.LEVEL} == 0 CC=/usr/bin/clang CXX=/usr/bin/clang++ CPP=/usr/bin/clang-cpp .export CC .export CXX .export CPP .endif === Mark Millard marklmi at yahoo.com ( dsl-only.net went away in early 2018-Mar) _______________________________________________ freebsd-toolchain@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/freebsd-toolchain To unsubscribe, send any mail to "freebsd-toolchain-unsubscr...@freebsd.org"