powerpc64 context for clang36 use: /usr/bin/ld too old(?) but is used by clang36

Mark Millard markmi at dsl-only.net
Sat Mar 21 23:26:08 UTC 2015


Basic context:

[I'm using an example taken from buildworld activity just for illustration.
Yes, I know that powerpc64 buildworld via clang is not yet supported. buildworld is not the actual point here but does illustrate a pre-existing build environment having the issue in question.]

> # freebsd-version -ku; uname -apKU
> 11.0-CURRENT
> 11.0-CURRENT
> FreeBSD FBSDG5C0 11.0-CURRENT FreeBSD 11.0-CURRENT #0 r279514M: Wed Mar 18 20:11:15 PDT 2015     root at FBSDG5C0:/usr/obj/usr/srcC/sys/GENERIC64vtsc-NODEBUG  powerpc powerpc64 1100062 1100062

> # which ld
> /usr/bin/ld
> # ld --version
> GNU ld 2.17.50 [FreeBSD] 2007-07-03
> Copyright 2007 Free Software Foundation, Inc.
> This program is free software; you may redistribute it under the terms of
> the GNU General Public License.  This program has absolutely no warranty.


> export PATH="/usr/local/powerpc64-freebsd/bin:$PATH"
> make -j 8 \
> WITHOUT_CLANG_BOOTSTRAP= WITH_CLANG= WITH_CLANG_IS_CC= \
> WITH_LLDB= \
> WITH_GCC_BOOTSTRAP= WITH_GCC= WITHOUT_GNUCXX= \
> WITH_BOOT= WITH_LIB32= \
> buildworld buildkernel \
> KERNCONF=GENERIC64vtsc-NODEBUG \
> TARGET=powerpc TARGET_ARCH=powerpc64


> # more /etc/src.conf
> NO_WERROR=
> WITH_LIBCPLUSPLUS=
> #
> # For trying clang36...
> # (I'm trying to use binutils from the powerpc64-xtoolchain-gcc install.)
> #
> CC=/usr/local/bin/clang36
> CXX=/usr/local/bin/clang++36
> CPP=/usr/local/bin/clang-cpp36
> #CROSS_BINUTILS_PREFIX=/usr/local/powerpc64-freebsd/bin/
> AS=/usr/local/powerpc64-freebsd/bin/as
> AR=/usr/local/powerpc64-freebsd/bin/ar
> LD=/usr/local/powerpc64-freebsd/bin/ld
> NM=/usr/local/powerpc64-freebsd/bin/nm
> OBJCOPY=/usr/local/powerpc64-freebsd/bin/objcopy
> OBJDUMP=/usr/local/powerpc64-freebsd/bin/objdump
> RANLIB=/usr/local/powerpc64-freebsd/bin/ranlib
> SIZE=/usr/local/powerpc64-freebsd/bin/size
> STRINGS=/usr/local/powerpc64-freebsd/bin/strings
> XAS=${AS}
> XAR=${AR}
> XLD=${LD}
> XNM=${NM}
> XOBJCOPY=${OBJCOPY}
> XOBJDUMP=${OBJDUMP}
> XRANLIB=${RANLIB}
> XSIZE=${SIZE}
> XSTRINGS=${STRINGS}
...


The problem:

When the clang36 driver program is used to (for example) link programs it apparently automatically and always uses /usr/bin/ld. But for powerpc64 /usr/bin/ld is BFD 2.17.50 vintage and reports an internal error (see below).

It seems likely that clang36 simply requires more recent binutils programs, such as from binutils-2.25 currently.

> /usr/local/bin/clang36 -O2 -pipe  -DHAVE_CONFIG_H -I/usr/srcC/kerberos5/tools/make-roken/../../include -DHAVE_CONFIG_H -I/usr/srcC/kerberos5/tools/make-roken/../../include -std=gnu99  -Qunused-argumen
> ts -I/usr/obj/usr/srcC/tmp/legacy/usr/include  -static -L/usr/obj/usr/srcC/tmp/legacy/usr/lib -o make-roken make-roken.o -legacy


> /usr/bin/ld: BFD 2.17.50 [FreeBSD] 2007-07-03 internal error, aborting at /usr/srcC/gnu/usr.bin/binutils/libbfd/../../../../contrib/binutils/bfd/elf64-ppc.c line 11029 in ppc64_elf_relocate_section
> /usr/bin/ld: Please report this bug.

If the clang36 port allowed binding to binutils (currently binutils-2.25) instead of /usr/bin/<?> tools it could then work in more contexts.

For all I know more than ld could also have vintage issues.

I do not know if powerpc64 and powerpc have the only such vintage-oddities around.



Context details:

# svnlite info /usr/ports/lang/clang36
Path: /usr/ports/lang/clang36
Working Copy Root Path: /usr/ports
URL: https://svn0.us-west.freebsd.org/ports/head/lang/clang36
Relative URL: ^/head/lang/clang36
Repository Root: https://svn0.us-west.freebsd.org/ports
Repository UUID: 35697150-7ecd-e111-bb59-0022644237b5
Revision: 381120
Node Kind: directory
Schedule: normal
Last Changed Author: brooks
Last Changed Rev: 380295
Last Changed Date: 2015-03-02 12:21:38 -0800 (Mon, 02 Mar 2015)

# more /etc/make.conf 
WRKDIRPREFIX=/usr/obj/portswork
#WITH_DEBUG=
MALLOC_PRODUCTION=


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



More information about the freebsd-ports mailing list