Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 27 Nov 2016 19:01:32 -0800
From:      Mark Millard <markmi@dsl-only.net>
To:        FreeBSD Toolchain <freebsd-toolchain@freebsd.org>, FreeBSD PowerPC ML <freebsd-ppc@freebsd.org>
Cc:        Justin Hibbits <chmeeedalf@gmail.com>, Nathan Whitehorn <nwhitehorn@freebsd.org>
Subject:   head -r309179 clang 3.9.0 for TARGET_ARCH=powerpc64 with devel/powerpc64-binutils used: WITH_LIB32= related assembler source rejected. . .
Message-ID:  <B85CFD5B-FF80-4A05-949D-0922CB05E053@dsl-only.net>

next in thread | raw e-mail | index | archive | help
[Note: ld from WITH_BINTOOLS_BOOTSTRAP=3D for buildworld fails and stops
buildworld. This explains the use of devel/powerpc64-binutils below.]

Using clang 3.9.0 for TARGET_ARCH=3Dpowerpc64 with
devel/powerpc64-binutils (of an appropriate vintage) apparently
requires r1 instead of 1 for a register name --and so on.

It turns out that trying to use WITH_LIB32=3D for TARGET_ARCH=3Dpowerpc64
with devel/powerpc64-binutils runs into assembler source files that
are rejected for this reason.

There are also complaints about invalid mnemonics (mflr and mr).

The error reports:
(Other files may well have the same sorts of problems.)

> --- lib/csu__L ---
> Building =
/usr/obj/powerpc64vtsc_clang_altbinutils_world/powerpc.powerpc64/usr/src/w=
orld32/usr/src/lib/csu/powerpc/crti.o
> . . .
> --- crti.o ---
> /usr/src/lib/csu/powerpc/crti.S:34:13: error: unexpected token in =
memory operand
>  stwu 1,-16(1)
>             ^
> /usr/src/lib/csu/powerpc/crti.S:35:2: error: invalid instruction =
mnemonic 'mflr'
>  mflr 0
>  ^
> /usr/src/lib/csu/powerpc/crti.S:36:12: error: unexpected token in =
memory operand
>  stw 31,12(1)
>            ^
> /usr/src/lib/csu/powerpc/crti.S:37:11: error: unexpected token in =
memory operand
>  stw 0,20(1)
>           ^
> /usr/src/lib/csu/powerpc/crti.S:38:2: error: invalid instruction =
mnemonic 'mr'
>  mr 31,1
>  ^
> /usr/src/lib/csu/powerpc/crti.S:45:13: error: unexpected token in =
memory operand
>  stwu 1,-16(1)
>             ^
> /usr/src/lib/csu/powerpc/crti.S:46:2: error: invalid instruction =
mnemonic 'mflr'
>  mflr 0
>  ^
> /usr/src/lib/csu/powerpc/crti.S:47:12: error: unexpected token in =
memory operand
>  stw 31,12(1)
>            ^
> /usr/src/lib/csu/powerpc/crti.S:48:11: error: unexpected token in =
memory operand
>  stw 0,20(1)
>           ^
> /usr/src/lib/csu/powerpc/crti.S:49:2: error: invalid instruction =
mnemonic 'mr'
>  mr 31,1
>  ^
> *** [crti.o] Error code 1
>=20
> make[5]: stopped in /usr/src/lib/csu/powerpc
> .ERROR_TARGET=3D'crti.o'
> =
.ERROR_META_FILE=3D'/usr/obj/powerpc64vtsc_clang_altbinutils_world/powerpc=
.powerpc64/usr/src/world32/usr/src/lib/csu/powerpc/crti.o.meta'
> .MAKE.LEVEL=3D'5'
> MAKEFILE=3D''
> .MAKE.MODE=3D'meta missing-filemon=3Dyes missing-meta=3Dyes silent=3Dyes=
 verbose'
