diff options
author | Joseph Myers <joseph@codesourcery.com> | 2017-09-26 17:35:53 +0100 |
---|---|---|
committer | Joseph Myers <jsm28@gcc.gnu.org> | 2017-09-26 17:35:53 +0100 |
commit | 938b6f1e5d31c8c3ef4dd1dd4d6b65b3f53ad07d (patch) | |
tree | ee16574d02eab6903c55199d5f7d94c9e4221315 /libgcc | |
parent | ca617fd2144dd58a2d26887239e86e5b32eba87c (diff) | |
download | gcc-938b6f1e5d31c8c3ef4dd1dd4d6b65b3f53ad07d.zip gcc-938b6f1e5d31c8c3ef4dd1dd4d6b65b3f53ad07d.tar.gz gcc-938b6f1e5d31c8c3ef4dd1dd4d6b65b3f53ad07d.tar.bz2 |
Enable no-exec stacks for more targets using the Linux kernel.
Building glibc for many different configurations and running the
compilation parts of the testsuite runs into failures of the
elf/check-execstack test for hppa and microblaze. Those
configurations default to executable stacks in the Linux kernel
because of VM_DATA_DEFAULT_FLAGS definitions including VM_EXEC
(VM_DATA_DEFAULT_FLAGS being the default definition of
VM_STACK_DEFAULT_FLAGS).
This fails because those configurations are not generating
.note.GNU-stack sections to indicate that programs do not need an
executable stack. This patch fixes GCC to generate those sections on
those architectures (when configured for a target using the Linux
kernel), as it does on other architectures, together with adding that
section to libgcc .S sources, with the same code as used on other
architectures (or a variant using "#ifdef __linux__" instead of the
usual "#if defined(__ELF__) && defined(__linux__)" for microblaze, as
that configuration doesn't use elfos.h and so doesn't define __ELF__).
This suffices to eliminate that glibc test failure. (For hppa, the
compilation parts of the glibc testsuite still fail because of the
separate elf/check-textrel failure.)
gcc:
* config/microblaze/linux.h (TARGET_ASM_FILE_END): Likewise.
* config/pa/pa.h (NEED_INDICATE_EXEC_STACK): Likewise.
* config/pa/pa-linux.h (NEED_INDICATE_EXEC_STACK): Likewise.
* config/pa/pa.c (pa_hpux_file_end): Rename to pa_file_end.
Define unconditionally, with [ASM_OUTPUT_EXTERNAL_REAL]
conditionals inside the function instead of around it. Call
file_end_indicate_exec_stack if NEED_INDICATE_EXEC_STACK.
(TARGET_ASM_FILE_END): Define unconditionally to pa_file_end.
libgcc:
* config/microblaze/crti.S, config/microblaze/crtn.S,
config/microblaze/divsi3.S, config/microblaze/moddi3.S,
config/microblaze/modsi3.S, config/microblaze/muldi3_hard.S,
config/microblaze/mulsi3.S,
config/microblaze/stack_overflow_exit.S,
config/microblaze/udivsi3.S, config/microblaze/umodsi3.S,
config/pa/milli64.S: Add .note.GNU-stack section.
From-SVN: r253204
Diffstat (limited to 'libgcc')
-rw-r--r-- | libgcc/ChangeLog | 10 | ||||
-rw-r--r-- | libgcc/config/microblaze/crti.S | 6 | ||||
-rw-r--r-- | libgcc/config/microblaze/crtn.S | 6 | ||||
-rw-r--r-- | libgcc/config/microblaze/divsi3.S | 6 | ||||
-rw-r--r-- | libgcc/config/microblaze/moddi3.S | 6 | ||||
-rw-r--r-- | libgcc/config/microblaze/modsi3.S | 6 | ||||
-rw-r--r-- | libgcc/config/microblaze/muldi3_hard.S | 6 | ||||
-rw-r--r-- | libgcc/config/microblaze/mulsi3.S | 6 | ||||
-rw-r--r-- | libgcc/config/microblaze/stack_overflow_exit.S | 6 | ||||
-rw-r--r-- | libgcc/config/microblaze/udivsi3.S | 6 | ||||
-rw-r--r-- | libgcc/config/microblaze/umodsi3.S | 6 | ||||
-rw-r--r-- | libgcc/config/pa/milli64.S | 6 |
12 files changed, 76 insertions, 0 deletions
diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog index 90c07fe..6840147 100644 --- a/libgcc/ChangeLog +++ b/libgcc/ChangeLog @@ -1,3 +1,13 @@ +2017-09-26 Joseph Myers <joseph@codesourcery.com> + + * config/microblaze/crti.S, config/microblaze/crtn.S, + config/microblaze/divsi3.S, config/microblaze/moddi3.S, + config/microblaze/modsi3.S, config/microblaze/muldi3_hard.S, + config/microblaze/mulsi3.S, + config/microblaze/stack_overflow_exit.S, + config/microblaze/udivsi3.S, config/microblaze/umodsi3.S, + config/pa/milli64.S: Add .note.GNU-stack section. + 2017-09-23 Daniel Santos <daniel.santos@pobox.com> * configure.ac: Add Check for HAVE_AS_AVX. diff --git a/libgcc/config/microblaze/crti.S b/libgcc/config/microblaze/crti.S index 61626e2..7356163 100644 --- a/libgcc/config/microblaze/crti.S +++ b/libgcc/config/microblaze/crti.S @@ -24,6 +24,12 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see <http://www.gnu.org/licenses/>. */ +/* An executable stack is *not* required for these functions. */ +#ifdef __linux__ +.section .note.GNU-stack,"",%progbits +.previous +#endif + .section .init, "ax" .global __init diff --git a/libgcc/config/microblaze/crtn.S b/libgcc/config/microblaze/crtn.S index 3b9bf7e..c784ed4 100644 --- a/libgcc/config/microblaze/crtn.S +++ b/libgcc/config/microblaze/crtn.S @@ -24,6 +24,12 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see <http://www.gnu.org/licenses/>. */ +/* An executable stack is *not* required for these functions. */ +#ifdef __linux__ +.section .note.GNU-stack,"",%progbits +.previous +#endif + .section .init, "ax" lw r15, r0, r1 rtsd r15, 8 diff --git a/libgcc/config/microblaze/divsi3.S b/libgcc/config/microblaze/divsi3.S index 42f9cb2..0cd14b3 100644 --- a/libgcc/config/microblaze/divsi3.S +++ b/libgcc/config/microblaze/divsi3.S @@ -32,6 +32,12 @@ # ####################################### +/* An executable stack is *not* required for these functions. */ +#ifdef __linux__ +.section .note.GNU-stack,"",%progbits +.previous +#endif + .globl __divsi3 .ent __divsi3 .type __divsi3,@function diff --git a/libgcc/config/microblaze/moddi3.S b/libgcc/config/microblaze/moddi3.S index bcea079..7d2a31d 100644 --- a/libgcc/config/microblaze/moddi3.S +++ b/libgcc/config/microblaze/moddi3.S @@ -30,6 +30,12 @@ ####################################### +/* An executable stack is *not* required for these functions. */ +#ifdef __linux__ +.section .note.GNU-stack,"",%progbits +.previous +#endif + .globl __moddi3 .ent __moddi3 __moddi3: diff --git a/libgcc/config/microblaze/modsi3.S b/libgcc/config/microblaze/modsi3.S index eb671a1..118b18d 100644 --- a/libgcc/config/microblaze/modsi3.S +++ b/libgcc/config/microblaze/modsi3.S @@ -32,6 +32,12 @@ # ####################################### +/* An executable stack is *not* required for these functions. */ +#ifdef __linux__ +.section .note.GNU-stack,"",%progbits +.previous +#endif + .globl __modsi3 .ent __modsi3 .type __modsi3,@function diff --git a/libgcc/config/microblaze/muldi3_hard.S b/libgcc/config/microblaze/muldi3_hard.S index f2188c6..d9f1806 100644 --- a/libgcc/config/microblaze/muldi3_hard.S +++ b/libgcc/config/microblaze/muldi3_hard.S @@ -47,6 +47,12 @@ # ####################################### +/* An executable stack is *not* required for these functions. */ +#ifdef __linux__ +.section .note.GNU-stack,"",%progbits +.previous +#endif + .globl muldi3_hardproc .ent muldi3_hardproc muldi3_hardproc: diff --git a/libgcc/config/microblaze/mulsi3.S b/libgcc/config/microblaze/mulsi3.S index f126b56..3d33522 100644 --- a/libgcc/config/microblaze/mulsi3.S +++ b/libgcc/config/microblaze/mulsi3.S @@ -32,6 +32,12 @@ # ####################################### +/* An executable stack is *not* required for these functions. */ +#ifdef __linux__ +.section .note.GNU-stack,"",%progbits +.previous +#endif + .globl __mulsi3 .ent __mulsi3 .type __mulsi3,@function diff --git a/libgcc/config/microblaze/stack_overflow_exit.S b/libgcc/config/microblaze/stack_overflow_exit.S index 63319de..5f6be94 100644 --- a/libgcc/config/microblaze/stack_overflow_exit.S +++ b/libgcc/config/microblaze/stack_overflow_exit.S @@ -33,6 +33,12 @@ # ####################################### +/* An executable stack is *not* required for these functions. */ +#ifdef __linux__ +.section .note.GNU-stack,"",%progbits +.previous +#endif + .globl _stack_overflow_error .data .align 2 diff --git a/libgcc/config/microblaze/udivsi3.S b/libgcc/config/microblaze/udivsi3.S index 2e08fb2..f01c027 100644 --- a/libgcc/config/microblaze/udivsi3.S +++ b/libgcc/config/microblaze/udivsi3.S @@ -32,6 +32,12 @@ # ####################################### +/* An executable stack is *not* required for these functions. */ +#ifdef __linux__ +.section .note.GNU-stack,"",%progbits +.previous +#endif + .globl __udivsi3 .ent __udivsi3 .type __udivsi3,@function diff --git a/libgcc/config/microblaze/umodsi3.S b/libgcc/config/microblaze/umodsi3.S index b230a8c..a91eae7 100644 --- a/libgcc/config/microblaze/umodsi3.S +++ b/libgcc/config/microblaze/umodsi3.S @@ -32,6 +32,12 @@ # ####################################### +/* An executable stack is *not* required for these functions. */ +#ifdef __linux__ +.section .note.GNU-stack,"",%progbits +.previous +#endif + .globl __umodsi3 .ent __umodsi3 .type __umodsi3,@function diff --git a/libgcc/config/pa/milli64.S b/libgcc/config/pa/milli64.S index cfd4d83..4690dd1 100644 --- a/libgcc/config/pa/milli64.S +++ b/libgcc/config/pa/milli64.S @@ -25,6 +25,12 @@ a copy of the GCC Runtime Library Exception along with this program; see the files COPYING3 and COPYING.RUNTIME respectively. If not, see <http://www.gnu.org/licenses/>. */ +/* An executable stack is *not* required for these functions. */ +#if defined(__ELF__) && defined(__linux__) +.section .note.GNU-stack,"",%progbits +.previous +#endif + #ifdef pa64 .level 2.0w #endif |