1
0

930-fix-mips-noexecstack.patch 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. From da45b3fde60095756f5f6030f6012c23a3d34429 Mon Sep 17 00:00:00 2001
  2. From: Andrew McDonnell <bugs@andrewmcdonnell.net>
  3. Date: Fri, 3 Oct 2014 19:09:00 +0930
  4. Subject: Add .note.GNU-stack section
  5. See http://lists.busybox.net/pipermail/uclibc/2014-October/048671.html
  6. Below copied from https://gcc.gnu.org/ml/gcc-patches/2014-09/msg02430.html
  7. Re: [Patch, MIPS] Add .note.GNU-stack section
  8. From: Steve Ellcey <sellcey at mips dot com>
  9. On Wed, 2014-09-10 at 10:15 -0700, Eric Christopher wrote:
  10. >
  11. >
  12. > On Wed, Sep 10, 2014 at 9:27 AM, <pinskia@gmail.com> wrote:
  13. > This works except you did not update the assembly files in
  14. > libgcc or glibc. We (Cavium) have the same patch in our tree
  15. > for a few released versions.
  16. > Mind just checking yours in then Andrew?
  17. > Thanks!
  18. > -eric
  19. I talked to Andrew about what files he changed in GCC and created and
  20. tested this new patch. Andrew also mentioned changing some assembly
  21. files in glibc but I don't see any use of '.section .note.GNU-stack' in
  22. any assembly files in glibc (for any platform) so I wasn't planning on
  23. creating a glibc to add them to mips glibc assembly language files.
  24. OK to check in this patch?
  25. Steve Ellcey
  26. sellcey@mips.com
  27. 2014-09-26 Steve Ellcey <sellcey@mips.com>
  28. ---
  29. gcc/config/mips/mips.c | 3 +++
  30. libgcc/config/mips/crti.S | 4 ++++
  31. libgcc/config/mips/crtn.S | 3 +++
  32. libgcc/config/mips/mips16.S | 4 ++++
  33. libgcc/config/mips/vr4120-div.S | 4 ++++
  34. 5 files changed, 18 insertions(+)
  35. --- a/gcc/config/mips/mips.c
  36. +++ b/gcc/config/mips/mips.c
  37. @@ -19629,6 +19629,9 @@ mips_lra_p (void)
  38. #undef TARGET_LRA_P
  39. #define TARGET_LRA_P mips_lra_p
  40. +#undef TARGET_ASM_FILE_END
  41. +#define TARGET_ASM_FILE_END file_end_indicate_exec_stack
  42. +
  43. struct gcc_target targetm = TARGET_INITIALIZER;
  44. #include "gt-mips.h"
  45. --- a/libgcc/config/mips/crti.S
  46. +++ b/libgcc/config/mips/crti.S
  47. @@ -21,6 +21,10 @@ a copy of the GCC Runtime Library Except
  48. see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
  49. <http://www.gnu.org/licenses/>. */
  50. +
  51. +/* An executable stack is *not* required for these functions. */
  52. + .section .note.GNU-stack,"",%progbits
  53. +
  54. /* 4 slots for argument spill area. 1 for cpreturn, 1 for stack.
  55. Return spill offset of 40 and 20. Aligned to 16 bytes for n32. */
  56. --- a/libgcc/config/mips/crtn.S
  57. +++ b/libgcc/config/mips/crtn.S
  58. @@ -21,6 +21,9 @@ a copy of the GCC Runtime Library Except
  59. see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
  60. <http://www.gnu.org/licenses/>. */
  61. +/* An executable stack is *not* required for these functions. */
  62. + .section .note.GNU-stack,"",%progbits
  63. +
  64. /* 4 slots for argument spill area. 1 for cpreturn, 1 for stack.
  65. Return spill offset of 40 and 20. Aligned to 16 bytes for n32. */
  66. --- a/libgcc/config/mips/mips16.S
  67. +++ b/libgcc/config/mips/mips16.S
  68. @@ -48,6 +48,10 @@ see the files COPYING3 and COPYING.RUNTI
  69. values using the soft-float calling convention, but do the actual
  70. operation using the hard floating point instructions. */
  71. +/* An executable stack is *not* required for these functions. */
  72. + .section .note.GNU-stack,"",%progbits
  73. + .previous
  74. +
  75. #if defined _MIPS_SIM && (_MIPS_SIM == _ABIO32 || _MIPS_SIM == _ABIO64)
  76. /* This file contains 32-bit assembly code. */
  77. --- a/libgcc/config/mips/vr4120-div.S
  78. +++ b/libgcc/config/mips/vr4120-div.S
  79. @@ -26,6 +26,10 @@ see the files COPYING3 and COPYING.RUNTI
  80. -mfix-vr4120. div and ddiv do not give the correct result when one
  81. of the operands is negative. */
  82. +/* An executable stack is *not* required for these functions. */
  83. + .section .note.GNU-stack,"",%progbits
  84. + .previous
  85. +
  86. .set nomips16
  87. #define DIV \