New binutils patchset for building world with clang on powerpc64

Justin Hibbits jhibbits at freebsd.org
Sun Dec 7 19:41:25 UTC 2014


With the attached patch I can buildworld with clang on powerpc64.  It
survives a tinderbox build, so no regressions that I can see.

The patch is a backport of several patches to newer binutils, that the
author has graciously approved relicensing for GPLv2 for
our use in FreeBSD.

The problem comes, that it can only build natively, it can't
cross-build from amd64, and I don't know why.  It hits an assert in
bfd/elf64-ppc.c in ld when linking usr.bin/ar, handling a TLS
relocation, that this patch doesn't touch (the patch adds new
relocations, the problematic relocation is a R_PPC64_TPREL
relocation).

Just to confirm, I also hacked together a patch against clang to
generate old-style TLS relocation, instead of the new
R_PPC64_TLSGD/R_PPC64_TLSLD relocations, and that also failed at the
exact same place, with a completely unmodified binutils.  I spent
several days trying to track this down, and still can't figure it out.
Could a toolchain expert take a look and see if there's anything that's
obvious?  All that's needed to reproduce would be to apply the attached
patch, and build on amd64, for TARGET=powerpc TARGET_ARCH=powerpc64,
WITH_CC_IS_CLANG=yes WITH_CLANG_BOOTSTRAP=yes, and whatever other
tricks are needed to build with clang.

This, and some issues with a clang kernel, are standing in the way of
making powerpc(64) a fully-clang platform (plus patches I mentioned
above), and those kernel issues may be fixed with the new clang import
anyway.

Thanks,
Justin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: binutils_clang.diff
Type: text/x-patch
Size: 98138 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-toolchain/attachments/20141207/b62b32fb/attachment.bin>


More information about the freebsd-toolchain mailing list