Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 18 Mar 2015 14:38:58 -0700
From:      Mark Millard <markmi@dsl-only.net>
To:        freebsd-toolchain@freebsd.org
Cc:        freebsd-ports@freebsd.org, FreeBSD PowerPC ML <freebsd-ppc@freebsd.org>
Subject:   powerpc64 11.0-CURRENT: CROSS_TOOLCHAIN=powerpc64-gcc rejects -m elf32ppc_fbsd for linking boot1.elf
Message-ID:  <122C9C88-24F9-4FA7-BCAC-293ED0DB946A@dsl-only.net>

next in thread | raw e-mail | index | archive | help
Basic context (more details given later):

> # freebsd-version -ku; uname -apKU
> 11.0-CURRENT
> 11.0-CURRENT
> FreeBSD FBSDG5C0 11.0-CURRENT FreeBSD 11.0-CURRENT #0 r279514M: Wed =
Mar 11 19:23:14 PDT 2015     =
root@FBSDG4C0:/usr/obj/powerpc.powerpc64/usr/srcC/sys/GENERIC64vtsc-NODEBU=
G  powerpc powerpc64 1100062 1100062

No clang is built or installed.



The problem:

> make -j 8 CROSS_TOOLCHAIN=3Dpowerpc64-gcc WITHOUT_CLANG_BOOTSTRAP=3D =
WITHOUT_CLANG_IS_CC=3D WITHOUT_CLANG=3D WITHOUT_CLANG_EXTRAS=3D =
WITHOUT_CLANG_FULL=3D WITHOUT_LLDB=3D WITHOUT_GCC_BOOTSTRAP=3D =
WITHOUT_GCC=3D buildworld buildkernel KERNCONF=3DGENERIC64vtsc-NODEBUG =
TARGET=3Dpowerpc TARGET_ARCH=3Dpowerpc64


processes up to:

> /usr/local/bin/powerpc64-portbld-freebsd11.0-gcc -ffreestanding =
-msoft-float -Os  -I/usr/srcC/sys/boot/powerpc/boot1.chrp/../../common =
-I/usr/srcC/sys/boot/powerpc/boot1.chrp/../../../  -D_STANDALONE=20
> -m32 -mcpu=3Dpowerpc -m32 -mcpu=3Dpowerpc -std=3Dgnu99     -nostdlib =
-static -Wl,-N -m elf32ppc_fbsd -m elf32ppc_fbsd -o boot1.elf boot1.o =
ashldi3.o syncicache.o -L/usr/obj/usr/srcC/usr/lib/libc++ -lc++

and then gets for the above command...

> powerpc64-portbld-freebsd11.0-gcc: error: elf32ppc_fbsd: No such file =
or directory
> powerpc64-portbld-freebsd11.0-gcc: error: elf32ppc_fbsd: No such file =
or directory
> powerpc64-portbld-freebsd11.0-gcc: error: unrecognized command line =
option '-m'
> powerpc64-portbld-freebsd11.0-gcc: error: unrecognized command line =
option '-m'
>=20
> *** [boot1.elf] Error code 1
>=20
> make[6]: stopped in /usr/srcC/sys/boot/powerpc/boot1.chrp
> 1 error

The -m options seems to be from the likes of...

> # $FreeBSD: head/sys/boot/powerpc/Makefile.inc 227739 2011-11-19 =
19:25:57Z andreast $
>=20
> .if ${MACHINE_ARCH} =3D=3D "powerpc64"
> CFLAGS+=3D        -m32 -mcpu=3Dpowerpc
> LDFLAGS+=3D       -m elf32ppc_fbsd
> .endif
>=20
> .include "../Makefile.inc"


and (extracted from using find ... -print):

> LDFLAGS+=3D       -m elf32ppc_fbsd
> /usr/srcC/sys/boot/ofw/Makefile.inc
> LDFLAGS+=3D       -m elf32ppc_fbsd
> /usr/srcC/sys/boot/uboot/Makefile.inc
>                LD=3D"${LD} -m elf32ppc_fbsd"

> /usr/srcC/Makefile.inc1

