musl-ppc.patch 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. diff -Nur gcc-4.7.3.orig/libgcc/config/rs6000/linux-unwind.h gcc-4.7.3/libgcc/config/rs6000/linux-unwind.h
  2. --- gcc-4.7.3.orig/libgcc/config/rs6000/linux-unwind.h 2011-11-12 18:20:58.000000000 +0100
  3. +++ gcc-4.7.3/libgcc/config/rs6000/linux-unwind.h 2013-09-15 18:29:20.000000000 +0200
  4. @@ -27,7 +27,6 @@
  5. #define R_CR2 70
  6. #define R_VR0 77
  7. #define R_VRSAVE 109
  8. -#define R_VSCR 110
  9. struct gcc_vregs
  10. {
  11. @@ -176,38 +175,6 @@
  12. }
  13. #endif
  14. -/* Find an entry in the process auxiliary vector. The canonical way to
  15. - test for VMX is to look at AT_HWCAP. */
  16. -
  17. -static long
  18. -ppc_linux_aux_vector (long which)
  19. -{
  20. - /* __libc_stack_end holds the original stack passed to a process. */
  21. - extern long *__libc_stack_end;
  22. - long argc;
  23. - char **argv;
  24. - char **envp;
  25. - struct auxv
  26. - {
  27. - long a_type;
  28. - long a_val;
  29. - } *auxp;
  30. -
  31. - /* The Linux kernel puts argc first on the stack. */
  32. - argc = __libc_stack_end[0];
  33. - /* Followed by argv, NULL terminated. */
  34. - argv = (char **) __libc_stack_end + 1;
  35. - /* Followed by environment string pointers, NULL terminated. */
  36. - envp = argv + argc + 1;
  37. - while (*envp++)
  38. - continue;
  39. - /* Followed by the aux vector, zero terminated. */
  40. - for (auxp = (struct auxv *) envp; auxp->a_type != 0; ++auxp)
  41. - if (auxp->a_type == which)
  42. - return auxp->a_val;
  43. - return 0;
  44. -}
  45. -
  46. /* Do code reading to identify a signal frame, and set the frame
  47. state data appropriately. See unwind-dw2.c for the structs. */
  48. @@ -217,8 +184,8 @@
  49. ppc_fallback_frame_state (struct _Unwind_Context *context,
  50. _Unwind_FrameState *fs)
  51. {
  52. - static long hwcap = 0;
  53. struct gcc_regs *regs = get_regs (context);
  54. + struct gcc_vregs *vregs;
  55. long new_cfa;
  56. int i;
  57. @@ -230,12 +197,15 @@
  58. fs->regs.cfa_reg = STACK_POINTER_REGNUM;
  59. fs->regs.cfa_offset = new_cfa - (long) context->cfa;
  60. - for (i = 0; i < 32; i++)
  61. - if (i != STACK_POINTER_REGNUM)
  62. - {
  63. - fs->regs.reg[i].how = REG_SAVED_OFFSET;
  64. - fs->regs.reg[i].loc.offset = (long) &regs->gpr[i] - new_cfa;
  65. - }
  66. +#ifdef __powerpc64__
  67. + fs->regs.reg[2].how = REG_SAVED_OFFSET;
  68. + fs->regs.reg[2].loc.offset = (long) &regs->gpr[2] - new_cfa;
  69. +#endif
  70. + for (i = 14; i < 32; i++)
  71. + {
  72. + fs->regs.reg[i].how = REG_SAVED_OFFSET;
  73. + fs->regs.reg[i].loc.offset = (long) &regs->gpr[i] - new_cfa;
  74. + }
  75. fs->regs.reg[R_CR2].how = REG_SAVED_OFFSET;
  76. /* CR? regs are always 32-bit and PPC is big-endian, so in 64-bit
  77. @@ -251,57 +221,35 @@
  78. fs->retaddr_column = ARG_POINTER_REGNUM;
  79. fs->signal_frame = 1;
  80. - if (hwcap == 0)
  81. + /* If we have a FPU... */
  82. + for (i = 14; i < 32; i++)
  83. {
  84. - hwcap = ppc_linux_aux_vector (16);
  85. - /* These will already be set if we found AT_HWCAP. A nonzero
  86. - value stops us looking again if for some reason we couldn't
  87. - find AT_HWCAP. */
  88. -#ifdef __powerpc64__
  89. - hwcap |= 0xc0000000;
  90. -#else
  91. - hwcap |= 0x80000000;
  92. -#endif
  93. + fs->regs.reg[i + 32].how = REG_SAVED_OFFSET;
  94. + fs->regs.reg[i + 32].loc.offset = (long) &regs->fpr[i] - new_cfa;
  95. }
  96. - /* If we have a FPU... */
  97. - if (hwcap & 0x08000000)
  98. - for (i = 0; i < 32; i++)
  99. - {
  100. - fs->regs.reg[i + 32].how = REG_SAVED_OFFSET;
  101. - fs->regs.reg[i + 32].loc.offset = (long) &regs->fpr[i] - new_cfa;
  102. - }
  103. -
  104. /* If we have a VMX unit... */
  105. - if (hwcap & 0x10000000)
  106. - {
  107. - struct gcc_vregs *vregs;
  108. #ifdef __powerpc64__
  109. - vregs = regs->vp;
  110. + vregs = regs->vp;
  111. #else
  112. - vregs = &regs->vregs;
  113. + vregs = &regs->vregs;
  114. #endif
  115. - if (regs->msr & (1 << 25))
  116. + if (regs->msr & (1 << 25))
  117. + {
  118. + for (i = 20; i < 32; i++)
  119. {
  120. - for (i = 0; i < 32; i++)
  121. - {
  122. - fs->regs.reg[i + R_VR0].how = REG_SAVED_OFFSET;
  123. - fs->regs.reg[i + R_VR0].loc.offset
  124. - = (long) &vregs->vr[i] - new_cfa;
  125. - }
  126. -
  127. - fs->regs.reg[R_VSCR].how = REG_SAVED_OFFSET;
  128. - fs->regs.reg[R_VSCR].loc.offset = (long) &vregs->vscr - new_cfa;
  129. + fs->regs.reg[i + R_VR0].how = REG_SAVED_OFFSET;
  130. + fs->regs.reg[i + R_VR0].loc.offset = (long) &vregs->vr[i] - new_cfa;
  131. }
  132. -
  133. - fs->regs.reg[R_VRSAVE].how = REG_SAVED_OFFSET;
  134. - fs->regs.reg[R_VRSAVE].loc.offset = (long) &vregs->vsave - new_cfa;
  135. }
  136. + fs->regs.reg[R_VRSAVE].how = REG_SAVED_OFFSET;
  137. + fs->regs.reg[R_VRSAVE].loc.offset = (long) &vregs->vsave - new_cfa;
  138. +
  139. /* If we have SPE register high-parts... we check at compile-time to
  140. avoid expanding the code for all other PowerPC. */
  141. #ifdef __SPE__
  142. - for (i = 0; i < 32; i++)
  143. + for (i = 14; i < 32; i++)
  144. {
  145. fs->regs.reg[i + FIRST_PSEUDO_REGISTER - 1].how = REG_SAVED_OFFSET;
  146. fs->regs.reg[i + FIRST_PSEUDO_REGISTER - 1].loc.offset