diff options
author | Jakub Jelinek <jakub@redhat.com> | 2003-06-03 22:27:24 +0000 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2003-06-03 22:27:24 +0000 |
commit | 9ee5e4996f81ebf9c9febba19df86d9072313343 (patch) | |
tree | 7f938d499771d165d2820e2ad589d1c7844c2990 /ld | |
parent | 65982ba6e7c672622ff83141c1c7f563f0427132 (diff) | |
download | gdb-9ee5e4996f81ebf9c9febba19df86d9072313343.zip gdb-9ee5e4996f81ebf9c9febba19df86d9072313343.tar.gz gdb-9ee5e4996f81ebf9c9febba19df86d9072313343.tar.bz2 |
binutils/
* readelf.c (get_segment_type): Handle PT_GNU_STACK.
bfd/
* elf.c (_bfd_elf_print_private_bfd_data): Handle PT_GNU_STACK.
(bfd_section_from_phdr): Likewise.
(map_sections_to_segments): Create PT_GNU_STACK segment header.
(get_program_header_size): Count with PT_GNU_STACK.
* elf-bfd.h (struct elf_obj_tdata): Add stack_flags.
* elflink.h (bfd_elfNN_size_dynamic_sections): Set stack_flags.
include/
* bfdlink.h (struct bfd_link_info): Add execstack and noexecstack.
* elf/common.h (PT_GNU_STACK): Define.
ld/
* ldgram.y (phdr_type): Grok PT_GNU_STACK.
* emultempl/elf32.em (gld${EMULATION_NAME}_handle_option): Add
-z execstack and -z noexecstack.
(gld${EMULATION_NAME}_list_options): Likewise.
* scripttempl/elf.sc: If not -r, discard .note.GNU-stack section.
Diffstat (limited to 'ld')
-rw-r--r-- | ld/ChangeLog | 9 | ||||
-rw-r--r-- | ld/emultempl/elf32.em | 12 | ||||
-rw-r--r-- | ld/ldgram.y | 2 | ||||
-rw-r--r-- | ld/scripttempl/elf.sc | 2 |
4 files changed, 25 insertions, 0 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog index a14119f..2be279f 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,6 +1,15 @@ +2003-05-23 Jakub Jelinek <jakub@redhat.com> + + * ldgram.y (phdr_type): Grok PT_GNU_STACK. + * emultempl/elf32.em (gld${EMULATION_NAME}_handle_option): Add + -z execstack and -z noexecstack. + (gld${EMULATION_NAME}_list_options): Likewise. + * scripttempl/elf.sc: If not -r, discard .note.GNU-stack section. + 2003-06-03 Michael Snyder <msnyder@redhat.com> and Bernd Schmidt <bernds@redhat.com> and Alexandre Oliva <aoliva@redhat.com> + * Makefile.am: Add new emulations for h8300sx. * Makefile.in: Regenerate. * configure.tgt: Add new emulations. diff --git a/ld/emultempl/elf32.em b/ld/emultempl/elf32.em index 11668fd..5529f32 100644 --- a/ld/emultempl/elf32.em +++ b/ld/emultempl/elf32.em @@ -1684,6 +1684,16 @@ cat >>e${EMULATION_NAME}.c <<EOF link_info.combreloc = FALSE; else if (strcmp (optarg, "nocopyreloc") == 0) link_info.nocopyreloc = TRUE; + else if (strcmp (optarg, "execstack") == 0) + { + link_info.execstack = TRUE; + link_info.noexecstack = FALSE; + } + else if (strcmp (optarg, "noexecstack") == 0) + { + link_info.noexecstack = TRUE; + link_info.execstack = FALSE; + } /* What about the other Solaris -z options? FIXME. */ break; EOF @@ -1722,6 +1732,7 @@ cat >>e${EMULATION_NAME}.c <<EOF fprintf (file, _(" --eh-frame-hdr\tCreate .eh_frame_hdr section\n")); fprintf (file, _(" -z combreloc\t\tMerge dynamic relocs into one section and sort\n")); fprintf (file, _(" -z defs\t\tDisallows undefined symbols\n")); + fprintf (file, _(" -z execstack\t\tMark executable as requiring executable stack\n")); fprintf (file, _(" -z initfirst\t\tMark DSO to be initialized first at runtime\n")); fprintf (file, _(" -z interpose\t\tMark object to interpose all DSOs but executable\n")); fprintf (file, _(" -z loadfltr\t\tMark object requiring immediate process\n")); @@ -1732,6 +1743,7 @@ cat >>e${EMULATION_NAME}.c <<EOF fprintf (file, _(" -z nodelete\t\tMark DSO non-deletable at runtime\n")); fprintf (file, _(" -z nodlopen\t\tMark DSO not available to dlopen\n")); fprintf (file, _(" -z nodump\t\tMark DSO not available to dldump\n")); + fprintf (file, _(" -z noexecstack\t\tMark executable as not requiring executable stack\n")); fprintf (file, _(" -z now\t\tMark object non-lazy runtime binding\n")); fprintf (file, _(" -z origin\t\tMark object requiring immediate \$ORIGIN processing\n\t\t\t at runtime\n")); fprintf (file, _(" -z KEYWORD\t\tIgnored for Solaris compatibility\n")); diff --git a/ld/ldgram.y b/ld/ldgram.y index e9c8a9f..22dbb24 100644 --- a/ld/ldgram.y +++ b/ld/ldgram.y @@ -1006,6 +1006,8 @@ phdr_type: { if (strcmp (s, "PT_GNU_EH_FRAME") == 0) $$ = exp_intop (0x6474e550); + else if (strcmp (s, "PT_GNU_STACK") == 0) + $$ = exp_intop (0x6474e551); else { einfo (_("\ diff --git a/ld/scripttempl/elf.sc b/ld/scripttempl/elf.sc index d4ffcd6..97b100e 100644 --- a/ld/scripttempl/elf.sc +++ b/ld/scripttempl/elf.sc @@ -84,6 +84,7 @@ INTERP=".interp ${RELOCATING-0} : { *(.interp) }" PLT=".plt ${RELOCATING-0} : { *(.plt) }" DYNAMIC=".dynamic ${RELOCATING-0} : { *(.dynamic) }" RODATA=".rodata ${RELOCATING-0} : { *(.rodata${RELOCATING+ .rodata.* .gnu.linkonce.r.*}) }" +STACKNOTE="/DISCARD/ : { *(.note.GNU-stack) }" if test -z "${NO_SMALL_DATA}"; then SBSS=".sbss ${RELOCATING-0} : { @@ -396,5 +397,6 @@ cat <<EOF ${STACK_ADDR+${STACK}} ${OTHER_SECTIONS} ${RELOCATING+${OTHER_END_SYMBOLS}} + ${RELOCATING+${STACKNOTE}} } EOF |