Bug 214855 - head -r309179 TARGET_ARCH=powerpc64 clang 3.9.0 based cross build: powerpc.powerpc64/usr/src/tmp/usr/bin/ld: BFD 2.17.50 [FreeBSD] 2007-07-03 internal error
Summary: head -r309179 TARGET_ARCH=powerpc64 clang 3.9.0 based cross build: powerpc.po...
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: CURRENT
Hardware: powerpc Any
: --- Affects Only Me
Assignee: freebsd-toolchain mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-11-26 19:26 UTC by Mark Millard
Modified: 2019-07-09 02:07 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Millard 2016-11-26 19:26:07 UTC
[From a report I made to the lists. . .]

I updated to head -r309197 (with a work around for -r309144 breaking the build).

This was on amd64, then used it to try to cross buildworld using clang 3.9.0 for
TARGET_ARCH=powerpc64.

It failed. I used:

WITH_CROSS_COMPILER=
WITHOUT_SYSTEM_COMPILER=
#
WITH_LIBCPLUSPLUS=
WITH_BINUTILS_BOOTSTRAP=
WITH_CLANG_BOOTSTRAP=
WITH_CLANG=
WITH_CLANG_IS_CC=
. . .
WITHOUT_ELFTOOLCHAIN_BOOTSTRAP=

(Full material listed later.)

The failure report was:

--- as.full ---
/usr/obj/powerpc64vtsc_clang_world/powerpc.powerpc64/usr/src/tmp/usr/bin/ld: BFD 2.17.50 [FreeBSD] 2007-07-03 internal error, aborting at /usr/src/gnu/usr.bin/binutils/libbfd/../../../../contrib/binutils/bfd/elf64-ppc.c line 11029 in bfd_boolean ppc64_elf_relocate_section(bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, Elf_Internal_Rela *, Elf_Internal_Sym *, asection **)

/usr/obj/powerpc64vtsc_clang_world/powerpc.powerpc64/usr/src/tmp/usr/bin/ld: Please report this bug.

cc: error: linker command failed with exit code 1 (use -v to see invocation)
*** [as.full] Error code 1

make[6]: stopped in /usr/src/gnu/usr.bin/binutils/as
.ERROR_TARGET='as.full'
.ERROR_META_FILE='/usr/obj/powerpc64vtsc_clang_world/powerpc.powerpc64/usr/src/gnu/usr.bin/binutils/as/as.full.meta'
.MAKE.LEVEL='6'
MAKEFILE=''
.MAKE.MODE='meta missing-filemon=yes missing-meta=yes silent=yes verbose'
.CURDIR='/usr/src/gnu/usr.bin/binutils/as'
.MAKE='make'
.OBJDIR='/usr/obj/powerpc64vtsc_clang_world/powerpc.powerpc64/usr/src/gnu/usr.bin/binutils/as'
.TARGETS='all'
DESTDIR='/usr/obj/powerpc64vtsc_clang_world/powerpc.powerpc64/usr/src/tmp'
LD_LIBRARY_PATH=''
MACHINE='powerpc'
MACHINE_ARCH='powerpc64'
MAKEOBJDIRPREFIX='/usr/obj/powerpc64vtsc_clang_world/powerpc.powerpc64'
MAKESYSPATH='/usr/src/share/mk'
MAKE_VERSION='20160818'
PATH='/usr/obj/powerpc64vtsc_clang_world/powerpc.powerpc64/usr/src/tmp/legacy/usr/sbin:/usr/obj/powerpc64vtsc_clang_world/powerpc.powerpc64/usr/src/tmp/legacy/usr/bin:/usr/obj/powerpc64vtsc_clang_world/powerpc.powerpc64/usr/src/tmp/legacy/bin:/usr/obj/powerpc64vtsc_clang_world/powerpc.powerpc64/usr/src/tmp/usr/sbin:/usr/obj/powerpc64vtsc_clang_world/powerpc.powerpc64/usr/src/tmp/usr/bin:/sbin:/bin:/usr/sbin:/usr/bin'
SRCTOP='/usr/src'
OBJTOP='/usr/obj/powerpc64vtsc_clang_world/powerpc.powerpc64/usr/src'
.MAKE.MAKEFILES='/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-bootstrap.amd64-host /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/gnu/usr.bin/binutils/as/Makefile /usr/src/gnu/usr.bin/binutils/as/../../Makefile.inc /usr/src/gnu/usr.bin/binutils/as/../../../Makefile.inc /usr/src/gnu/usr.bin/binutils/as/../Makefile.inc0 /usr/src/share/mk/src.opts.mk /usr/src/share/mk/bsd.own.mk /usr/src/share/mk/bsd.opts.mk /usr/src/share/mk/bsd.cpu.mk /usr/src/share/mk/bsd.compiler.mk /usr/src/share/mk/bsd.compiler.mk /usr/src/share/mk/bsd.prog.mk /usr/src/share/mk/bsd.init.mk /usr/src/share/mk/local.init.mk /usr/src/share/mk/src.init.mk /usr/src/gnu/usr.bin/binutils/as/../Makefile.inc /usr/src/share/mk/bsd.libnames.mk /usr/src/share/mk/src.libnames.mk /usr/src/share/mk/bsd.nls.mk /usr/src
/share/mk/bsd.confs.mk /usr/src/share/mk/bsd.files.mk /usr/src/share/mk/bsd.incs.mk /usr/src/share/mk/bsd.links.mk /usr/src/share/mk/bsd.man.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='. /usr/src/gnu/usr.bin/binutils/as /usr/src/gnu/usr.bin/binutils/as/../../../../contrib/binutils/gas /usr/src/gnu/usr.bin/binutils/as/../../../../contrib/binutils/gas/config'
1 error
. . .



