-r319936 and -r319991 TARGET_ARCH=powerpc via clang: boot1.chrp/boot1.c:(.text+0x14b8): undefined reference to `__udivdi3' (boot1.o: In function `fsread_size')

Mark Millard markmi at dsl-only.net
Fri Jun 16 04:35:01 UTC 2017


[I should have listed more about my build context for clang.]

On 2017-Jun-15, at 9:20 PM, Mark Millard <markmi at dsl-only.net> wrote:

> [A gcc 4.2.1 based buildworld buildkernel did not have this problem.]
> 
> On 2017-Jun-15, at 5:34 PM, Mark Millard <markmi at dsl-only.net> wrote:
> 
>> Context: amd64 -> powerpc cross build of -r319936
>> (one of my usual clang-based experiments):
>> 
>> --- all_subdir_sys ---
>> Building /usr/obj/powerpcvtsc_clang/powerpc.powerpc/usr/src/sys/boot/powerpc/boot1.chrp/boot1.elf
>> --- boot1.elf ---
>> boot1.o: In function `fsread_size':
>> /usr/src/sys/boot/powerpc/boot1.chrp/boot1.c:(.text+0x14b8): undefined reference to `__udivdi3'
>> /usr/src/sys/boot/powerpc/boot1.chrp/boot1.c:(.text+0x1508): undefined reference to `__udivdi3'
>> cc: error: linker command failed with exit code 1 (use -v to see invocation)
>> --- all_subdir_lib ---
>> Building /usr/obj/powerpcvtsc_clang/powerpc.powerpc/usr/src/lib/msun/s_remquo.po
>> --- all_subdir_sys ---
>> *** [boot1.elf] Error code 1
>> 
>> make[6]: stopped in /usr/src/sys/boot/powerpc/boot1.chrp
>> .ERROR_TARGET='boot1.elf'
>> .ERROR_META_FILE='/usr/obj/powerpcvtsc_clang/powerpc.powerpc/usr/src/sys/boot/powerpc/boot1.chrp/boot1.elf.meta'
>> 
>> 
>> # Meta data file /usr/obj/powerpcvtsc_clang/powerpc.powerpc/usr/src/sys/boot/powerpc/boot1.chrp/boot1.elf.meta
>> CMD cc -target powerpc-unknown-freebsd12.0 --sysroot=/usr/obj/powerpcvtsc_clang/powerpc.powerpc/usr/src/tmp -B/usr/obj/powerpcvtsc_clang/powerpc.powerpc/usr/src/tmp/usr/bin -ffreestanding -msoft-float -I/usr/src/sys/boot/powerpc/boot1.chrp/../../common -I/usr/src/sys/boot/powerpc/boot1.chrp/../../../ -D_STANDALONE -std=gnu99 -Qunused-arguments -nostdlib -static -Wl,-N -o boot1.elf boot1.o ashldi3.o syncicache.o  
>> CWD /usr/obj/powerpcvtsc_clang/powerpc.powerpc/usr/src/sys/boot/powerpc/boot1.chrp
>> TARGET boot1.elf
>> -- command output --
>> boot1.o: In function `fsread_size':
>> /usr/src/sys/boot/powerpc/boot1.chrp/boot1.c:(.text+0x14b8): undefined reference to `__udivdi3'
>> /usr/src/sys/boot/powerpc/boot1.chrp/boot1.c:(.text+0x1508): undefined reference to `__udivdi3'
>> cc: error: linker command failed with exit code 1 (use -v to see invocation)
>> *** Error code 1
>> 
>> Note: This was -j16 for the build.
>> 
>> I updated /usr/src and amd64 to -r319991 and then
>> retried cross building for powerpc: same result.
>> 
>> 
>> Note: I'd frozen at -r317820 until this update. Back then
>> I could buildworld and buildkernel via clang (although
>> I could not boot the clang-based kernel and so had to
>> build a gcc 4.2.1 based one and use it).
> 
> I tried a gcc 4.2.1 buildworld buildkernel and it
> completed fine.
> 
> The __udivdi3 problem is clang toolchain specific.

Clang based build-context details:

# more ~/sys_build_scripts.amd64-host/make_powerpcvtsc_nodebug_clang_bootstrap-amd64-host.sh 
kldload -n filemon && \
script ~/sys_typescripts/typescript_make_powerpcvtsc_nodebug_clang_bootstrap-amd64-host-$(date +%Y-%m-%d:%H:%M:%S) \
env __MAKE_CONF="/root/src.configs/make.conf" SRCCONF="/dev/null" SRC_ENV_CONF="/root/src.configs/src.conf.powerpc-clang-bootstrap.amd64-host" \
WITH_META_MODE=yes \
MAKEOBJDIRPREFIX="/usr/obj/powerpcvtsc_clang" \
make $*

# more /root/src.configs/src.conf.powerpc-clang-bootstrap.amd64-host
TO_TYPE=powerpc
#
KERNCONF=GENERICvtsc-NODBG
TARGET=${TO_TYPE}
.if ${.MAKE.LEVEL} == 0
TARGET_ARCH=${TO_TYPE}
.export TARGET_ARCH
.endif
#
WITH_CROSS_COMPILER=
WITHOUT_SYSTEM_COMPILER=
#
WITH_LIBCPLUSPLUS=
WITH_BINUTILS_BOOTSTRAP=
WITH_ELFTOOLCHAIN_BOOTSTRAP=
WITH_CLANG_BOOTSTRAP=
WITH_CLANG=
WITH_CLANG_IS_CC=
WITH_CLANG_FULL=
WITH_CLANG_EXTRAS=
WITH_LLD=
# lldb requires missing atomic 8-byte operations for powerpc (non-64)
WITHOUT_LLDB=
#
WITH_BOOT=
WITHOUT_LIB32=
#
WITHOUT_GCC_BOOTSTRAP=
WITHOUT_GCC=
WITHOUT_GCC_IS_CC=
WITHOUT_GNUCXX=
#
NO_WERROR=
#
# Use WERROR to avoid stopping at the likes of:
# error: implicit conversion from 'int' to 'int8_t' (aka 'signed char') changes value from 128 to -128 [-Werror,-Wconstant-conversion]
WERROR=
MALLOC_PRODUCTION=
#
WITH_REPRODUCIBLE_BUILD=
WITH_DEBUG_FILES=

So the system binutils tools are in used.

Even though I build lld, last I tried lld could not
be used so it is not the linker used by the above.


===
Mark Millard
markmi at dsl-only.net




More information about the freebsd-ppc mailing list