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