]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
function.c (trampolines_created): New variable.
authorJakub Jelinek <jakub@redhat.com>
Wed, 4 Jun 2003 16:44:51 +0000 (18:44 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Wed, 4 Jun 2003 16:44:51 +0000 (18:44 +0200)
* function.c (trampolines_created): New variable.
(expand_function_end): Set it when doing INITIALIZE_TRAMPOLINE.
* function.h (trampolines_created): Add.
* config/s390/linux.h (ASM_FILE_END): Define.
* config/alpha/linux-elf.h (ASM_FILE_END): Define.
* config/m68k/linux.h (ASM_FILE_END): Define.
* config/rs6000/linux.h (ASM_FILE_END): Define.
* config/rs6000/linux64.h (ASM_FILE_END): Define.
* config/rs6000/ppc-asm.h: Add .note.GNU-stack on powerpc-linux.
* config/sparc/linux.h (ASM_FILE_END): Define.
* config/sparc/linux64.h (ASM_FILE_END): Define.
* config/i386/i386.c (ix86_asm_file_end): Use SUBTARGET_FILE_END.
* config/i386/linux.h (SUBTARGET_FILE_END): Define.
* config/i386/linux64.h (SUBTARGET_FILE_END): Define.

From-SVN: r67447

14 files changed:
gcc/ChangeLog
gcc/config/alpha/linux-elf.h
gcc/config/i386/i386.c
gcc/config/i386/linux.h
gcc/config/i386/linux64.h
gcc/config/m68k/linux.h
gcc/config/rs6000/linux.h
gcc/config/rs6000/linux64.h
gcc/config/rs6000/ppc-asm.h
gcc/config/s390/linux.h
gcc/config/sparc/linux.h
gcc/config/sparc/linux64.h
gcc/function.c
gcc/function.h

index 96a0ab80a70aea15392522e3df43004bffd1fcc0..6bb5c6af19b9e55db7a6a9eb976fe2cad18aa0f8 100644 (file)
@@ -1,3 +1,20 @@
+2003-06-04  Jakub Jelinek  <jakub@redhat.com>
+
+       * function.c (trampolines_created): New variable.
+       (expand_function_end): Set it when doing INITIALIZE_TRAMPOLINE.
+       * function.h (trampolines_created): Add.
+       * config/s390/linux.h (ASM_FILE_END): Define.
+       * config/alpha/linux-elf.h (ASM_FILE_END): Define.
+       * config/m68k/linux.h (ASM_FILE_END): Define.
+       * config/rs6000/linux.h (ASM_FILE_END): Define.
+       * config/rs6000/linux64.h (ASM_FILE_END): Define.
+       * config/rs6000/ppc-asm.h: Add .note.GNU-stack on powerpc-linux.
+       * config/sparc/linux.h (ASM_FILE_END): Define.
+       * config/sparc/linux64.h (ASM_FILE_END): Define.
+       * config/i386/i386.c (ix86_asm_file_end): Use SUBTARGET_FILE_END.
+       * config/i386/linux.h (SUBTARGET_FILE_END): Define.
+       * config/i386/linux64.h (SUBTARGET_FILE_END): Define.
+
 Wed Jun  4 18:39:33 CEST 2003  Jan Hubicka  <jh@suse.cz>
 
        * i386.c (min_insn_size, k8_avoid_jump_misspredicts): New functions
index be17dddab24c01ddfaa23e4e0afbe715644ac2a8..c7319f31ffeb604524b896f0a74969e522fa4eb3 100644 (file)
@@ -41,3 +41,10 @@ Boston, MA 02111-1307, USA.  */
 #undef LIB_SPEC
 #define LIB_SPEC \
 "%{pthread:-lpthread} %{shared:-lc}%{!shared:%{profile:-lc_p}%{!profile:-lc}} "
+
+#define ASM_FILE_END(FILE) \
+  do {                                                                 \
+    named_section_flags (".note.GNU-stack",                            \
+                        SECTION_DEBUG                                  \
+                        | (trampolines_created ? SECTION_CODE : 0));   \
+  } while (0)
index c96ac8c68c7d14964b91e9136426d1df3b3c0d63..f2d94c20cdc4fa2a05a65124dd6a4df001a7abc3 100644 (file)
@@ -4729,6 +4729,10 @@ ix86_asm_file_end (file)
       output_asm_insn ("mov{l}\t{%1, %0|%0, %1}", xops);
       output_asm_insn ("ret", xops);
     }
