summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2003-06-04 16:44:51 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2003-06-04 16:44:51 +0000
commit3fd62642d6a042a192f405ab559a0fef3c49f588 (patch)
tree183ccc7e9327b3b5ce962ea21bd520f0b9da84dc
parent2d93887b0dfd20fdaa76be712b7f1838a1cdcaab (diff)
downloadgcc-3fd62642d6a042a192f405ab559a0fef3c49f588.tar.gz
* 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@67447 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog17
-rw-r--r--gcc/config/alpha/linux-elf.h7
-rw-r--r--gcc/config/i386/i386.c4
-rw-r--r--gcc/config/i386/linux.h7
-rw-r--r--gcc/config/i386/linux64.h7
-rw-r--r--gcc/config/m68k/linux.h7
-rw-r--r--gcc/config/rs6000/linux.h7
-rw-r--r--gcc/config/rs6000/linux64.h8
-rw-r--r--gcc/config/rs6000/ppc-asm.h5
-rw-r--r--gcc/config/s390/linux.h6
-rw-r--r--gcc/config/sparc/linux.h7
-rw-r--r--gcc/config/sparc/linux64.h7
-rw-r--r--gcc/function.c4
-rw-r--r--gcc/function.h3
14 files changed, 96 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 96a0ab80a70..6bb5c6af19b 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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
diff --git a/gcc/config/alpha/linux-elf.h b/gcc/config/alpha/linux-elf.h
index be17dddab24..c7319f31ffe 100644
--- a/gcc/config/alpha/linux-elf.h
+++ b/gcc/config/alpha/linux-elf.h
@@ -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)
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index c96ac8c68c7..f2d94c20cdc 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -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. */
diff --git a/gcc/config/i386/linux.h b/gcc/config/i386/linux.h
index 90dcd1dad5c..3041368f27d 100644
--- a/gcc/config/i386/linux.h
+++ b/gcc/config/i386/linux.h
@@ -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. */
diff --git a/gcc/config/i386/linux64.h b/gcc/config/i386/linux64.h
index 575cbee10cc..341ef32feb1 100644
--- a/gcc/config/i386/linux64.h
+++ b/gcc/config/i386/linux64.h
@@ -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. */
diff --git a/gcc/config/m68k/linux.h b/gcc/config/m68k/linux.h
index 9e81a0a8109..82015d300ae 100644
--- a/gcc/config/m68k/linux.h
+++ b/gcc/config/m68k/linux.h
@@ -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)
diff --git a/gcc/config/rs6000/linux.h b/gcc/config/rs6000/linux.h
index 0eaf5df6772..7234d136171 100644
--- a/gcc/config/rs6000/linux.h
+++ b/gcc/config/rs6000/linux.h
@@ -86,6 +86,13 @@
/* 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. */
diff --git a/gcc/config/rs6000/linux64.h b/gcc/config/rs6000/linux64.h
index f63b7d41923..f611471900b 100644
--- a/gcc/config/rs6000/linux64.h
+++ b/gcc/config/rs6000/linux64.h
@@ -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. */
diff --git a/gcc/config/rs6000/ppc-asm.h b/gcc/config/rs6000/ppc-asm.h
index 0553283aa75..74e14836286 100644
--- a/gcc/config/rs6000/ppc-asm.h
+++ b/gcc/config/rs6000/ppc-asm.h
@@ -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
diff --git a/gcc/config/s390/linux.h b/gcc/config/s390/linux.h
index cc496bdb63b..e4b34537a01 100644
--- a/gcc/config/s390/linux.h
+++ b/gcc/config/s390/linux.h
@@ -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. */
diff --git a/gcc/config/sparc/linux.h b/gcc/config/sparc/linux.h
index 63ce3b95e68..c78f1562e9a 100644
--- a/gcc/config/sparc/linux.h
+++ b/gcc/config/sparc/linux.h
@@ -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. */
diff --git a/gcc/config/sparc/linux64.h b/gcc/config/sparc/linux64.h
index ecdd5204ee6..0bb1e646b1d 100644
--- a/gcc/config/sparc/linux64.h
+++ b/gcc/config/sparc/linux64.h
@@ -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. */
diff --git a/gcc/function.c b/gcc/function.c
index c090d4aa869..9924bb589b7 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -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 ();
diff --git a/gcc/function.h b/gcc/function.h
index d29b40c4469..f9db14c3cbc 100644
--- a/gcc/function.h
+++ b/gcc/function.h
@@ -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)