Commit Graph

16 Commits

Author SHA1 Message Date
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