Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 16 Jun 2017 13:18:47 -0700
From:      Mark Millard <markmi@dsl-only.net>
To:        FreeBSD Toolchain <freebsd-toolchain@freebsd.org>, FreeBSD PowerPC ML <freebsd-ppc@freebsd.org>, FreeBSD Current <freebsd-current@freebsd.org>
Subject:   Re: -r319936 and -r319991 TARGET_ARCH=powerpc via clang: boot1.chrp/boot1.c:(.text+0x14b8): undefined reference to `__udivdi3' (boot1.o: In function `fsread_size') [powerpc64 too]
Message-ID:  <87444191-89F0-4679-B412-1184E229FEB9@dsl-only.net>
In-Reply-To: <732C2D2B-1533-469F-9683-A732BDE84490@dsl-only.net>
References:  <D1A5D702-7C77-4288-93E2-3C41A6F5417F@dsl-only.net> <E39EEE8E-29B0-4F32-8A07-3C11FA728DF0@dsl-only.net> <23CFE929-1A90-430E-A3E6-C9B56F642F8D@dsl-only.net> <732C2D2B-1533-469F-9683-A732BDE84490@dsl-only.net>

next in thread | previous in thread | raw e-mail | index | archive | help
[Top posted note: I have submitted bugzilla 220024 for this
powerpc64 and powerpc issue. It has also been reproduced
when using /usr/local/powerpc64-freebsd/bin/ for binutils
for a powerpc64 buildworld attempt.]

On 2017-Jun-15, at 11:32 PM, Mark Millard <markmi at dsl-only.net> =
wrote:

[powerpc64 has the same problem.]

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

> [I should have listed more about my build context for clang.]
>=20
> On 2017-Jun-15, at 9:20 PM, Mark Millard <markmi at dsl-only.net> =
wrote:
>=20
>> [A gcc 4.2.1 based buildworld buildkernel did not have this problem.]
>>=20
>> On 2017-Jun-15, at 5:34 PM, Mark Millard <markmi at dsl-only.net> =
wrote:
>>=20
>>> Context: amd64 -> powerpc cross build of -r319936
>>> (one of my usual clang-based experiments):
>>>=20
>>> --- 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
>>>=20
>>> make[6]: stopped in /usr/src/sys/boot/powerpc/boot1.chrp
>>> .ERROR_TARGET=3D'boot1.elf'
>>> =
.ERROR_META_FILE=3D'/usr/obj/powerpcvtsc_clang/powerpc.powerpc/usr/src/sys=
/boot/powerpc/boot1.chrp/boot1.elf.meta'
>>>=20
>>>=20
>>> # 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=3D/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=3Dgnu99 -Qunused-arguments -nostdlib -static -Wl,-N -o boot1.elf =
boot1.o ashldi3.o syncicache.o =20
>>> 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
>>>=20
>>> Note: This was -j16 for the build.
>>>=20
>>> I updated /usr/src and amd64 to -r319991 and then
>>> retried cross building for powerpc: same result.
>>>=20
>>>=20
>>> 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).
>>=20
>> I tried a gcc 4.2.1 buildworld buildkernel and it
>> completed fine.
>>=20
>> The __udivdi3 problem is clang toolchain specific.
>=20
> Clang based build-context details:
>=20
> # more =
~/sys_build_scripts.amd64-host/make_powerpcvtsc_nodebug_clang_bootstrap-am=
d64-host.sh=20
> kldload -n filemon && \
> script =
~/sys_typescripts/typescript_make_powerpcvtsc_nodebug_clang_bootstrap-amd6=
4-host-$(date +%Y-%m-%d:%H:%M:%S) \
> env __MAKE_CONF=3D"/root/src.configs/make.conf" SRCCONF=3D"/dev/null" =
SRC_ENV_CONF=3D"/root/src.configs/src.conf.powerpc-clang-bootstrap.amd64-h=
ost" \
> WITH_META_MODE=3Dyes \
> MAKEOBJDIRPREFIX=3D"/usr/obj/powerpcvtsc_clang" \
> make $*
>=20
> # more /root/src.configs/src.conf.powerpc-clang-bootstrap.amd64-host
> TO_TYPE=3Dpowerpc
> #
> KERNCONF=3DGENERICvtsc-NODBG
> TARGET=3D${TO_TYPE}
> .if ${.MAKE.LEVEL} =3D=3D 0
> TARGET_ARCH=3D${TO_TYPE}
> .export TARGET_ARCH
> .endif
> #
> WITH_CROSS_COMPILER=3D
> WITHOUT_SYSTEM_COMPILER=3D
> #
> WITH_LIBCPLUSPLUS=3D
> WITH_BINUTILS_BOOTSTRAP=3D
> WITH_ELFTOOLCHAIN_BOOTSTRAP=3D
> WITH_CLANG_BOOTSTRAP=3D
> WITH_CLANG=3D
> WITH_CLANG_IS_CC=3D
> WITH_CLANG_FULL=3D
> WITH_CLANG_EXTRAS=3D
> WITH_LLD=3D
> # lldb requires missing atomic 8-byte operations for powerpc (non-64)
> WITHOUT_LLDB=3D
> #
> WITH_BOOT=3D
> WITHOUT_LIB32=3D
> #
> WITHOUT_GCC_BOOTSTRAP=3D
> WITHOUT_GCC=3D
> WITHOUT_GCC_IS_CC=3D
> WITHOUT_GNUCXX=3D
> #
> NO_WERROR=3D
> #
> # 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=3D
> MALLOC_PRODUCTION=3D
> #
> WITH_REPRODUCIBLE_BUILD=3D
> WITH_DEBUG_FILES=3D
>=20
> So the system binutils tools are in used.
>=20
> Even though I build lld, last I tried lld could not
> be used so it is not the linker used by the above.

