diff mbox series

libgcc, i386: Add .note.GNU-stack sections to the ms sse/avx sav/res

Message ID 20210127092639.GO4020736@tucnak
State New
Headers show
Series libgcc, i386: Add .note.GNU-stack sections to the ms sse/avx sav/res | expand

Commit Message

Jakub Jelinek Jan. 27, 2021, 9:26 a.m. UTC
Hi!

On Linux, GCC emits .note.GNU-stack sections when compiling code to mark
the code as not needing or needing executable stack, missing section means
unknown.  But assembly files need to be marked manually.  We already
mark various *.S files in libgcc manually, but the
avx_resms64f.o
avx_resms64fx.o
avx_resms64.o
avx_resms64x.o
avx_savms64f.o
avx_savms64.o
sse_resms64f.o
sse_resms64fx.o
sse_resms64.o
sse_resms64x.o
sse_savms64f.o
sse_savms64.o
files aren't marked, so when something links it in, it will require
executable stack.  Nothing in the assembly requires executable stack though.

Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for
trunk?

2021-01-27  Jakub Jelinek  <jakub@redhat.com>

	* config/i386/savms64.h: Add .note.GNU-stack section on Linux.
	* config/i386/savms64f.h: Likewise.
	* config/i386/resms64.h: Likewise.
	* config/i386/resms64f.h: Likewise.
	* config/i386/resms64x.h: Likewise.
	* config/i386/resms64fx.h: Likewise.


	Jakub

Comments

Uros Bizjak Jan. 27, 2021, 10:08 a.m. UTC | #1
On Wed, Jan 27, 2021 at 10:26 AM Jakub Jelinek <jakub@redhat.com> wrote:
>
> Hi!
>
> On Linux, GCC emits .note.GNU-stack sections when compiling code to mark
> the code as not needing or needing executable stack, missing section means
> unknown.  But assembly files need to be marked manually.  We already
> mark various *.S files in libgcc manually, but the
> avx_resms64f.o
> avx_resms64fx.o
> avx_resms64.o
> avx_resms64x.o
> avx_savms64f.o
> avx_savms64.o
> sse_resms64f.o
> sse_resms64fx.o
> sse_resms64.o
> sse_resms64x.o
> sse_savms64f.o
> sse_savms64.o
> files aren't marked, so when something links it in, it will require
> executable stack.  Nothing in the assembly requires executable stack though.
>
> Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for
> trunk?
>
> 2021-01-27  Jakub Jelinek  <jakub@redhat.com>
>
>         * config/i386/savms64.h: Add .note.GNU-stack section on Linux.
>         * config/i386/savms64f.h: Likewise.
>         * config/i386/resms64.h: Likewise.
>         * config/i386/resms64f.h: Likewise.
>         * config/i386/resms64x.h: Likewise.
>         * config/i386/resms64fx.h: Likewise.

LGTM.

Thanks,
Uros.

>
> --- libgcc/config/i386/savms64.h.jj     2021-01-04 10:25:53.912063080 +0100
> +++ libgcc/config/i386/savms64.h        2021-01-26 19:22:12.371719078 +0100
> @@ -57,3 +57,8 @@ MS2SYSV_STUB_END(savms64_17)
>  MS2SYSV_STUB_END(savms64_18)
>
>  #endif /* __x86_64__ */
> +
> +#if defined(__ELF__) && defined(__linux__)
> +       .section .note.GNU-stack,"",@progbits
> +       .previous
> +#endif
> --- libgcc/config/i386/savms64f.h.jj    2021-01-04 10:25:53.906063148 +0100
> +++ libgcc/config/i386/savms64f.h       2021-01-26 19:22:18.064654821 +0100
> @@ -55,3 +55,8 @@ MS2SYSV_STUB_END(savms64f_16)
>  MS2SYSV_STUB_END(savms64f_17)
>
>  #endif /* __x86_64__ */
> +
> +#if defined(__ELF__) && defined(__linux__)
> +       .section .note.GNU-stack,"",@progbits
> +       .previous
> +#endif
> --- libgcc/config/i386/resms64.h.jj     2021-01-04 10:25:53.904063171 +0100
> +++ libgcc/config/i386/resms64.h        2021-01-26 19:21:45.486022557 +0100
> @@ -57,3 +57,8 @@ MS2SYSV_STUB_END(resms64_17)
>  MS2SYSV_STUB_END(resms64_18)
>
>  #endif /* __x86_64__ */
> +
> +#if defined(__ELF__) && defined(__linux__)
> +       .section .note.GNU-stack,"",@progbits
> +       .previous
> +#endif
> --- libgcc/config/i386/resms64f.h.jj    2021-01-04 10:25:53.910063103 +0100
> +++ libgcc/config/i386/resms64f.h       2021-01-26 19:21:54.024926172 +0100
> @@ -55,3 +55,8 @@ MS2SYSV_STUB_END(resms64f_16)
>  MS2SYSV_STUB_END(resms64f_17)
>
>  #endif /* __x86_64__ */
> +
> +#if defined(__ELF__) && defined(__linux__)
> +       .section .note.GNU-stack,"",@progbits
> +       .previous
> +#endif
> --- libgcc/config/i386/resms64x.h.jj    2021-01-04 10:25:53.901063205 +0100
> +++ libgcc/config/i386/resms64x.h       2021-01-26 19:22:07.017779514 +0100
> @@ -63,3 +63,8 @@ MS2SYSV_STUB_END(resms64x_17)
>  MS2SYSV_STUB_END(resms64x_18)
>
>  #endif /* __x86_64__ */
> +
> +#if defined(__ELF__) && defined(__linux__)
> +       .section .note.GNU-stack,"",@progbits
> +       .previous
> +#endif
> --- libgcc/config/i386/resms64fx.h.jj   2021-01-04 10:25:53.901063205 +0100
> +++ libgcc/config/i386/resms64fx.h      2021-01-26 19:22:00.943848074 +0100
> @@ -62,3 +62,8 @@ MS2SYSV_STUB_END(resms64fx_16)
>  MS2SYSV_STUB_END(resms64fx_17)
>
>  #endif /* __x86_64__ */
> +
> +#if defined(__ELF__) && defined(__linux__)
> +       .section .note.GNU-stack,"",@progbits
> +       .previous
> +#endif
>
>         Jakub
>
diff mbox series

