From 686b1cdfdc46a476056fe4df6e8186be8c889aca Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Wed, 27 Jan 2021 11:49:23 +0100 Subject: [PATCH] libgcc, i386: Add .note.GNU-stack sections to the ms sse/avx sav/res 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. 2021-01-27 Jakub Jelinek * 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. --- libgcc/config/i386/resms64.h | 5 +++++ libgcc/config/i386/resms64f.h | 5 +++++ libgcc/config/i386/resms64fx.h | 5 +++++ libgcc/config/i386/resms64x.h | 5 +++++ libgcc/config/i386/savms64.h | 5 +++++ libgcc/config/i386/savms64f.h | 5 +++++ 6 files changed, 30 insertions(+) diff --git a/libgcc/config/i386/resms64.h b/libgcc/config/i386/resms64.h index f56c85c10b20..71f04b380e5e 100644 --- a/libgcc/config/i386/resms64.h +++ b/libgcc/config/i386/resms64.h @@ -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 diff --git a/libgcc/config/i386/resms64f.h b/libgcc/config/i386/resms64f.h index 99b6f9a8fafc..004f7978f193 100644 --- a/libgcc/config/i386/resms64f.h +++ b/libgcc/config/i386/resms64f.h @@ -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 diff --git a/libgcc/config/i386/resms64fx.h b/libgcc/config/i386/resms64fx.h index e46425762052..6dc0019a7842 100644 --- a/libgcc/config/i386/resms64fx.h +++ b/libgcc/config/i386/resms64fx.h @@ -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 diff --git a/libgcc/config/i386/resms64x.h b/libgcc/config/i386/resms64x.h index 73d83e6a79e1..fa32093f2140 100644 --- a/libgcc/config/i386/resms64x.h +++ b/libgcc/config/i386/resms64x.h @@ -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 diff --git a/libgcc/config/i386/savms64.h b/libgcc/config/i386/savms64.h index b6c91d5df712..885880060aee 100644 --- a/libgcc/config/i386/savms64.h +++ b/libgcc/config/i386/savms64.h @@ -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 diff --git a/libgcc/config/i386/savms64f.h b/libgcc/config/i386/savms64f.h index 605dbc048278..9c80bb802471 100644 --- a/libgcc/config/i386/savms64f.h +++ b/libgcc/config/i386/savms64f.h @@ -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 -- 2.47.2