powerpc64 has the same buildworld problem for
clang based builds:

--- 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_usr.sbin ---
Building =
/usr/obj/powerpc64vtsc_clang/powerpc.powerpc64/usr/src/usr.sbin/fstyp/ext2=
fs.o
--- all_subdir_sys ---
*** [boot1.elf] Error code 1

make[6]: stopped in /usr/src/sys/boot/powerpc/boot1.chrp
.ERROR_TARGET=3D'boot1.elf'
=
.ERROR_META_FILE=3D'/usr/obj/powerpc64vtsc_clang/powerpc.powerpc64/usr/src=
/sys/boot/powerpc/boot1.chrp/boot1.elf.meta'


# more =
/usr/obj/powerpc64vtsc_clang/powerpc.powerpc64/usr/src/sys/boot/powerpc/bo=
ot1.chrp/boot1.elf.meta
# Meta data file =
/usr/obj/powerpc64vtsc_clang/powerpc.powerpc64/usr/src/sys/boot/powerpc/bo=
ot1.chrp/boot1.elf.meta
CMD cc -target powerpc64-unknown-freebsd12.0 =
--sysroot=3D/usr/obj/powerpc64vtsc_clang/powerpc.powerpc64/usr/src/tmp =
-B/usr/obj/powerpc64vtsc_clang/powerpc.powerpc64/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 -m32 =
-mcpu=3Dpowerpc -m32 -mcpu=3Dpowerpc -std=3Dgnu99 -Qunused-arguments =
-nostdlib -static -Wl,-N -Wl,-m -Wl,elf32ppc_fbsd -Wl,-m =
-Wl,elf32ppc_fbsd -o boot1.elf boot1.o ashldi3.o syncicache.o =20
CWD =
/usr/obj/powerpc64vtsc_clang/powerpc.powerpc64/usr/src/sys/boot/powerpc/bo=
ot1.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


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

# more /root/src.configs/src.conf.powerpc64-clang-bootstrap.amd64-host
TO_TYPE=3Dpowerpc64
#
KERNCONF=3DGENERIC64vtsc-NODBG
TARGET=3Dpowerpc
.if ${.MAKE.LEVEL} =3D=3D 0
TARGET_ARCH=3D${TO_TYPE}
.export TARGET_ARCH
.endif
#
WITH_CROSS_COMPILER=3D
WITHOUT_SYSTEM_COMPILER=3D
#
WITH_LIBCPLUSPLUS=3D
WITH_BINUTILS_BOOTSTRAP=3D
WITH_ELFTOOLCHAIN_BOOTSTRAP=3D
WITH_CLANG_BOOTSTRAP=3D
WITH_CLANG=3D
WITH_CLANG_IS_CC=3D
WITH_CLANG_FULL=3D
WITH_CLANG_EXTRAS=3D
WITH_LLD=3D
WITH_LLDB=3D
#
WITH_BOOT=3D
WITH_LIB32=3D
#
WITHOUT_GCC_BOOTSTRAP=3D
WITHOUT_GCC=3D
WITHOUT_GCC_IS_CC=3D
WITHOUT_GNUCXX=3D
#
NO_WERROR=3D
# buildkernel fails for sign mismatch on pointed-to types.
WERROR=3D
MALLOC_PRODUCTION=3D
#
WITH_REPRODUCIBLE_BUILD=3D
WITH_DEBUG_FILES=3D


=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?87444191-89F0-4679-B412-1184E229FEB9>