commit:     7e77904383bab15cbe131c2d32cf4e2d06dbb769
Author:     Felix Janda <felix.janda <AT> posteo <DOT> de>
AuthorDate: Mon Nov  3 19:54:43 2014 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Tue Nov  4 18:41:48 2014 +0000
URL:        
http://sources.gentoo.org/gitweb/?p=proj/hardened-dev.git;a=commit;h=7e779043

sys-devel/gcc: support for powerpc

Signed-off-by: Anthony G. Basile <blueness <AT> gentoo.org>

---
 .../gcc/files/gcc-4.7.3-musl-linker-path.patch     |  26 ++++
 .../files/gcc-4.7.3-powerpc-libc-stack-end.patch   | 171 +++++++++++++++++++++
 sys-devel/gcc/files/gcc-4.7.4-secure-plt.patch     |  37 +++++
 .../gcc/files/gcc-4.8.3-musl-linker-path.patch     |  65 ++++++++
 sys-devel/gcc/files/gcc-4.8.3-secure-plt.patch     |  43 ++++++
 sys-devel/gcc/gcc-4.7.4-r99.ebuild                 |   2 +
 sys-devel/gcc/gcc-4.8.3-r99.ebuild                 |   3 +-
 7 files changed, 346 insertions(+), 1 deletion(-)

diff --git a/sys-devel/gcc/files/gcc-4.7.3-musl-linker-path.patch 
b/sys-devel/gcc/files/gcc-4.7.3-musl-linker-path.patch
index df076f1..d454053 100644
--- a/sys-devel/gcc/files/gcc-4.7.3-musl-linker-path.patch
+++ b/sys-devel/gcc/files/gcc-4.7.3-musl-linker-path.patch
@@ -33,3 +33,29 @@ diff -Naur gcc-4.7.3.orig/gcc/config/mips/linux.h 
gcc-4.7.3/gcc/config/mips/linu
  
 -#define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
 +#define GLIBC_DYNAMIC_LINKER "/lib/ld-musl-mipsel.so.1"
+diff -Naur gcc-4.7.3.orig/gcc/config/rs6000/linux64.h 
gcc-4.7.3/gcc/config/rs6000/linux64.h
+--- gcc-4.7.3/gcc/config/rs6000/linux64.h      2014-10-11 18:59:07.479279989 
-0200
++++ gcc-4.7.3/gcc/config/rs6000/linux64.h      2014-10-11 18:59:45.777801191 
-0200
+@@ -358,8 +358,8 @@
+ #undef        LINK_OS_DEFAULT_SPEC
+ #define LINK_OS_DEFAULT_SPEC "%(link_os_linux)"
+ 
+-#define GLIBC_DYNAMIC_LINKER32 "/lib/ld.so.1"
+-#define GLIBC_DYNAMIC_LINKER64 "/lib64/ld64.so.1"
++#define GLIBC_DYNAMIC_LINKER32 "/lib/ld-musl-powerpc.so.1"
++#define GLIBC_DYNAMIC_LINKER64 "/lib/ld-musl-powerpc64.so.1"
+ #define UCLIBC_DYNAMIC_LINKER32 "/lib/ld-uClibc.so.0"
+ #define UCLIBC_DYNAMIC_LINKER64 "/lib/ld64-uClibc.so.0"
+ #if DEFAULT_LIBC == LIBC_UCLIBC
+diff -Naur gcc-4.7.3/gcc/config/rs6000/sysv4.h 
gcc-4.7.3/gcc/config/rs6000/sysv4.h
+--- gcc-4.7.3/gcc/config/rs6000/sysv4.h        2014-10-11 19:00:03.079584889 
-0200
++++ gcc-4.7.3/gcc/config/rs6000/sysv4.h        2014-10-11 19:00:28.476267387 
-0200
+@@ -802,7 +802,7 @@
+ 
+ #define LINK_START_LINUX_SPEC ""
+ 
+-#define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
++#define GLIBC_DYNAMIC_LINKER "/lib/ld-musl-powerpc.so.1"
+ #define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
+ #if DEFAULT_LIBC == LIBC_UCLIBC
+ #define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"