+
+#ifdef SUBTARGET_FILE_END
+  SUBTARGET_FILE_END (file);
+#endif
 }
 
 /* Emit code for the SET_GOT patterns.  */
index 90dcd1dad5cd680f2bb6de14bb56911c68c99858..3041368f27d294fbab20467869f118a8f0aae433 100644 (file)
@@ -219,6 +219,13 @@ Boston, MA 02111-1307, USA.  */
           : "=d"(BASE))
 #endif
 
+#define SUBTARGET_FILE_END(FILE) \
+  do {                                                                 \
+    named_section_flags (".note.GNU-stack",                            \
+                        SECTION_DEBUG                                  \
+                        | (trampolines_created ? SECTION_CODE : 0));   \
+  } while (0)
+
 /* Do code reading to identify a signal frame, and set the frame
    state data appropriately.  See unwind-dw2.c for the structs.  */
 
index 575cbee10cce4528c781fbdb04ce1b6da3965f24..341ef32feb17f86b09ee163f640b2342866996ae 100644 (file)
@@ -67,6 +67,13 @@ Boston, MA 02111-1307, USA.  */
 
 #define MULTILIB_DEFAULTS { "m64" }
 
+#define SUBTARGET_FILE_END(FILE) \
+  do {                                                                 \
+    named_section_flags (".note.GNU-stack",                            \
+                        SECTION_DEBUG                                  \
+                        | (trampolines_created ? SECTION_CODE : 0));   \
+  } while (0)
+
 /* Do code reading to identify a signal frame, and set the frame
    state data appropriately.  See unwind-dw2.c for the structs.  
    Don't use this at all if inhibit_libc is used.  */
index 9e81a0a810964b2886a2e92ae4e92219076ed7cf..82015d300ae9acb6925aefbe446edceb3aa6f41f 100644 (file)
@@ -334,3 +334,10 @@ do {                                                                       \
      : "d" (_beg), "d" (_len)                                          \
      : "%d0", "%d2", "%d3");                                           \
 }
+
+#define ASM_FILE_END(FILE) \
+  do {                                                                 \
+    named_section_flags (".note.GNU-stack",                            \
+                        SECTION_DEBUG                                  \
+                        | (trampolines_created ? SECTION_CODE : 0));   \
+  } while (0)
index 0eaf5df6772dea6901a3a71770e54d6abdb74a59..7234d13617160715df1298f6972071809792c425 100644 (file)
 /* We don't need to generate entries in .fixup.  */
 #undef RELOCATABLE_NEEDS_FIXUP
 
+#define ASM_FILE_END(FILE) \
+  do {                                                                 \
+    named_section_flags (".note.GNU-stack",                            \
+                        SECTION_DEBUG                                  \
+                        | (trampolines_created ? SECTION_CODE : 0));   \
+  } while (0)
+
 /* Do code reading to identify a signal frame, and set the frame
    state data appropriately.  See unwind-dw2.c for the structs.  */
 
index f63b7d41923b0d050bace3563009920997e49a39..f611471900b54b61f11ab01acfd7629d33ae9399 100644 (file)
@@ -503,6 +503,14 @@ while (0)
 #undef DRAFT_V4_STRUCT_RET
 #define DRAFT_V4_STRUCT_RET (!TARGET_64BIT)
 
+#define ASM_FILE_END(FILE) \
+  do {                                                                 \
+    if (! TARGET_64BIT)                                                        \
+      named_section_flags (".note.GNU-stack",                          \
+                          SECTION_DEBUG                                \
+                          | (trampolines_created ? SECTION_CODE : 0)); \
+  } while (0)
+
 /* Do code reading to identify a signal frame, and set the frame
    state data appropriately.  See unwind-dw2.c for the structs.  */
 
index 0553283aa751663bf88aa68e0d32445585cddefc..74e14836286f43df4f22c1bf03e6f0a0a032d19a 100644 (file)
@@ -157,3 +157,8 @@ FUNC_NAME(name):
 GLUE(.L,name): \
        .size FUNC_NAME(name),GLUE(.L,name)-FUNC_NAME(name)
 #endif