Patch

--- libgcc/config/i386/savms64.h.jj	2021-01-04 10:25:53.912063080 +0100
+++ libgcc/config/i386/savms64.h	2021-01-26 19:22:12.371719078 +0100
@@ -57,3 +57,8 @@  MS2SYSV_STUB_END(savms64_17)
 MS2SYSV_STUB_END(savms64_18)
 
 #endif /* __x86_64__ */
+
+#if defined(__ELF__) && defined(__linux__)
+	.section .note.GNU-stack,"",@progbits
+	.previous
+#endif
--- libgcc/config/i386/savms64f.h.jj	2021-01-04 10:25:53.906063148 +0100
+++ libgcc/config/i386/savms64f.h	2021-01-26 19:22:18.064654821 +0100
@@ -55,3 +55,8 @@  MS2SYSV_STUB_END(savms64f_16)
 MS2SYSV_STUB_END(savms64f_17)
 
 #endif /* __x86_64__ */
+
+#if defined(__ELF__) && defined(__linux__)
+	.section .note.GNU-stack,"",@progbits
+	.previous
+#endif
--- libgcc/config/i386/resms64.h.jj	2021-01-04 10:25:53.904063171 +0100
+++ libgcc/config/i386/resms64.h	2021-01-26 19:21:45.486022557 +0100
@@ -57,3 +57,8 @@  MS2SYSV_STUB_END(resms64_17)
 MS2SYSV_STUB_END(resms64_18)
 
 #endif /* __x86_64__ */
+
+#if defined(__ELF__) && defined(__linux__)
+	.section .note.GNU-stack,"",@progbits
+	.previous
+#endif
--- libgcc/config/i386/resms64f.h.jj	2021-01-04 10:25:53.910063103 +0100
+++ libgcc/config/i386/resms64f.h	2021-01-26 19:21:54.024926172 +0100
@@ -55,3 +55,8 @@  MS2SYSV_STUB_END(resms64f_16)
 MS2SYSV_STUB_END(resms64f_17)
 
 #endif /* __x86_64__ */
+
+#if defined(__ELF__) && defined(__linux__)
+	.section .note.GNU-stack,"",@progbits
+	.previous
+#endif
--- libgcc/config/i386/resms64x.h.jj	2021-01-04 10:25:53.901063205 +0100
+++ libgcc/config/i386/resms64x.h	2021-01-26 19:22:07.017779514 +0100
@@ -63,3 +63,8 @@  MS2SYSV_STUB_END(resms64x_17)
 MS2SYSV_STUB_END(resms64x_18)
 
 #endif /* __x86_64__ */
+
+#if defined(__ELF__) && defined(__linux__)
+	.section .note.GNU-stack,"",@progbits
+	.previous
+#endif
--- libgcc/config/i386/resms64fx.h.jj	2021-01-04 10:25:53.901063205 +0100
+++ libgcc/config/i386/resms64fx.h	2021-01-26 19:22:00.943848074 +0100
@@ -62,3 +62,8 @@  MS2SYSV_STUB_END(resms64fx_16)
 MS2SYSV_STUB_END(resms64fx_17)
 
 #endif /* __x86_64__ */
+
+#if defined(__ELF__) && defined(__linux__)
+	.section .note.GNU-stack,"",@progbits
+	.previous
+#endif