diff options
author | Alan Modra <amodra@gmail.com> | 2004-05-03 14:52:02 +0000 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2004-05-03 14:52:02 +0000 |
commit | 6a8d1586d12c10e7ca825c408d4fba5b226807a2 (patch) | |
tree | abd04c4b0019db4e0d2da7aaef6c26a7f8da09fe /bfd/elflink.c | |
parent | b9f18452d42e7998f9c0bd59ec4018f639620bbd (diff) | |
download | gdb-6a8d1586d12c10e7ca825c408d4fba5b226807a2.zip gdb-6a8d1586d12c10e7ca825c408d4fba5b226807a2.tar.gz gdb-6a8d1586d12c10e7ca825c408d4fba5b226807a2.tar.bz2 |
* elf.c (_bfd_elf_rela_local_sym): Set kept_section for excluded
SEC_MERGE sections.
* elflink.c (elf_link_input_bfd): Adjust output reloc index for
those against discarded link-once and SEC_MERGE section symbols.
Diffstat (limited to 'bfd/elflink.c')
-rw-r--r-- | bfd/elflink.c | 32 |
1 files changed, 23 insertions, 9 deletions
diff --git a/bfd/elflink.c b/bfd/elflink.c index a4adaf5..32f4264 100644 --- a/bfd/elflink.c +++ b/bfd/elflink.c @@ -6763,13 +6763,10 @@ elf_link_input_bfd (struct elf_final_link_info *finfo, bfd *input_bfd) { /* I suppose the backend ought to fill in the section of any STT_SECTION symbol against a - processor specific section. If we have - discarded a section, the output_section will - be the absolute section. */ - if (bfd_is_abs_section (sec) - || (sec != NULL - && bfd_is_abs_section (sec->output_section))) - r_symndx = 0; + processor specific section. */ + r_symndx = 0; + if (bfd_is_abs_section (sec)) + ; else if (sec == NULL || sec->owner == NULL) { bfd_set_error (bfd_error_bad_value); @@ -6777,8 +6774,25 @@ elf_link_input_bfd (struct elf_final_link_info *finfo, bfd *input_bfd) } else { - r_symndx = sec->output_section->target_index; - BFD_ASSERT (r_symndx != 0); + asection *osec = sec->output_section; + + /* If we have discarded a section, the output + section will be the absolute section. In + case of discarded link-once and discarded + SEC_MERGE sections, use the kept section. */ + if (bfd_is_abs_section (osec) + && sec->kept_section != NULL + && sec->kept_section->output_section != NULL) + { + osec = sec->kept_section->output_section; + irela->r_addend -= osec->vma; + } + + if (!bfd_is_abs_section (osec)) + { + r_symndx = osec->target_index; + BFD_ASSERT (r_symndx != 0); + } } /* Adjust the addend according to where the |