summaryrefslogtreecommitdiff
path: root/bfd/elf32-i386.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@bigpond.net.au>2002-12-12 10:17:14 +0000
committerAlan Modra <amodra@bigpond.net.au>2002-12-12 10:17:14 +0000
commit3b42c2e50dfeb37ea043a855d2d5b45707e86d5d (patch)
treed43c33878159bf257e2b773d35b68e3b40e87a1a /bfd/elf32-i386.c
parentba8c43696bba096dac1df8ff7d42e66e1ef5a453 (diff)
downloadgdb-3b42c2e50dfeb37ea043a855d2d5b45707e86d5d.tar.gz
* elf32-i386.c (elf_i386_finish_dynamic_sections): Add output_offset
to DT_JMPREL. Use srelplt input section size for DT_PLTRELSZ and DT_RELSZ adjustment, not output section. Avoid writing tags when unchanged. Don't assume linker script is sane, adjust DT_REL too. * elf32-hppa.c (elf32_hppa_finish_dynamic_sections): Just use raw size of srelplt for DT_PLTRELSZ. Use srelplt input section size for DT_RELASZ adjustment, not output section. Avoid writing tags when unchanged. Adjust DT_RELA. * elf64-ppc.c (ppc64_elf_finish_dynamic_sections): Tweaks for better formatting. Avoid writing tags when unchanged. Adjust DT_RELA.
Diffstat (limited to 'bfd/elf32-i386.c')
-rw-r--r--bfd/elf32-i386.c39
1 files changed, 21 insertions, 18 deletions
diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c
index a6e39932ca1..9c94887b4bf 100644
--- a/bfd/elf32-i386.c
+++ b/bfd/elf32-i386.c
@@ -3265,15 +3265,13 @@ elf_i386_finish_dynamic_sections (output_bfd, info)
break;
case DT_JMPREL:
- dyn.d_un.d_ptr = htab->srelplt->output_section->vma;
+ s = htab->srelplt;
+ dyn.d_un.d_ptr = s->output_section->vma + s->output_offset;
break;
case DT_PLTRELSZ:
- s = htab->srelplt->output_section;
- if (s->_cooked_size != 0)
- dyn.d_un.d_val = s->_cooked_size;
- else
- dyn.d_un.d_val = s->_raw_size;
+ s = htab->srelplt;
+ dyn.d_un.d_val = s->_raw_size;
break;
case DT_RELSZ:
@@ -3282,18 +3280,23 @@ elf_i386_finish_dynamic_sections (output_bfd, info)
included in the overall relocs (DT_REL). This is
what Solaris does. However, UnixWare can not handle
that case. Therefore, we override the DT_RELSZ entry
- here to make it not include the JMPREL relocs. Since
- the linker script arranges for .rel.plt to follow all
- other relocation sections, we don't have to worry
- about changing the DT_REL entry. */
- if (htab->srelplt != NULL)
- {
- s = htab->srelplt->output_section;
- if (s->_cooked_size != 0)
- dyn.d_un.d_val -= s->_cooked_size;
- else
- dyn.d_un.d_val -= s->_raw_size;
- }
+ here to make it not include the JMPREL relocs. */
+ s = htab->srelplt;
+ if (s == NULL)
+ continue;
+ dyn.d_un.d_val -= s->_raw_size;
+ break;
+
+ case DT_REL:
+ /* We may not be using the standard ELF linker script.
+ If .rel.plt is the first .rel section, we adjust
+ DT_REL to not include it. */
+ s = htab->srelplt;
+ if (s == NULL)
+ continue;
+ if (dyn.d_un.d_ptr != s->output_section->vma + s->output_offset)
+ continue;
+ dyn.d_un.d_ptr += s->_raw_size;
break;
}