Fix -pie core dump with .rela.opd section.
authorJim Wilson <wilson@tuliptree.org>
Wed, 19 Nov 2003 01:06:13 +0000 (01:06 +0000)
committerJim Wilson <wilson@tuliptree.org>
Wed, 19 Nov 2003 01:06:13 +0000 (01:06 +0000)
bfd/ChangeLog
* elfxx-ia64.c (get_fptr): For fptr_rel, use dynobj not abfd.
(elfNN_ia64_size_dynamic_sections): When stripping sections, check
for ia64_info->rel_fptr_sec.
ld/ChangeLog
* emulparams/elf64_ia64.sh (OTHER_PLT_RELOC_SECTIONS): Include
.rela.opd if -pie.

bfd/ChangeLog
bfd/elfxx-ia64.c
ld/ChangeLog
ld/emulparams/elf64_ia64.sh

index 9ff2c3b87066f1529a52edf65ae4538f695504c0..11f75b2cf806fbdd6413a072f9f52a7323d49319 100644 (file)
@@ -1,3 +1,9 @@
+2003-11-18  James E Wilson  <wilson@specifixinc.com>
+
+       * elfxx-ia64.c (get_fptr): For fptr_rel, use dynobj not abfd.
+       (elfNN_ia64_size_dynamic_sections): When stripping sections, check
+       for ia64_info->rel_fptr_sec.
+
 2003-11-18  Alan Modra  <amodra@bigpond.net.au>
 
        * elf64-ppc.c (toc_adjusting_stub_needed): Exit early if section
index db4b8aca1503db33050b52109a7cdf8c28b7289b..5ff5740515b4e6afa41ed4c03cb19485f8aaa4bb 100644 (file)
@@ -1993,9 +1993,9 @@ get_fptr (abfd, info, ia64_info)
       if (info->pie)
        {
          asection *fptr_rel;
-         fptr_rel = bfd_make_section(abfd, ".rela.opd");
+         fptr_rel = bfd_make_section(dynobj, ".rela.opd");
          if (fptr_rel == NULL
-             || !bfd_set_section_flags (abfd, fptr_rel,
+             || !bfd_set_section_flags (dynobj, fptr_rel,
                                         (SEC_ALLOC | SEC_LOAD
                                          | SEC_HAS_CONTENTS
                                          | SEC_IN_MEMORY
@@ -2928,6 +2928,15 @@ elfNN_ia64_size_dynamic_sections (output_bfd, info)
          if (strip)
            ia64_info->fptr_sec = NULL;
        }
+      else if (sec == ia64_info->rel_fptr_sec)
+       {
+         if (strip)
+           ia64_info->rel_fptr_sec = NULL;
+         else
+           /* We use the reloc_count field as a counter if we need to
+              copy relocs into the output file.  */
+           sec->reloc_count = 0;
+       }
       else if (sec == ia64_info->plt_sec)
        {
          if (strip)
index d0d747f0397aee9364f2468fb7a1269763ebb572..6bcd346c3feab496ceaa177cc205bb2138a522c8 100644 (file)
@@ -1,3 +1,8 @@
+2003-11-18  James E Wilson  <wilson@specifixinc.com>
+
+       * emulparams/elf64_ia64.sh (OTHER_PLT_RELOC_SECTIONS): Include
+       .rela.opd if -pie.
+
 2003-11-10  Jonathan Wilson <jonwil@tpgi.com.au>
 
        * scripttempl/pe.sc: Add support for TLS sections.
index 858cd10cbbda9cdafe0410142fd091bd63d4f272..100aca1ac0282d496ff2b1c4f658cf5ac485a972 100644 (file)
@@ -28,6 +28,8 @@ test -z "$CREATE_PIE" && OTHER_READONLY_SECTIONS="
   .opd          ${RELOCATING-0} : { *(.opd) }"
 test -n "$CREATE_PIE" && OTHER_READWRITE_SECTIONS="
   .opd          ${RELOCATING-0} : { *(.opd) }"
+test -n "$CREATE_PIE" && OTHER_PLT_RELOC_SECTIONS="${OTHER_PLT_RELOC_SECTIONS}
+  .rela.opd     ${RELOCATING-0} : { *(.rela.opd) }"
 OTHER_READONLY_SECTIONS="${OTHER_READONLY_SECTIONS}
   .IA_64.unwind_info ${RELOCATING-0} : { *(.IA_64.unwind_info${RELOCATING+* .gnu.linkonce.ia64unwi.*}) }
   .IA_64.unwind ${RELOCATING-0} : { *(.IA_64.unwind${RELOCATING+* .gnu.linkonce.ia64unw.*}) }"