Commit Graph

21 Commits

Author SHA1 Message Date
Rich Felker 527fca9755 update binutils static pie patch to support all targets
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.
2015-11-05 23:33:19 +00:00
Rich Felker 8137f50ef9 add patch to fix binutils pr 19091 affecting sh/fdpic shared libs
this may not be the correct fix but works for now. patch will be
updated as needed. for details see:

https://sourceware.org/bugzilla/show_bug.cgi?id=19091
2015-10-08 16:34:45 +00:00
Rich Felker de06440f7e reorder sh/fdpic diff to match git diff output 2015-10-05 22:32:12 +00:00
Rich Felker bd17b1fbcd fix sh/fdpic issues found after first submission upstream
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.
2015-10-05 22:31:31 +00:00
Rich Felker 1c19e88d21 update gcc static PIE patch to work with all targets
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.
2015-09-30 01:20:14 +00:00
Rich Felker f872b28199 fix sh/fdpic 64-bit division code in libgcc
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.
2015-09-24 02:44:28 +00:00
Rich Felker 67122dc449 update gcc fdpic patch to fix re-emergence of pr66609
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.
2015-09-22 04:18:12 +00:00
Rich Felker d0ca7b1054 update gcc fdpic patch
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.
2015-09-21 06:00:40 +00:00
Rich Felker 72b4cdc7e2 fix inverted setting of sh fdpic flag by binutils
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
2015-09-14 17:31:27 +00:00
Rich Felker 8d226d0ff6 bypass gcc's potentially-broken detection of tls support 2015-09-13 08:29:07 +00:00
Rich Felker 5eb6f9add0 fix gcc's misdetection of sh as not supporting tls 2015-09-13 08:27:27 +00:00
Rich Felker 73e57bee7d improve sample config.mak 2015-09-13 04:17:08 +00:00
Rich Felker 954245dc83 fix error in fdpic patch that enabled fdpic by default 2015-09-13 03:53:43 +00:00
Rich Felker 3a0c9775b6 add initial fdpic support
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.
2015-09-11 17:27:35 +00:00
Rich Felker 532e13f3f7 avoid installing stage0 gcc
previously the stage0 gcc was installed to the output location during
the build, then replaced later by the final gcc. this violates the
principles of make and simply wastes time. the stage0 gcc is usable
in-place without installing it, so we can simply do that instead.
2015-08-27 06:42:32 +00:00
Rich Felker fa4bf7924b allow building with a particular tag/branch/commit of musl 2015-08-25 22:57:20 +00:00
Rich Felker 5e416e32e6 add clean rules to makefile 2015-08-25 21:28:55 +00:00
Rich Felker 2a124546d1 tweaks to fix regressions related to gcc wanting libc headers 2015-08-25 20:25:43 +00:00
Rich Felker 7d58f6a9bf add README 2015-08-25 19:58:17 +00:00
Rich Felker 0b78030478 add dummy files for empty dirs to include them in git 2015-08-25 19:34:59 +00:00
Rich Felker 596e008012 initial check-in 2015-08-25 19:32:46 +00:00