aboutsummaryrefslogtreecommitdiff
path: root/gold/target-reloc.h
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2012-09-12 22:43:54 +0000
committerAlan Modra <amodra@gmail.com>2012-09-12 22:43:54 +0000
commitbfdfa4cd8da8b878613e3ee98c8268f8aa72983c (patch)
tree2ee2b0b7b57dafee8585b56c562cef597f3b8266 /gold/target-reloc.h
parent7c0e90d28c56dd5e0003c921d15aded77c9a639d (diff)
downloadgdb-bfdfa4cd8da8b878613e3ee98c8268f8aa72983c.zip
gdb-bfdfa4cd8da8b878613e3ee98c8268f8aa72983c.tar.gz
gdb-bfdfa4cd8da8b878613e3ee98c8268f8aa72983c.tar.bz2
* target-reloc.h (scan_relocs): Call scan.local for relocs
against symbols in discarded sections. Pass is_discarded param. * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local): Add is_discarded param. * powerpc (Target_powerpc::Scan::local): Likewise. Use is_discarded to flag opd entry as discarded. Don't emit dyn relocs on such entries. (Target_powerpc::Scan::global): Similarly detect and handle such opd entries. (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with opd_ent_. Update all uses. (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions. (Target_powerpc::relocate_section): Zero out discarded opd entry relocs.
Diffstat (limited to 'gold/target-reloc.h')
-rw-r--r--gold/target-reloc.h41
1 files changed, 18 insertions, 23 deletions
diff --git a/gold/target-reloc.h b/gold/target-reloc.h
index 96f2614..5e6dba7 100644
--- a/gold/target-reloc.h
+++ b/gold/target-reloc.h
@@ -81,30 +81,25 @@ scan_relocs(
unsigned int shndx = lsym.get_st_shndx();
bool is_ordinary;
shndx = object->adjust_sym_shndx(r_sym, shndx, &is_ordinary);
- if (is_ordinary
- && shndx != elfcpp::SHN_UNDEF
- && !object->is_section_included(shndx)
- && !symtab->is_section_folded(object, shndx))
- {
- // RELOC is a relocation against a local symbol in a
- // section we are discarding. We can ignore this
- // relocation. It will eventually become a reloc
- // against the value zero.
- //
- // FIXME: We should issue a warning if this is an
- // allocated section; is this the best place to do it?
- //
- // FIXME: The old GNU linker would in some cases look
- // for the linkonce section which caused this section to
- // be discarded, and, if the other section was the same
- // size, change the reloc to refer to the other section.
- // That seems risky and weird to me, and I don't know of
- // any case where it is actually required.
-
- continue;
- }
+ // If RELOC is a relocation against a local symbol in a
+ // section we are discarding then we can ignore it. It will
+ // eventually become a reloc against the value zero.
+ //
+ // FIXME: We should issue a warning if this is an
+ // allocated section; is this the best place to do it?
+ //
+ // FIXME: The old GNU linker would in some cases look
+ // for the linkonce section which caused this section to
+ // be discarded, and, if the other section was the same
+ // size, change the reloc to refer to the other section.
+ // That seems risky and weird to me, and I don't know of
+ // any case where it is actually required.
+ bool is_discarded = (is_ordinary
+ && shndx != elfcpp::SHN_UNDEF
+ && !object->is_section_included(shndx)
+ && !symtab->is_section_folded(object, shndx));
scan.local(symtab, layout, target, object, data_shndx,
- output_section, reloc, r_type, lsym);
+ output_section, reloc, r_type, lsym, is_discarded);
}
else
{