Clear non_elf on ELF linker defined symbols.
authorH.J. Lu <hjl.tools@gmail.com>
Fri, 1 Oct 2010 04:28:04 +0000 (04:28 +0000)
committerH.J. Lu <hjl.tools@gmail.com>
Fri, 1 Oct 2010 04:28:04 +0000 (04:28 +0000)
2010-09-30  H.J. Lu  <hongjiu.lu@intel.com>

PR ld/11812
* elf32-i386.c (elf_i386_size_dynamic_sections): Don't
 allocate .got.plt section if there are no GOT nor PLT
 entries and there is no refeence to _GLOBAL_OFFSET_TABLE_.
 * elf64-x86-64.c (elf64_x86_64_size_dynamic_sections): Li.kewise.

* elflink.c (_bfd_elf_define_linkage_sym): Clear non_elf.

bfd/ChangeLog
bfd/elf32-i386.c
bfd/elf64-x86-64.c
bfd/elflink.c

index 8068c4c6eece9826a57134cb3a21019e7ae0ea40..2b0b5b0ad200b00384042ac0bf784542e0285284 100644 (file)
@@ -1,3 +1,13 @@
+2010-09-30  H.J. Lu  <hongjiu.lu@intel.com>
+
+       PR ld/11812
+       * elf32-i386.c (elf_i386_size_dynamic_sections): Don't
+        allocate .got.plt section if there are no GOT nor PLT
+        entries and there is no refeence to _GLOBAL_OFFSET_TABLE_.
+        * elf64-x86-64.c (elf64_x86_64_size_dynamic_sections): Li.kewise.
+
+       * elflink.c (_bfd_elf_define_linkage_sym): Clear non_elf.
+
 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
 
        * configure: Regenerate.
index 7a426d51274efc4c62a5e0d360b64dc9f00710fa..8d8bc855c15363adf06859c1568f8ca621bd7c39 100644 (file)
@@ -2559,10 +2559,17 @@ elf_i386_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
 
   if (htab->elf.sgotplt)
     {
+      struct elf_link_hash_entry *got;
+      got = elf_link_hash_lookup (elf_hash_table (info),
+                                 "_GLOBAL_OFFSET_TABLE_",
+                                 FALSE, FALSE, FALSE);
+
       /* Don't allocate .got.plt section if there are no GOT nor PLT
-         entries.  */
-      if ((htab->elf.sgotplt->size
-          == get_elf_backend_data (output_bfd)->got_header_size)
+         entries and there is no refeence to _GLOBAL_OFFSET_TABLE_.  */
+      if ((got == NULL
+          || !got->ref_regular_nonweak)
+         && (htab->elf.sgotplt->size
+             == get_elf_backend_data (output_bfd)->got_header_size)
          && (htab->elf.splt == NULL
              || htab->elf.splt->size == 0)
          && (htab->elf.sgot == NULL
index 9da73a1f500063b85544ad8e1c4762223f3e0ecd..677d9c457bea05b4ee830be6a3019d9b5282a55e 100644 (file)
@@ -2378,10 +2378,17 @@ elf64_x86_64_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
 
   if (htab->elf.sgotplt)
     {
+      struct elf_link_hash_entry *got;
+      got = elf_link_hash_lookup (elf_hash_table (info),
+                                 "_GLOBAL_OFFSET_TABLE_",
+                                 FALSE, FALSE, FALSE);
+
       /* Don't allocate .got.plt section if there are no GOT nor PLT
-         entries.  */
-      if ((htab->elf.sgotplt->size
-          == get_elf_backend_data (output_bfd)->got_header_size)
+         entries and there is no refeence to _GLOBAL_OFFSET_TABLE_.  */
+      if ((got == NULL
+          || !got->ref_regular_nonweak)
+         && (htab->elf.sgotplt->size
+             == get_elf_backend_data (output_bfd)->got_header_size)
          && (htab->elf.splt == NULL
              || htab->elf.splt->size == 0)
          && (htab->elf.sgot == NULL
index f4d65991fe55775974a4dcbcb86281d4bafe0c9c..46f1e2556c40dd36e97e35db3118e0df75f21179 100644 (file)
@@ -86,6 +86,7 @@ _bfd_elf_define_linkage_sym (bfd *abfd,
     return NULL;
   h = (struct elf_link_hash_entry *) bh;
   h->def_regular = 1;
+  h->non_elf = 0;
   h->type = STT_OBJECT;
   h->other = (h->other & ~ELF_ST_VISIBILITY (-1)) | STV_HIDDEN;
 
This page took 0.039401 seconds and 4 git commands to generate.