# more /usr/obj/powerpc64vtsc_clang_world/powerpc.powerpc64/usr/src/gnu/usr.bin/binutils/as/as.full.meta
# Meta data file /usr/obj/powerpc64vtsc_clang_world/powerpc.powerpc64/usr/src/gnu/usr.bin/binutils/as/as.full.meta
CMD cc -target powerpc64-unknown-freebsd12.0 --sysroot=/usr/obj/powerpc64vtsc_clang_world/powerpc.powerpc64/usr/src/tmp -B/usr/obj/powerpc64vtsc_clang_world/powerpc.powerpc64/usr/src/tmp/usr/bin -O2 -pipe -DBFD_DEFAULT_TARGET_SIZE=64 -I. -I/usr/src/gnu/usr.bin/binutils/as -I/usr/src/gnu/usr.bin/binutils/as/../libbfd -I/usr/obj/powerpc64vtsc_clang_world/powerpc.powerpc64/usr/src/gnu/usr.bin/binutils/as/../libbfd -I/usr/src/gnu/usr.bin/binutils/as/../../../../contrib/binutils/include -DDEFAULT_ARCH=\"powerpc64\" -DTARGET_CPU=\"powerpc64\" -DTARGET_OS=\"freebsd\" -DTARGET_CANONICAL=\"powerpc64-unknown-freebsd\" -DTARGET_ALIAS=\"powerpc64-unknown-freebsd\" -DVERSION=\""2.17.50 [FreeBSD] 2007-07-03"\" -D_GNU_SOURCE -I/usr/src/gnu/usr.bin/binutils/as/../../../../contrib/binutils/gas -I/usr/src/gnu/usr.bin/binutils/as/../../../../contrib/binutils/bfd -I/usr/src/gnu/usr.bin/binutils/as/../../../../contrib/binutils/gas/config -I/usr/src/gnu/usr.bin/binutils/as/../../../../contrib/binutils -I/
usr/src/gnu/usr.bin/binutils/as -I/usr/src/gnu/usr.bin/binutils/as/powerpc-freebsd -g -std=gnu99 -fstack-protector-strong -Wsystem-headers -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wno-uninitialized -Wno-pointer-sign -Wno-empty-body -Wno-string-plus-int -Wno-unused-const-variable -Wno-tautological-compare -Wno-unused-value -Wno-parentheses-equality -Wno-unused-function -Wno-enum-conversion -Wno-unused-local-typedef -Qunused-arguments  -static -o as.full app.o as.o atof-generic.o atof-ieee.o cond.o depend.o dw2gencfi.o dwarf2dbg.o ecoff.o ehopt.o expr.o flonum-copy.o flonum-konst.o flonum-mult.o frags.o hash.o input-file.o input-scrub.o listing.o literal.o macro.o messages.o obj-elf.o output-file.o read.o sb.o stabs.o subsegs.o symbols.o write.o tc-ppc.o  ../libbfd/libbfd.a ../libiberty/libiberty.a ../libopcodes/libopcodes.a
CWD /usr/obj/powerpc64vtsc_clang_world/powerpc.powerpc64/usr/src/gnu/usr.bin/binutils/as
TARGET as.full
-- command output --
/usr/obj/powerpc64vtsc_clang_world/powerpc.powerpc64/usr/src/tmp/usr/bin/ld: BFD 2.17.50 [FreeBSD] 2007-07-03 internal error, aborting at /usr/src/gnu/usr.bin/binutils/libbfd/../../../../contrib/binutils/bfd/elf64-ppc.c line 11029 in bfd_boolean ppc64_elf_relocate_section(bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, Elf_Internal_Rela *, Elf_Internal_Sym *, asection **)

/usr/obj/powerpc64vtsc_clang_world/powerpc.powerpc64/usr/src/tmp/usr/bin/ld: Please report this bug.

cc: error: linker command failed with exit code 1 (use -v to see invocation)
*** Error code 1
. . .


Script started on Sat Nov 26 09:03:53 2016
Command: env __MAKE_CONF=/root/src.configs/make.conf SRCCONF=/dev/null SRC_ENV_CONF=/root/src.configs/src.conf.powerpc64-clang-bootstrap.amd64-host WITH_META_MODE=yes MAKEOBJDIRPREFIX=/usr/obj/powerpc64vtsc_clang_world make -j 5 buildworld
--- buildworld ---
. . .