diff --git a/sys-devel/gcc/files/gcc-4.7.3-powerpc-libc-stack-end.patch 
b/sys-devel/gcc/files/gcc-4.7.3-powerpc-libc-stack-end.patch
new file mode 100644
index 0000000..91c1b34
--- /dev/null
+++ b/sys-devel/gcc/files/gcc-4.7.3-powerpc-libc-stack-end.patch
@@ -0,0 +1,171 @@
+From: amodra <amodra@138bc75d-0d04-0410-961f-82ee72b054a4>
+Date: Fri, 15 Feb 2013 13:53:40 +0000 (+0000)
+Subject:       PR target/55431
+X-Git-Tag: gcc-4_8_0-release~416
+X-Git-Url: 
http://repo.or.cz/w/official-gcc.git/commitdiff_plain/2a0bfd56d1b6a8ece8fb852691ea32713c7891b3
+
+       PR target/55431
+       * config/rs6000/linux-unwind.h (ppc_linux_aux_vector): Delete.
+       (ppc_fallback_frame_state): Always set up save locations for fp
+       and altivec.  Don't bother with non-callee-saved regs, r0-r13
+       except for r2 on ppc64, fr0-fr13, v0-v19, vscr.
+
+
+
+git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@196077 
138bc75d-0d04-0410-961f-82ee72b054a4
+diff --git a/libgcc/config/rs6000/linux-unwind.h 
b/libgcc/config/rs6000/linux-unwind.h
+index 3a2da6e..c9273c4 100644
+--- a/libgcc/config/rs6000/linux-unwind.h
++++ b/libgcc/config/rs6000/linux-unwind.h
+@@ -26,7 +26,6 @@
+ #define R_CR2         70
+ #define R_VR0         77
+ #define R_VRSAVE      109
+-#define R_VSCR                110
+ 
+ struct gcc_vregs
+ {
+@@ -175,38 +174,6 @@ get_regs (struct _Unwind_Context *context)
+ }
+ #endif
+ 
+-/* Find an entry in the process auxiliary vector.  The canonical way to
+-   test for VMX is to look at AT_HWCAP.  */
+-
+-static long
+-ppc_linux_aux_vector (long which)
+-{
+-  /* __libc_stack_end holds the original stack passed to a process.  */
+-  extern long *__libc_stack_end;
+-  long argc;
+-  char **argv;
+-  char **envp;
+-  struct auxv
+-  {
+-    long a_type;
+-    long a_val;
+-  } *auxp;
+-
+-  /* The Linux kernel puts argc first on the stack.  */
+-  argc = __libc_stack_end[0];
+-  /* Followed by argv, NULL terminated.  */
+-  argv = (char **) __libc_stack_end + 1;
+-  /* Followed by environment string pointers, NULL terminated. */
+-  envp = argv + argc + 1;
+-  while (*envp++)
+-    continue;
+-  /* Followed by the aux vector, zero terminated.  */
+-  for (auxp = (struct auxv *) envp; auxp->a_type != 0; ++auxp)
+-    if (auxp->a_type == which)
+-      return auxp->a_val;
+-  return 0;
+-}
+-
+ /* Do code reading to identify a signal frame, and set the frame
+    state data appropriately.  See unwind-dw2.c for the structs.  */
+ 
+@@ -216,8 +183,8 @@ static _Unwind_Reason_Code
+ ppc_fallback_frame_state (struct _Unwind_Context *context,
+                         _Unwind_FrameState *fs)
+ {
+-  static long hwcap = 0;
+   struct gcc_regs *regs = get_regs (context);
++  struct gcc_vregs *vregs;
+   long new_cfa;
+   int i;
+ 
+@@ -229,12 +196,15 @@ ppc_fallback_frame_state (struct _Unwind_Context 
*context,
+   fs->regs.cfa_reg = STACK_POINTER_REGNUM;
+   fs->regs.cfa_offset = new_cfa - (long) context->cfa;
+ 
+-  for (i = 0; i < 32; i++)
+-    if (i != STACK_POINTER_REGNUM)
+-      {
+-      fs->regs.reg[i].how = REG_SAVED_OFFSET;
+-      fs->regs.reg[i].loc.offset = (long) &regs->gpr[i] - new_cfa;
+-      }
++#ifdef __powerpc64__
++  fs->regs.reg[2].how = REG_SAVED_OFFSET;
++  fs->regs.reg[2].loc.offset = (long) &regs->gpr[2] - new_cfa;
++#endif
++  for (i = 14; i < 32; i++)
++    {
++      fs->regs.reg[i].how = REG_SAVED_OFFSET;
++      fs->regs.reg[i].loc.offset = (long) &regs->gpr[i] - new_cfa;
++    }
+ 
+   fs->regs.reg[R_CR2].how = REG_SAVED_OFFSET;
+   /* CR? regs are always 32-bit and PPC is big-endian, so in 64-bit
+@@ -250,57 +220,35 @@ ppc_fallback_frame_state (struct _Unwind_Context 
*context,
+   fs->retaddr_column = ARG_POINTER_REGNUM;
+   fs->signal_frame = 1;
+ 
+-  if (hwcap == 0)
++  /* If we have a FPU...  */
++  for (i = 14; i < 32; i++)
+     {
+-      hwcap = ppc_linux_aux_vector (16);
+-      /* These will already be set if we found AT_HWCAP.  A nonzero
+-       value stops us looking again if for some reason we couldn't
+-       find AT_HWCAP.  */
+-#ifdef __powerpc64__
+-      hwcap |= 0xc0000000;
+-#else
+-      hwcap |= 0x80000000;
+-#endif
++      fs->regs.reg[i + 32].how = REG_SAVED_OFFSET;
++      fs->regs.reg[i + 32].loc.offset = (long) &regs->fpr[i] - new_cfa;
+     }
+ 
+-  /* If we have a FPU...  */
+-  if (hwcap & 0x08000000)
+-    for (i = 0; i < 32; i++)
+-      {
+-      fs->regs.reg[i + 32].how = REG_SAVED_OFFSET;
+-      fs->regs.reg[i + 32].loc.offset = (long) &regs->fpr[i] - new_cfa;
+-      }
+-
+   /* If we have a VMX unit...  */
+-  if (hwcap & 0x10000000)
+-    {
+-      struct gcc_vregs *vregs;
+ #ifdef __powerpc64__
+-      vregs = regs->vp;
++  vregs = regs->vp;
+ #else
+-      vregs = &regs->vregs;
++  vregs = &regs->vregs;
+ #endif
+-      if (regs->msr & (1 << 25))
++  if (regs->msr & (1 << 25))
++    {
++      for (i = 20; i < 32; i++)
+       {
+-        for (i = 0; i < 32; i++)
+-          {
+-            fs->regs.reg[i + R_VR0].how = REG_SAVED_OFFSET;
+-            fs->regs.reg[i + R_VR0].loc.offset
+-              = (long) &vregs->vr[i] - new_cfa;
+-          }
+-
+-        fs->regs.reg[R_VSCR].how = REG_SAVED_OFFSET;
+-        fs->regs.reg[R_VSCR].loc.offset = (long) &vregs->vscr - new_cfa;
++        fs->regs.reg[i + R_VR0].how = REG_SAVED_OFFSET;
++        fs->regs.reg[i + R_VR0].loc.offset = (long) &vregs->vr[i] - new_cfa;
+       }
+-
+-      fs->regs.reg[R_VRSAVE].how = REG_SAVED_OFFSET;
+-      fs->regs.reg[R_VRSAVE].loc.offset = (long) &vregs->vsave - new_cfa;
+     }
+ 
++  fs->regs.reg[R_VRSAVE].how = REG_SAVED_OFFSET;
++  fs->regs.reg[R_VRSAVE].loc.offset = (long) &vregs->vsave - new_cfa;
++
+   /* If we have SPE register high-parts... we check at compile-time to
+      avoid expanding the code for all other PowerPC.  */
+ #ifdef __SPE__
+-  for (i = 0; i < 32; i++)
++  for (i = 14; i < 32; i++)
+     {
+       fs->regs.reg[i + FIRST_PSEUDO_REGISTER - 1].how = REG_SAVED_OFFSET;
+       fs->regs.reg[i + FIRST_PSEUDO_REGISTER - 1].loc.offset

diff --git a/sys-devel/gcc/files/gcc-4.7.4-secure-plt.patch 
b/sys-devel/gcc/files/gcc-4.7.4-secure-plt.patch
new file mode 100644
index 0000000..6277824
--- /dev/null
+++ b/sys-devel/gcc/files/gcc-4.7.4-secure-plt.patch
@@ -0,0 +1,37 @@
+adapted from musl-cross gcc-patches
+diff -r 6097333f2ab4 gcc/config/rs6000/secureplt.h
+--- a/gcc/config/rs6000/secureplt.h    Tue May 20 11:06:08 2014 -0400
++++ b/gcc/config/rs6000/secureplt.h    Tue May 20 11:06:11 2014 -0400
+@@ -18,3 +18,4 @@
+ <http://www.gnu.org/licenses/>.  */
+ 
+ #define CC1_SECURE_PLT_DEFAULT_SPEC "-msecure-plt"
++#define LINK_SECURE_PLT_DEFAULT_SPEC "--secure-plt"
+--- a/gcc/config/rs6000/sysv4.h        2012-04-30 19:39:01.000000000 -0200
++++ b/gcc/config/rs6000/sysv4.h        2014-10-21 10:24:03.631956578 -0200
+@@ -537,6 +537,9 @@
+     }                                         \
+   while (0)
+ #endif
++#ifndef LINK_SECURE_PLT_DEFAULT_SPEC
++#define LINK_SECURE_PLT_DEFAULT_SPEC ""
++#endif
+ 
+ #undef        ASM_SPEC
+ #define       ASM_SPEC "%(asm_cpu) \
+@@ -624,6 +627,7 @@
+ /* Override the default target of the linker.  */
+ #define       LINK_TARGET_SPEC "\
+ %{mlittle: --oformat elf32-powerpcle } %{mlittle-endian: --oformat 
elf32-powerpcle } \
++%{!mbss-plt: %{!msecure-plt: %(link_secure_plt_default)}} \
+ %{!mlittle: %{!mlittle-endian: %{!mbig: %{!mbig-endian: \
+     %{mcall-i960-old: --oformat elf32-powerpcle} \
+   }}}}"
+@@ -938,6 +942,7 @@
+   { "cc1_endian_little",      CC1_ENDIAN_LITTLE_SPEC },               \
+   { "cc1_endian_default",     CC1_ENDIAN_DEFAULT_SPEC },              \
+   { "cc1_secure_plt_default", CC1_SECURE_PLT_DEFAULT_SPEC },          \
++  { "link_secure_plt_default",        LINK_SECURE_PLT_DEFAULT_SPEC },         
\
+   { "cpp_os_ads",             CPP_OS_ADS_SPEC },                      \
+   { "cpp_os_yellowknife",     CPP_OS_YELLOWKNIFE_SPEC },              \
+   { "cpp_os_mvme",            CPP_OS_MVME_SPEC },                     \

diff --git a/sys-devel/gcc/files/gcc-4.8.3-musl-linker-path.patch 
b/sys-devel/gcc/files/gcc-4.8.3-musl-linker-path.patch
new file mode 100644
index 0000000..0f3d96c
--- /dev/null
+++ b/sys-devel/gcc/files/gcc-4.8.3-musl-linker-path.patch
@@ -0,0 +1,65 @@
+diff -ur a/gcc-4.8.3/gcc/config/arm/linux-eabi.h 
b/gcc-4.8.3/gcc/config/arm/linux-eabi.h
+--- a/gcc-4.8.3/gcc/config/arm/linux-eabi.h    2013-01-10 21:38:27.000000000 
-0100
++++ b/gcc-4.8.3/gcc/config/arm/linux-eabi.h    2014-11-03 20:04:06.126283403 
-0100
+@@ -68,8 +68,8 @@
+    GLIBC_DYNAMIC_LINKER_DEFAULT and TARGET_DEFAULT_FLOAT_ABI.  */
+ 
+ #undef  GLIBC_DYNAMIC_LINKER
+-#define GLIBC_DYNAMIC_LINKER_SOFT_FLOAT "/lib/ld-linux.so.3"
+-#define GLIBC_DYNAMIC_LINKER_HARD_FLOAT "/lib/ld-linux-armhf.so.3"
++#define GLIBC_DYNAMIC_LINKER_SOFT_FLOAT "/lib/ld-musl-arm.so.1"
++#define GLIBC_DYNAMIC_LINKER_HARD_FLOAT "/lib/ld-musl-armhf.so.1"
+ #define GLIBC_DYNAMIC_LINKER_DEFAULT GLIBC_DYNAMIC_LINKER_SOFT_FLOAT
+ 
+ #define GLIBC_DYNAMIC_LINKER \
+diff -ur a/gcc-4.8.3/gcc/config/i386/linux64.h 
b/gcc-4.8.3/gcc/config/i386/linux64.h
+--- a/gcc-4.8.3/gcc/config/i386/linux64.h      2013-01-10 21:38:27.000000000 
-0100
++++ b/gcc-4.8.3/gcc/config/i386/linux64.h      2014-11-03 20:04:06.126283403 
-0100
+@@ -27,6 +27,6 @@
+ #define GNU_USER_LINK_EMULATION64 "elf_x86_64"
+ #define GNU_USER_LINK_EMULATIONX32 "elf32_x86_64"
+ 
+-#define GLIBC_DYNAMIC_LINKER32 "/lib/ld-linux.so.2"
+-#define GLIBC_DYNAMIC_LINKER64 "/lib64/ld-linux-x86-64.so.2"
++#define GLIBC_DYNAMIC_LINKER32 "/lib/ld-musl-i386.so.1"
++#define GLIBC_DYNAMIC_LINKER64 "/lib/ld-musl-x86_64.so.1"
+ #define GLIBC_DYNAMIC_LINKERX32 "/libx32/ld-linux-x32.so.2"
+diff -ur a/gcc-4.8.3/gcc/config/mips/linux.h 
b/gcc-4.8.3/gcc/config/mips/linux.h
+--- a/gcc-4.8.3/gcc/config/mips/linux.h        2013-01-10 21:38:27.000000000 
-0100
++++ b/gcc-4.8.3/gcc/config/mips/linux.h        2014-11-03 20:04:06.126283403 
-0100
+@@ -17,4 +17,4 @@
+ along with GCC; see the file COPYING3.  If not see
+ <http://www.gnu.org/licenses/>.  */
+ 
+-#define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
++#define GLIBC_DYNAMIC_LINKER "/lib/ld-musl-mipsel.so.1"
+diff -ur a/gcc-4.8.3/gcc/config/rs6000/linux64.h 
b/gcc-4.8.3/gcc/config/rs6000/linux64.h
+--- a/gcc-4.8.3/gcc/config/rs6000/linux64.h    2014-04-04 16:10:24.000000000 
-0100
++++ b/gcc-4.8.3/gcc/config/rs6000/linux64.h    2014-11-03 20:06:28.219506993 
-0100
+@@ -366,12 +366,8 @@
+ #undef        LINK_OS_DEFAULT_SPEC
+ #define LINK_OS_DEFAULT_SPEC "%(link_os_linux)"
+ 
+-#define GLIBC_DYNAMIC_LINKER32 "/lib/ld.so.1"
+-#ifdef LINUX64_DEFAULT_ABI_ELFv2
+-#define GLIBC_DYNAMIC_LINKER64 
"%{mabi=elfv1:/lib64/ld64.so.1;:/lib64/ld64.so.2}"
+-#else
+-#define GLIBC_DYNAMIC_LINKER64 
"%{mabi=elfv2:/lib64/ld64.so.2;:/lib64/ld64.so.1}"
+-#endif
++#define GLIBC_DYNAMIC_LINKER32 "/lib/ld-musl-powerpc.so.1"
++#define GLIBC_DYNAMIC_LINKER64 "/lib/ld-musl-powerpc64.so.1"
+ #define UCLIBC_DYNAMIC_LINKER32 "/lib/ld-uClibc.so.0"
+ #define UCLIBC_DYNAMIC_LINKER64 "/lib/ld64-uClibc.so.0"
+ #if DEFAULT_LIBC == LIBC_UCLIBC
+diff -ur a/gcc-4.8.3/gcc/config/rs6000/sysv4.h 
b/gcc-4.8.3/gcc/config/rs6000/sysv4.h
+--- a/gcc-4.8.3/gcc/config/rs6000/sysv4.h      2014-04-04 15:50:31.000000000 
-0100
++++ b/gcc-4.8.3/gcc/config/rs6000/sysv4.h      2014-11-03 20:04:06.128283378 
-0100
+@@ -761,7 +761,7 @@
+ 
+ #define LINK_START_LINUX_SPEC ""
+ 
+-#define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
++#define GLIBC_DYNAMIC_LINKER "/lib/ld-musl-powerpc.so.1"
+ #define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
+ #if DEFAULT_LIBC == LIBC_UCLIBC
+ #define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"

diff --git a/sys-devel/gcc/files/gcc-4.8.3-secure-plt.patch 
b/sys-devel/gcc/files/gcc-4.8.3-secure-plt.patch
new file mode 100644
index 0000000..fc367ae
--- /dev/null
+++ b/sys-devel/gcc/files/gcc-4.8.3-secure-plt.patch
@@ -0,0 +1,43 @@
+diff -ur a/gcc-4.8.3/gcc/config/rs6000/secureplt.h 
b/gcc-4.8.3/gcc/config/rs6000/secureplt.h
+--- a/gcc-4.8.3/gcc/config/rs6000/secureplt.h  2013-01-10 21:38:27.000000000 
-0100
++++ b/gcc-4.8.3/gcc/config/rs6000/secureplt.h  2014-11-03 20:41:01.696584962 
-0100
+@@ -18,3 +18,4 @@
+ <http://www.gnu.org/licenses/>.  */
+ 
+ #define CC1_SECURE_PLT_DEFAULT_SPEC "-msecure-plt"
++#define LINK_SECURE_PLT_DEFAULT_SPEC "--secure-plt"
+diff -ur a/gcc-4.8.3/gcc/config/rs6000/sysv4.h 
b/gcc-4.8.3/gcc/config/rs6000/sysv4.h
+--- a/gcc-4.8.3/gcc/config/rs6000/sysv4.h      2014-04-04 15:50:31.000000000 
-0100
++++ b/gcc-4.8.3/gcc/config/rs6000/sysv4.h      2014-11-03 20:42:30.098479787 
-0100
+@@ -585,7 +585,8 @@
+ 
+ /* Override the default target of the linker.  */
+ #define       LINK_TARGET_SPEC \
+-  ENDIAN_SELECT("", " --oformat elf32-powerpcle", "")
++  ENDIAN_SELECT("", " --oformat elf32-powerpcle", "") \
++  "%{!mbss-plt: %{!msecure-plt: %(link_secure_plt_default)}}"
+ 
+ /* Any specific OS flags.  */
+ #define LINK_OS_SPEC "\
+@@ -894,6 +895,7 @@
+   { "link_os_openbsd",                LINK_OS_OPENBSD_SPEC },                 
\
+   { "link_os_default",                LINK_OS_DEFAULT_SPEC },                 
\
+   { "cc1_secure_plt_default", CC1_SECURE_PLT_DEFAULT_SPEC },          \
++  { "link_secure_plt_default",        LINK_SECURE_PLT_DEFAULT_SPEC },         
\
+   { "cpp_os_ads",             CPP_OS_ADS_SPEC },                      \
+   { "cpp_os_yellowknife",     CPP_OS_YELLOWKNIFE_SPEC },              \
+   { "cpp_os_mvme",            CPP_OS_MVME_SPEC },                     \
+diff -ur a/gcc-4.8.3/gcc/config.gcc b/gcc-4.8.3/gcc/config.gcc
+--- a/gcc-4.8.3/gcc/config.gcc 2014-05-06 16:29:04.000000000 -0100
++++ b/gcc-4.8.3/gcc/config.gcc 2014-11-03 20:40:13.135192063 -0100
+@@ -2135,6 +2135,10 @@
+           powerpc*-*-linux*paired*)
+               tm_file="${tm_file} rs6000/750cl.h" ;;
+       esac
++      case ${target} in
++          *-linux*-musl*)
++              enable_secureplt=yes ;;
++      esac
+       if test x${enable_secureplt} = xyes; then
+               tm_file="rs6000/secureplt.h ${tm_file}"
+       fi

diff --git a/sys-devel/gcc/gcc-4.7.4-r99.ebuild 
b/sys-devel/gcc/gcc-4.7.4-r99.ebuild
index 52f95bb..e2735a5 100644
--- a/sys-devel/gcc/gcc-4.7.4-r99.ebuild
+++ b/sys-devel/gcc/gcc-4.7.4-r99.ebuild
@@ -53,6 +53,8 @@ src_prepare() {
                mv libitm/config/linux/x86 libitm/config/linux/x86_glibc
                cp -r libitm/config/generic libitm/config/linux/x86
                epatch "${FILESDIR}"/${PN}-4.7.3-musl-linker-path.patch
+               epatch "${FILESDIR}"/${PN}-4.7.3-powerpc-libc-stack-end.patch
+               epatch "${FILESDIR}"/${PN}-4.7.4-secure-plt.patch
        fi
 
        use vanilla && return 0

diff --git a/sys-devel/gcc/gcc-4.8.3-r99.ebuild 
b/sys-devel/gcc/gcc-4.8.3-r99.ebuild
index 43e2ecf..99f7990 100644
--- a/sys-devel/gcc/gcc-4.8.3-r99.ebuild
+++ b/sys-devel/gcc/gcc-4.8.3-r99.ebuild
@@ -52,7 +52,8 @@ src_prepare() {
                cp libstdc++-v3/config/os/gnu-linux.org/arm-eabi-extra.ver 
libstdc++-v3/config/os/gnu-linux/
                mv libitm/config/linux/x86 libitm/config/linux/x86_glibc
                cp -r libitm/config/generic libitm/config/linux/x86
-               epatch "${FILESDIR}"/${PN}-4.7.3-musl-linker-path.patch
+               epatch "${FILESDIR}"/${PN}-4.8.3-musl-linker-path.patch
+               epatch "${FILESDIR}"/${PN}-4.8.3-secure-plt.patch
                epatch "${FILESDIR}"/${PN}-4.8.3-musl-res_state.patch
                epatch "${FILESDIR}"/${PN}-4.8.3-musl-fix-libc5-assumption.patch
        fi

Reply via email to