> .CURDIR=3D'/usr/src/lib/csu/powerpc'
> .MAKE=3D'make'
> =
.OBJDIR=3D'/usr/obj/powerpc64vtsc_clang_altbinutils_world/powerpc.powerpc6=
4/usr/src/world32/usr/src/lib/csu/powerpc'
> .TARGETS=3D'all'
> =
DESTDIR=3D'/usr/obj/powerpc64vtsc_clang_altbinutils_world/powerpc.powerpc6=
4/usr/src/lib32'
> LD_LIBRARY_PATH=3D''
> MACHINE=3D'powerpc'
> MACHINE_ARCH=3D'powerpc'
> =
MAKEOBJDIRPREFIX=3D'/usr/obj/powerpc64vtsc_clang_altbinutils_world/powerpc=
.powerpc64/usr/src/world32'
> MAKESYSPATH=3D'/usr/src/share/mk'
> MAKE_VERSION=3D'20160818'
> =
PATH=3D'/usr/obj/powerpc64vtsc_clang_altbinutils_world/powerpc.powerpc64/u=
sr/src/tmp/legacy/usr/sbin:/usr/obj/powerpc64vtsc_clang_altbinutils_world/=
powerpc.powerpc64/usr/src/tmp/legacy/usr/bin:/usr/obj/powerpc64vtsc_clang_=
altbinutils_world/powerpc.powerpc64/usr/src/tmp/legacy/bin:/usr/obj/powerp=
c64vtsc_clang_altbinutils_world/powerpc.powerpc64/usr/src/tmp/usr/sbin:/us=
r/obj/powerpc64vtsc_clang_altbinutils_world/powerpc.powerpc64/usr/src/tmp/=
usr/bin:/sbin:/bin:/usr/sbin:/usr/bin'
> SRCTOP=3D'/usr/src'
> =
OBJTOP=3D'/usr/obj/powerpc64vtsc_clang_altbinutils_world/powerpc.powerpc64=
/usr/src/world32/usr/src'
> .MAKE.MAKEFILES=3D'/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-clang_altbinutils-bootstrap.amd64-hos=
t /usr/src/share/mk/bsd.mkopt.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/lib/csu/powerpc/Makefile =
/usr/src/share/mk/bsd.lib.mk /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/lib/csu/powerpc/../Makefile.inc =
/usr/src/lib/csu/powerpc/../../Makefile.inc /usr/src/share/mk/bsd.own.mk =
/usr/src/share/mk/bsd.compiler.mk /usr/src/share/mk/bsd.libnames.mk =
/usr/src/share/mk/src.libnames.mk /usr/src/share/mk/src.opts.mk =
/usr/src/share/mk/bsd.symver.mk /usr/src/share/mk/bsd.nls.mk =
/usr/src/share/mk/bsd.files.mk /usr/src/share/mk/bsd.incs.mk =
/usr/src/share/mk/bsd.confs.mk /usr/src/share/mk/bsd.links.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=3D'. /usr/src/lib/csu/powerpc =
/usr/src/lib/csu/powerpc/../common'
> --- lib/libc_nonshared__L ---
> Building =
/usr/obj/powerpc64vtsc_clang_altbinutils_world/powerpc.powerpc64/usr/src/w=
orld32/usr/src/lib/libc_nonshared/iconv.o
> --- lib/csu__L ---
> 1 error


The .meta report:

> # more =
/usr/obj/powerpc64vtsc_clang_altbinutils_world/powerpc.powerpc64/usr/src/w=
orld32/usr/src/lib/csu/powerpc/crti.o.meta
> # Meta data file =
/usr/obj/powerpc64vtsc_clang_altbinutils_world/powerpc.powerpc64/usr/src/w=
orld32/usr/src/lib/csu/powerpc/crti.o.meta
> CMD /usr/bin/clang -m32 -DCOMPAT_32BIT -mcpu=3Dpowerpc =
-L/usr/obj/powerpc64vtsc_clang_altbinutils_world/powerpc.powerpc64/usr/src=
/lib32/usr/lib32 =
--sysroot=3D/usr/obj/powerpc64vtsc_clang_altbinutils_world/powerpc.powerpc=
64/usr/src/lib32 -B/usr/local/powerpc64-freebsd/bin/ =
-B/usr/obj/powerpc64vtsc_clang_altbinutils_world/powerpc.powerpc64/usr/src=
/lib32/usr/lib32 -O2 -pipe -I/usr/src/lib/csu/powerpc/../common  =
-I/usr/src/lib/csu/powerpc/../../libc/include  -std=3Dgnu99  =
-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  -Qunused-arguments    -c =
/usr/src/lib/csu/powerpc/crti.S -o crti.o
> CMD=20
> CWD =
/usr/obj/powerpc64vtsc_clang_altbinutils_world/powerpc.powerpc64/usr/src/w=
orld32/usr/src/lib/csu/powerpc
> TARGET crti.o
> -- command output --
> /usr/src/lib/csu/powerpc/crti.S:34:13: error: unexpected token in =
memory operand
>  stwu 1,-16(1)
>             ^
> /usr/src/lib/csu/powerpc/crti.S:35:2: error: invalid instruction =
mnemonic 'mflr'
>  mflr 0
>  ^
> /usr/src/lib/csu/powerpc/crti.S:36:12: error: unexpected token in =
memory operand
>  stw 31,12(1)
>            ^
> /usr/src/lib/csu/powerpc/crti.S:37:11: error: unexpected token in =
memory operand
>  stw 0,20(1)
>           ^
> /usr/src/lib/csu/powerpc/crti.S:38:2: error: invalid instruction =
mnemonic 'mr'
>  mr 31,1
>  ^
> /usr/src/lib/csu/powerpc/crti.S:45:13: error: unexpected token in =
memory operand
>  stwu 1,-16(1)
>             ^
> /usr/src/lib/csu/powerpc/crti.S:46:2: error: invalid instruction =
mnemonic 'mflr'
>  mflr 0
>  ^
> /usr/src/lib/csu/powerpc/crti.S:47:12: error: unexpected token in =
memory operand
>  stw 31,12(1)
>            ^
> /usr/src/lib/csu/powerpc/crti.S:48:11: error: unexpected token in =
memory operand
>  stw 0,20(1)
>           ^
> /usr/src/lib/csu/powerpc/crti.S:49:2: error: invalid instruction =
mnemonic 'mr'
>  mr 31,1
>  ^
> *** Error code 1
>=20
> -- filemon acquired metadata --
. . .


