changeset 1823:1d233a893085

Switch sh4 to musl.
author Rob Landley <rob@landley.net>
date Tue, 01 Dec 2015 20:50:53 -0600
parents 4927c8b8de1b
children 893e70efe047
files sources/patches/binutils-shpcrel.patch sources/patches/gcc-core-weakbugs.patch sources/targets/sh4
diffstat 3 files changed, 78 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sources/patches/binutils-shpcrel.patch	Tue Dec 01 20:50:53 2015 -0600
@@ -0,0 +1,13 @@
+Teach gas to understand a thing musl's assembly uses.
+
+--- binutils-397a64b3.orig//gas/config/tc-sh.c	2015-08-11 01:29:26.000000000 +0000
++++ binutils-397a64b3/gas/config/tc-sh.c	2015-11-02 23:17:03.931462591 +0000
+@@ -4491,6 +4496,8 @@ sh_parse_name (char const *name,
+     reloc_type = BFD_RELOC_SH_TLS_LE_32;
+   else if ((next_end = sh_end_of_match (next + 1, "DTPOFF")))
+     reloc_type = BFD_RELOC_SH_TLS_LDO_32;
++  else if ((next_end = sh_end_of_match (next + 1, "PCREL")))
++    reloc_type = BFD_RELOC_32_PCREL;
+   else
+     goto no_suffix;
+ 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sources/patches/gcc-core-weakbugs.patch	Tue Dec 01 20:50:53 2015 -0600
@@ -0,0 +1,65 @@
+Another musl patch, it's unhappy with how weak signals are handled.
+No actual explanation about what or test case, but since it's a clear bugfix...
+
+diff --git a/gcc/cgraph.c b/gcc/cgraph.c
+index fcdc02e..db04afd 100644
+--- a/gcc/cgraph.c
++++ b/gcc/cgraph.c
+@@ -1169,7 +1169,7 @@ cgraph_function_body_availability (struct cgraph_node *node)
+      inline and offline) having same side effect characteristics as
+      good optimization is what this optimization is about.  */
+ 
+-  else if (!(*targetm.binds_local_p) (node->decl)
++  else if ((DECL_WEAK (node->decl) || !(*targetm.binds_local_p) (node->decl))
+ 	   && !DECL_COMDAT (node->decl) && !DECL_EXTERNAL (node->decl))
+     avail = AVAIL_OVERWRITABLE;
+   else avail = AVAIL_AVAILABLE;
+@@ -1190,7 +1190,8 @@ cgraph_variable_initializer_availability (struct cgraph_varpool_node *node)
+   /* If the variable can be overwritten, return OVERWRITABLE.  Takes
+      care of at least two notable extensions - the COMDAT variables
+      used to share template instantiations in C++.  */
+-  if (!(*targetm.binds_local_p) (node->decl) && !DECL_COMDAT (node->decl))
++  if ((DECL_WEAK (node->decl) || !(*targetm.binds_local_p) (node->decl))
++       && !DECL_COMDAT (node->decl))
+     return AVAIL_OVERWRITABLE;
+   return AVAIL_AVAILABLE;
+ }
+diff --git a/gcc/ipa-inline.c b/gcc/ipa-inline.c
+index 84ef830..73d9fcc 100644
+--- a/gcc/ipa-inline.c
++++ b/gcc/ipa-inline.c
+@@ -300,7 +300,7 @@ cgraph_default_inline_p (struct cgraph_node *n, const char **reason)
+ 
+   if (n->inline_decl)
+     decl = n->inline_decl;
+-  if (!DECL_INLINE (decl))
++  if (!DECL_INLINE (decl) || DECL_WEAK (decl))
+     {
+       if (reason)
+ 	*reason = N_("function not inlinable");
+diff --git a/gcc/ipa-pure-const.c b/gcc/ipa-pure-const.c
+index fdaff50..1bfd577 100644
+--- a/gcc/ipa-pure-const.c
++++ b/gcc/ipa-pure-const.c
+@@ -512,7 +512,7 @@ analyze_function (struct cgraph_node *fn)
+   /* If this function does not return normally or does not bind local,
+      do not touch this unless it has been marked as const or pure by the
+      front end.  */
+-  if (TREE_THIS_VOLATILE (decl)
++  if (TREE_THIS_VOLATILE (decl) || DECL_WEAK (decl)
+       || !targetm.binds_local_p (decl))
+     {
+       l->pure_const_state = IPA_NEITHER;
+diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
+index 1c0b79b..5a3ba7e 100644
+--- a/gcc/tree-inline.c
++++ b/gcc/tree-inline.c
+@@ -1522,6 +1522,8 @@ inlinable_function_p (tree fn)
+   else if (!DECL_INLINE (fn) && !flag_unit_at_a_time)
+     inlinable = false;
+ 
++  else if (DECL_WEAK (fn))
++    inlinable = false;
+   else if (inline_forbidden_p (fn))
+     {
+       /* See if we should warn about uninlinable functions.  Previously,
--- a/sources/targets/sh4	Mon Nov 30 16:06:00 2015 -0600
+++ b/sources/targets/sh4	Tue Dec 01 20:50:53 2015 -0600
@@ -15,12 +15,6 @@
 
 CONSOLE="ttySC1 noiotrap"
 
-UCLIBC_CONFIG="
-TARGET_sh=y
-ARCH_WANTS_LITTLE_ENDIAN=y
-UCLIBC_HAS_FPU=y
-"
-
 # This needs some massive cleanup, but part of the problem is arch/sh4/Kconfig forces on EXPERT
 # which requies re-selecting a bunch of standard features.  Apparently sh is not meant to be
 # used by normal people, it's "special".