+
+#if defined __linux__ && !defined __powerpc64__
+       .section .note.GNU-stack
+       .previous
+#endif
index cc496bdb63b0c714c7e47de4906422e0da39f10c..e4b34537a010fa3ca6cb77fc725c46bcb087b525 100644 (file)
@@ -121,6 +121,12 @@ Boston, MA 02111-1307, USA.  */
   { "link_arch31",     LINK_ARCH31_SPEC },     \
   { "link_arch64",     LINK_ARCH64_SPEC },     \
 
+#define ASM_FILE_END(FILE) \
+  do {                                                                 \
+    named_section_flags (".note.GNU-stack",                            \
+                        SECTION_DEBUG                                  \
+                        | (trampolines_created ? SECTION_CODE : 0));   \
+  } while (0)
 
 /* Do code reading to identify a signal frame, and set the frame
    state data appropriately.  See unwind-dw2.c for the structs.  */
index 63ce3b95e68fa7e7110ca9e792c81af90bb5fc43..c78f1562e9a6daf7f7a6e43dee620bf3ac78e56c 100644 (file)
@@ -259,6 +259,13 @@ do {                                                                       \
 #undef CTORS_SECTION_ASM_OP
 #undef DTORS_SECTION_ASM_OP
 
+#define ASM_FILE_END(FILE) \
+  do {                                                                 \
+    named_section_flags (".note.GNU-stack",                            \
+                        SECTION_DEBUG                                  \
+                        | (trampolines_created ? SECTION_CODE : 0));   \
+  } while (0)
+
 /* Do code reading to identify a signal frame, and set the frame
    state data appropriately.  See unwind-dw2.c for the structs.  */
 
index ecdd5204ee6ae3ca1795099c00ca399a01bb49ef..0bb1e646b1d39b97d3edece6f4ea4daa7b611b97 100644 (file)
@@ -324,6 +324,13 @@ do {                                                                       \
 #undef CTORS_SECTION_ASM_OP
 #undef DTORS_SECTION_ASM_OP
 
+#define ASM_FILE_END(FILE) \
+  do {                                                                 \
+    named_section_flags (".note.GNU-stack",                            \
+                        SECTION_DEBUG                                  \
+                        | (trampolines_created ? SECTION_CODE : 0));   \
+  } while (0)
+
 /* Do code reading to identify a signal frame, and set the frame
    state data appropriately.  See unwind-dw2.c for the structs.  */
 
index c090d4aa869dac8b3f39caf4e63fb95719b5d790..9924bb589b7474201128a075fdfef9abdb9a84b9 100644 (file)
@@ -129,6 +129,9 @@ int current_function_uses_only_leaf_regs;
    post-instantiation libcalls.  */
 int virtuals_instantiated;
 
+/* Nonzero if at least one trampoline has been created.  */
+int trampolines_created;
+
 /* Assign unique numbers to labels generated for profiling, debugging, etc.  */
 static GTY(()) int funcdef_no;
 
@@ -7024,6 +7027,7 @@ expand_function_end (filename, line, end_bindings)
       emit_block_move (blktramp, initial_trampoline,
                       GEN_INT (TRAMPOLINE_SIZE), BLOCK_OP_NORMAL);
 #endif
+      trampolines_created = 1;
       INITIALIZE_TRAMPOLINE (tramp, XEXP (DECL_RTL (function), 0), context);
       seq = get_insns ();
       end_sequence ();
index d29b40c44692a331f3f6c0356fb0414eadd6ecce..f9db14c3cbc0724b1a269ae2fd2e74b4a4145ce3 100644 (file)
@@ -513,6 +513,9 @@ extern GTY(()) struct function *cfun;
 /* Nonzero if we've already converted virtual regs to hard regs.  */
 extern int virtuals_instantiated;
 
+/* Nonzero if at least one trampoline has been created.  */
+extern int trampolines_created;
+
 /* For backward compatibility... eventually these should all go away.  */
 #define current_function_name (cfun->name)
 #define current_function_pops_args (cfun->pops_args)