Supporting details:

> # more =
~/src.configs/src.conf.powerpc64-clang_altbinutils-bootstrap.amd64-host=20=

> TO_TYPE=3Dpowerpc64
> TOOLS_TO_TYPE=3D${TO_TYPE}
> VERSION_CONTEXT=3D12.0
> #
> 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
> WITHOUT_BINUTILS_BOOTSTRAP=3D
> WITH_CLANG_BOOTSTRAP=3D
> WITH_CLANG=3D
> WITH_CLANG_IS_CC=3D
> WITH_CLANG_FULL=3D
> WITH_CLANG_EXTRAS=3D
> WITH_LLDB=3D
> #
> WITH_BOOT=3D
> WITH_LIB32=3D
> #
> WITHOUT_ELFTOOLCHAIN_BOOTSTRAP=3D
> WITHOUT_GCC_BOOTSTRAP=3D
> WITHOUT_GCC=3D
> WITHOUT_GCC_IS_CC=3D
> WITHOUT_GNUCXX=3D
> #
> NO_WERROR=3D
> #WERROR=3D
> MALLOC_PRODUCTION=3D
> #
> WITH_DEBUG_FILES=3D
> #
> #
> # 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_BINUTILS_PREFIX=3D/usr/local/${TOOLS_TO_TYPE}-freebsd/bin/
> .if ${.MAKE.LEVEL} =3D=3D 0
> XAS=3D/usr/local/${TOOLS_TO_TYPE}-freebsd/bin/as
> XAR=3D/usr/local/${TOOLS_TO_TYPE}-freebsd/bin/ar
> XLD=3D/usr/local/${TOOLS_TO_TYPE}-freebsd/bin/ld
> XNM=3D/usr/local/${TOOLS_TO_TYPE}-freebsd/bin/nm
> XOBJCOPY=3D/usr/local/${TOOLS_TO_TYPE}-freebsd/bin/objcopy
> XOBJDUMP=3D/usr/local/${TOOLS_TO_TYPE}-freebsd/bin/objdump
> XRANLIB=3D/usr/local/${TOOLS_TO_TYPE}-freebsd/bin/ranlib
> XSIZE=3D/usr/local/${TOOLS_TO_TYPE}-freebsd/bin/size
> #NO-SUCH: XSTRINGS=3D/usr/local/${TOOLS_TO_TYPE}-freebsd/bin/strings
> XSTRINGS=3D/usr/local/bin/${TOOLS_TO_TYPE}-freebsd-strings
> .export XAS
> .export XAR
> .export XLD
> .export XNM
> .export XOBJCOPY
> .export XOBJDUMP
> .export XRANLIB
> .export XSIZE
> .export XSTRINGS
> .endif
> #
> #
> # =46rom based on clang (via system). . .
> #
> .if ${.MAKE.LEVEL} =3D=3D 0
> CC=3D/usr/bin/clang
> CXX=3D/usr/bin/clang++
> CPP=3D/usr/bin/clang-cpp
> .export CC
> .export CXX
> .export CPP
> .endif

head -r309179 needed a workaround to build:

> # svnlite diff /usr/src/sys/netipsec/keydb.h
> Index: /usr/src/sys/netipsec/keydb.h
> =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/sys/netipsec/keydb.h       (revision 309179)
> +++ /usr/src/sys/netipsec/keydb.h       (working copy)
> @@ -35,6 +35,7 @@
> =20
>  #ifdef _KERNEL
> =20
> +#include <sys/lock.h>
>  #include <sys/mutex.h>
> =20
>  #include <netipsec/key_var.h>

Such a change was later checked in as -r309201 .

=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?B85CFD5B-FF80-4A05-949D-0922CB05E053>