this patch breaks powerpc64 builds and is not necessary to produce a
working 32-bit powerpc toolchain. it seems like it may be useful for
reducing libgcc-internal bloat, but it can be reintroduced later after
it's fixed, if desired.
upstream fix was slightly too late to make it into the release. patch
was not included in mcm for previous binutils versions because it
depends on new upstream infrastructure. now gc-sections should be safe
to use on sh.
commit 23d6f66966 introduced this
regression as a failure to backport part of the gas testsuite diff
from binutils master to 2.25.1 where the file being patched had a
trivial difference. I'm not sure how this went unnoticed at the time
it was committed.
patch set consists of:
0001 static pie support (--no-dynamic-linker)
0006 avoid erroring out the build when docs can't be built
0007 add sh symbol@PCREL support to gas
example configuration is added to config.mak.dist too.
patch set consists of:
0001 full musl libc target support
0002 fixes for wrong optimizations of weak defs/aliases
0003 various sh breakage in configure scripts
0005 static pie support
0006 --enable-default-pie support
0008 fix for cross compiling bug in build system
0009 fix for wrong default div strategy for sh2 (missing libgcc code)
0010 fix failure to build on modern host gcc due to gnu-inline
0011 fix sh & alpha bootstrap failures before libc is built
0012 fix broken local-exec TLS with -fPIE on sh
the new patch is identical to the one committed upstream, except that
the binutils 2.25.1 used info->executable instead of
bfd_link_executable(info), and support for nds32 and score targets is
removed since 2.25.1 did not have the relevant code for them.
the following issues are fixed:
- ICE generating the new libgcc __ashlsi3_r0 and __lshrsi3_r0 shift
operations for non-J2 SH2.
- new sh_legitimate_constant_p function was unused because there was
an existing version with different signature which C++ allowed to be
overloaded rather than reporting the error.
- reversed asm spec conditional for fdpic broke non-fdpic builds.
this commit rebases the patch against gcc trunk and backports the
result. file order has been tweaked by hand so that the diff is
friendly to manual inspection.
since -E is no longer passed to the linker, musl commit
6fc30c2493fcfedec89e45088bea87766a1e3286 is now necessary to get a
version of rcrt1.o that works with the new static PIE support, or
-Wl,-E can be passed manually to work with old rcrt1.o.
I originally missed the udiv_qrnnd part of the fdpic patch when
forward-porting it because longlong.h moved to a non-obvious location.
however, the original patch was broken anyway; it misordered
instructions at branch delay slots and clobbered in-use registers.
my version of the code is more efficient because it uses knowledge
that __udiv_qrnnd_16 is a pure-PIC function that makes no calls, uses
no static data, and does not clobber r12. this means we only need to
load the instruction address, not the got address, from the function
descriptor to make the call.
the same can be achieved even more efficiently by declaring
__udiv_qrnnd_16 with object type instead of function type and using
the existing non-fdpic asm unmodified. I did not do this because I was
afraid it would be considered a hack unacceptable for upstream.
some of the forward-ported fdpic patch code contained duplicates of
code that was changed in the fix for pr66609. failure to notice this
before allowed the bug to re-emerge and broke musl's use of
overridable weak aliases.
two changes are made:
1. always enable flag_pic for fdpic. without this, various ICE and bad
codegen was observed.
2. allow sibcall for fdpic; it's valid since r12 is call-clobbered.
the behavior by bfd/ld matched the ABI document but was the opposite
of the kernel's interpretation and opposite of how ld treats the flag
on every other target using fdpic.
see this thread for details:
https://sourceware.org/ml/binutils/2015-09/msg00186.html
binutils-2.25.1/0003-shemuls.diff is needed to include the existing
fdpic support in the build when targeting sh*-linux-* rather than
tucking it away under sh*-uclinux-* only
gcc-5.2.0/0007-fdpic.diff is based on the original abandoned fdpic
patch 3/3 sent to the gcc list in 2010, updated for modern gcc and
with the uclinux dependencies removed. the original is here:
https://gcc.gnu.org/ml/gcc-patches/2010-08/msg01464.html
gcc-5.2.0/0001-musl.diff has been updated to use the right musl
dynamic linker pathname for fdpic so that musl-specific changes can be
avoided in the main fdpic patch.
at present, additional patches to musl are needed to produce working
binaries for the target.