# more ~/src.configs/src.conf.powerpc64-clang-bootstrap.amd64-host
TO_TYPE=powerpc64
#
KERNCONF=GENERIC64vtsc-NODBG
TARGET=powerpc
.if ${.MAKE.LEVEL} == 0
TARGET_ARCH=${TO_TYPE}
.export TARGET_ARCH
.endif
#
WITH_CROSS_COMPILER=
WITHOUT_SYSTEM_COMPILER=
#
WITH_LIBCPLUSPLUS=
WITH_BINUTILS_BOOTSTRAP=
WITH_CLANG_BOOTSTRAP=
WITH_CLANG=
WITH_CLANG_IS_CC=
WITH_CLANG_FULL=
WITH_CLANG_EXTRAS=
WITH_LLDB=
#
WITH_BOOT=
WITH_LIB32=
#
WITHOUT_ELFTOOLCHAIN_BOOTSTRAP=
WITHOUT_GCC_BOOTSTRAP=
WITHOUT_GCC=
WITHOUT_GCC_IS_CC=
WITHOUT_GNUCXX=
#
NO_WERROR=
#WERROR=
MALLOC_PRODUCTION=
#
WITH_DEBUG_FILES=


# more ~/src.configs/make.conf 
CFLAGS.gcc+= -v
Comment 1 Mark Millard 2016-11-26 20:47:49 UTC
(In reply to Mark Millard from comment #0)

FYI: I attempted a TARGET_ARCH=powerpc buildworld (cross build) and it had no such problem.

This was using:

# more ~/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_CLANG_BOOTSTRAP=
WITH_CLANG=
WITH_CLANG_IS_CC=
WITH_CLANG_FULL=
WITH_CLANG_EXTRAS=
# lldb requires missing atomic 8-byte operations for powerpc (non-64)
WITHOUT_LLDB=
#
WITH_BOOT=
WITHOUT_LIB32=
#
WITHOUT_ELFTOOLCHAIN_BOOTSTRAP=
WITHOUT_GCC_BOOTSTRAP=
WITHOUT_GCC=
WITHOUT_GCC_IS_CC=
WITHOUT_GNUCXX=
#
NO_WERROR=
#WERROR=
MALLOC_PRODUCTION=
#
WITH_DEBUG_FILES=

(I've not checked the atomic 8-byte operation status for 32-bit powerpc recently.)
Comment 2 Mark Millard 2017-01-04 05:08:20 UTC
I retried with -r311147 and the failure repeated. clang 3.9.1 and the like
have not changed the behavior of the

/usr/obj/powerpc64vtsc_clang_world/powerpc.powerpc64/usr/src/tmp/usr/bin/ld

when it processes as.full .
Comment 3 Mark Millard 2017-01-09 05:41:48 UTC
(In reply to Mark Millard from comment #0)

[Still true at -r311147 .]

I'll note that the abort happens at:

            if (off >= (bfd_vma) -2)
              abort ();

in the code for:

        case R_PPC64_GOT16:
        case R_PPC64_GOT16_LO:
        case R_PPC64_GOT16_HI:
        case R_PPC64_GOT16_HA:
        case R_PPC64_GOT16_DS:
        case R_PPC64_GOT16_LO_DS:
        dogot:

in:

static bfd_boolean
ppc64_elf_relocate_section (bfd *output_bfd,
                            struct bfd_link_info *info,
                            bfd *input_bfd,
                            asection *input_section,
                            bfd_byte *contents,
                            Elf_Internal_Rela *relocs,
                            Elf_Internal_Sym *local_syms,
                            asection **local_sections)
Comment 4 Justin Hibbits freebsd_committer 2017-03-29 15:38:03 UTC
I saw this back in 2014 when I was making my first set of changes for the new thread local storage relocations that clang uses.  I was never able to track down the bug yet, and haven't tested to see if it manifests as well with newer binutils.
Comment 5 Mark Millard 2017-03-29 21:44:03 UTC
(In reply to Justin Hibbits from comment #4)

ld from 2.25 and from 2.27 from ports has worked fine.

But I'm not sure if by "newer" Justin was referring to
such vs. referring to potential updates to the system
2.17.* ld.

While code that handles thrown C++ exceptions fails
at run-time I'm able to use clang to buildworld and
boot and use FreeBSD for powerpc64 based on the
ports binutils (although I've not tried the new 2.28).

[I reverted to 2.27 when I found that arm64/aarch64
was broken for buildworld buildkernel (at least for
cross building from amd64). I did this before trying
powerpc64 or powerpc.]

[Unfortunately without C++ exception handling working
kyua can not be used on powerpc64. In my view that is
sufficient to say that clang is still insufficient to
be the system compiler for powerpc64 --ignoring any
system binutils or lld issues hat force port binutils
use.]
Comment 6 Mark Millard 2019-07-09 02:07:01 UTC
It looks like this will become Overcome By Events when
powerpc64 is moved to ELFv2 using lld (or
stable/powerpc64-bintuils): lld would be a FreeBSD
"standard linker" that worked instead.