* elf-bfd.h (struct elf_backend_data): Add default_execstack.
authorAlan Modra <amodra@gmail.com>
Mon, 19 Feb 2007 12:44:18 +0000 (12:44 +0000)
committerAlan Modra <amodra@gmail.com>
Mon, 19 Feb 2007 12:44:18 +0000 (12:44 +0000)
* elflink.c (bfd_elf_size_dynamic_sections): Heed default_execstack.
* elfxx-target.h (elf_backend_default_execstack): Define to 1.
(elfNN_bed): Init new field.
* elf64-ppc.c (elf_backend_default_execstack): Define to 0.

bfd/ChangeLog
bfd/elf-bfd.h
bfd/elf64-ppc.c
bfd/elflink.c
bfd/elfxx-target.h

index ad42918729cc60e5555da88a7b031c0e4ec692ba..2d1fe8e570746d13553898f679927145c37d8f8e 100644 (file)
@@ -1,3 +1,11 @@
+2007-02-19  Alan Modra  <amodra@bigpond.net.au>
+
+       * elf-bfd.h (struct elf_backend_data): Add default_execstack.
+       * elflink.c (bfd_elf_size_dynamic_sections): Heed default_execstack.
+       * elfxx-target.h (elf_backend_default_execstack): Define to 1.
+       (elfNN_bed): Init new field.
+       * elf64-ppc.c (elf_backend_default_execstack): Define to 0.
+
 2007-02-17  Mark Mitchell  <mark@codesourcery.com>
             Nathan Sidwell  <nathan@codesourcery.com>
             Vladimir Prus  <vladimir@codesourcery.com
index 151c5d0605336cdd12877e31673d3fa53dfc2757..a0e6391a4f7d9ef80c406631e1217b9c19006728 100644 (file)
@@ -1106,10 +1106,17 @@ struct elf_backend_data
   unsigned can_refcount : 1;
   unsigned want_got_sym : 1;
   unsigned want_dynbss : 1;
-    /* Targets which do not support physical addressing often require
-       that the p_paddr field in the section header to be set to zero.
-       This field indicates whether this behavior is required.  */
+
+  /* Targets which do not support physical addressing often require
+     that the p_paddr field in the section header to be set to zero.
+     This field indicates whether this behavior is required.  */
   unsigned want_p_paddr_set_to_zero : 1;
+
+  /* True if an object file lacking a .note.GNU-stack section
+     should be assumed to be requesting exec stack.  At least one
+     other file in the link needs to have a .note.GNU-stack section
+     for a PT_GNU_STACK segment to be created.  */
+  unsigned default_execstack : 1;
 };
 
 /* Information stored for each BFD section in an ELF file.  This
index b6f5b35fcc9cfed33d87bbefca956a40c8cc3de1..c1c5e6bb85141bf59b4efa5e699cea2ad128ad07 100644 (file)
@@ -73,6 +73,7 @@ static bfd_vma opd_entry_value
 #define elf_backend_can_gc_sections 1
 #define elf_backend_can_refcount 1
 #define elf_backend_rela_normal 1
+#define elf_backend_default_execstack 0
 
 #define bfd_elf64_mkobject                   ppc64_elf_mkobject
 #define bfd_elf64_bfd_reloc_type_lookup              ppc64_elf_reloc_type_lookup
@@ -1197,7 +1198,7 @@ static reloc_howto_type ppc64_elf_howto_raw[] = {
 
   /* Like R_PPC64_PLTGOT16, but for instructions with a DS field.  */
   /* FIXME: R_PPC64_PLTGOT16_DS not implemented.  */
-    HOWTO (R_PPC64_PLTGOT16_DS,        /* type */
+  HOWTO (R_PPC64_PLTGOT16_DS,  /* type */
         0,                     /* rightshift */
         1,                     /* size (0 = byte, 1 = short, 2 = long) */
         16,                    /* bitsize */
index 00baf5d7b0a9cc244dbb7ffa85e68755ef288381..00dd2aafe7ce1e33aab678e55f22c6e0fbaf21f5 100644 (file)
@@ -5237,6 +5237,7 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd,
   if (!is_elf_hash_table (info->hash))
     return TRUE;
 
+  bed = get_elf_backend_data (output_bfd);
   elf_tdata (output_bfd)->relro = info->relro;
   if (info->execstack)
     elf_tdata (output_bfd)->stack_flags = PF_R | PF_W | PF_X;
@@ -5263,7 +5264,7 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd,
                exec = PF_X;
              notesec = s;
            }
-         else
+         else if (bed->default_execstack)
            exec = PF_X;
        }
       if (notesec)
@@ -5284,7 +5285,6 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd,
 
   /* The backend may have to create some sections regardless of whether
      we're dynamic or not.  */
-  bed = get_elf_backend_data (output_bfd);
   if (bed->elf_backend_always_size_sections
       && ! (*bed->elf_backend_always_size_sections) (output_bfd, info))
     return FALSE;
index a09376bdde03e1cb6ff91a6edfac7ed0570b1769..c7be5771c0b21f52b7f7b7b1e7e31664fb8d8ee6 100644 (file)
 #ifndef elf_backend_want_p_paddr_set_to_zero
 #define elf_backend_want_p_paddr_set_to_zero 0
 #endif
+#ifndef elf_backend_default_execstack
+#define elf_backend_default_execstack 1
+#endif
 
 #define bfd_elfNN_bfd_debug_info_start bfd_void
 #define bfd_elfNN_bfd_debug_info_end   bfd_void
@@ -683,7 +686,8 @@ static struct elf_backend_data elfNN_bed =
   elf_backend_can_refcount,
   elf_backend_want_got_sym,
   elf_backend_want_dynbss,
-  elf_backend_want_p_paddr_set_to_zero
+  elf_backend_want_p_paddr_set_to_zero,
+  elf_backend_default_execstack
 };
 
 /* Forward declaration for use when initialising alternative_target field.  */
This page took 0.041287 seconds and 4 git commands to generate.