When I looked at "man gcc" I did not find any "-m <space> text" options =
or any -melf32ppc_fbsd option. It would suggest that "-m elf32ppc_fbsd" =
is not normally valid --matching the complaints by =
powerpc64-portbld-freebsd11.0-gcc.

Is there a FreeBSD-specific addition to gcc missing in powerpc64-gcc?



Context details:

WITHOUT_CLANG=3D (bootstrap too) is important to getting this far in my =
context. (It was in the make command shown earlier.)

# more /etc/src.conf
CC=3D/usr/local/bin/powerpc64-portbld-freebsd11.0-gcc
CXX=3D/usr/local/bin/powerpc64-portbld-freebsd11.0-g++
CPP=3D/usr/local/bin/powerpc64-portbld-freebsd11.0-cpp
CROSS_BINUTILS_PREFIX=3D/usr/local/powerpc64-freebsd/bin/
X_COMPILER_TYPE=3Dgcc
CXXFLAGS+=3D-I/usr/obj/usr/srcC/tmp/usr/include/c++/v1
LDADD+=3D-L/usr/obj/usr/srcC/usr/lib/libc++ -lc++
NO_WERROR=3D

The CC=3D, CXX=3D, CPP=3D assignments matching the XCC, XCXX, and XCPP =
assignments for CROSS_TOOLCHAIN=3Dpowerpc64-gcc are important to getting =
this far: otherwise gcc 4.2.1 is used for some things. I also listed =
CROSS_BINUTILS_PREFIX and X_COMPILER_TYPE when I added the assignments. =
I do not know if they are needed.

libc++ include and library path handling did not automatically work so I =
added the explicit CXXFLAGS+=3D and LDADD+=3D. If there had been a CXX =
specific LDADDCXX I would have used it instead.

NO_WERROR=3D is for avoiding stopping for the warnings: I'm not trying =
to clean up the status relative to compiler warnings.

# svnlite info /usr/srcC/
Path: /usr/srcC
Working Copy Root Path: /usr/srcC
URL: https://svn0.us-west.freebsd.org/base/head
Relative URL: ^/head
Repository Root: https://svn0.us-west.freebsd.org/base
Repository UUID: ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Revision: 279514
Node Kind: directory
Schedule: normal
Last Changed Author: adrian
Last Changed Rev: 279514
Last Changed Date: 2015-03-01 18:27:25 -0800 (Sun, 01 Mar 2015)

# svnlite status /usr/srcC/ --no-ignore
?       /usr/srcC/.snap
M       /usr/srcC/Makefile
M       /usr/srcC/contrib/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h
?       /usr/srcC/restoresymtable
M       /usr/srcC/sys/ddb/db_main.c
M       /usr/srcC/sys/ddb/db_script.c
?       /usr/srcC/sys/powerpc/conf/GENERIC64vtsc
?       /usr/srcC/sys/powerpc/conf/GENERIC64vtsc-NODEBUG
?       /usr/srcC/sys/powerpc/conf/GENERICvtsc
?       /usr/srcC/sys/powerpc/conf/GENERICvtsc-NODEBUG
M       /usr/srcC/sys/powerpc/ofw/ofw_machdep.c
M       /usr/srcC/sys/powerpc/ofw/ofwcall64.S

IntrusiveRefCntPtr.h needed an internal friend status established across =
typename parameters in order to compile.

I have a PowerMac G5 specific change to make booting reliable and some =
changes for getting information from early boot failures in case I get =
any more of them. I build without ps3 in order to allow having both vt =
and sc in the build.

# ls -FPal /usr/local/include/iconv*
-rw-r--r--  1 root  wheel  9348 Mar 12 02:47 =
/usr/local/include/iconv.h_alt

powerpc64-gcc automatically finds files in /usr/local/include/ such that =
they can be used when others with different content but the same name =
are appropriate. I renamed /usr/local/include/iconv.h to avoid it being =
an example of that.

I will not list how I got powerpc64-xtoolchain-gcc (and so =
powerpc64-gcc) to finish installing on a powerpc64 11.0-CURRENT.


=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?122C9C88-24F9-4FA7-BCAC-293ED0DB946A>