diff options
author | Cary Coutant <ccoutant@google.com> | 2012-05-24 01:02:15 +0000 |
---|---|---|
committer | Cary Coutant <ccoutant@google.com> | 2012-05-24 01:02:15 +0000 |
commit | 1be75daacf6afb892dba1e60856d56608a4e6b3b (patch) | |
tree | 3b274aac021ef10819e139391e4917d53926bcd9 /gold | |
parent | f3e0e9604d2bbdbcd4ed17fa35b6ebc3c9360afb (diff) | |
download | gdb-1be75daacf6afb892dba1e60856d56608a4e6b3b.zip gdb-1be75daacf6afb892dba1e60856d56608a4e6b3b.tar.gz gdb-1be75daacf6afb892dba1e60856d56608a4e6b3b.tar.bz2 |
gold/
* layout.cc (Layout::section_name_mapping): Add rules to handle
exact match on .data.rel.ro.local or .data.rel.ro.
(Layout::output_section_name): Check for exact matches.
Diffstat (limited to 'gold')
-rw-r--r-- | gold/ChangeLog | 6 | ||||
-rw-r--r-- | gold/layout.cc | 21 |
2 files changed, 24 insertions, 3 deletions
diff --git a/gold/ChangeLog b/gold/ChangeLog index 9ea9070..4ba85c9 100644 --- a/gold/ChangeLog +++ b/gold/ChangeLog @@ -1,5 +1,11 @@ 2012-05-23 Cary Coutant <ccoutant@google.com> + * layout.cc (Layout::section_name_mapping): Add rules to handle + exact match on .data.rel.ro.local or .data.rel.ro. + (Layout::output_section_name): Check for exact matches. + +2012-05-23 Cary Coutant <ccoutant@google.com> + * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.* more carefully. diff --git a/gold/layout.cc b/gold/layout.cc index e9aeef5..c7ca322 100644 --- a/gold/layout.cc +++ b/gold/layout.cc @@ -4569,12 +4569,15 @@ Layout::set_dynamic_symbol_size(const Symbol_table* symtab) // based on the GNU linker default ELF linker script. #define MAPPING_INIT(f, t) { f, sizeof(f) - 1, t, sizeof(t) - 1 } +#define MAPPING_INIT_EXACT(f, t) { f, 0, t, sizeof(t) - 1 } const Layout::Section_name_mapping Layout::section_name_mapping[] = { MAPPING_INIT(".text.", ".text"), MAPPING_INIT(".rodata.", ".rodata"), MAPPING_INIT(".data.rel.ro.local.", ".data.rel.ro.local"), + MAPPING_INIT_EXACT(".data.rel.ro.local", ".data.rel.ro.local"), MAPPING_INIT(".data.rel.ro.", ".data.rel.ro"), + MAPPING_INIT_EXACT(".data.rel.ro", ".data.rel.ro"), MAPPING_INIT(".data.", ".data"), MAPPING_INIT(".bss.", ".bss"), MAPPING_INIT(".tdata.", ".tdata"), @@ -4613,6 +4616,7 @@ const Layout::Section_name_mapping Layout::section_name_mapping[] = MAPPING_INIT(".gnu.linkonce.armexidx.", ".ARM.exidx"), }; #undef MAPPING_INIT +#undef MAPPING_INIT_EXACT const int Layout::section_name_mapping_count = (sizeof(Layout::section_name_mapping) @@ -4664,10 +4668,21 @@ Layout::output_section_name(const Relobj* relobj, const char* name, const Section_name_mapping* psnm = section_name_mapping; for (int i = 0; i < section_name_mapping_count; ++i, ++psnm) { - if (strncmp(name, psnm->from, psnm->fromlen) == 0) + if (psnm->fromlen > 0) { - *plen = psnm->tolen; - return psnm->to; + if (strncmp(name, psnm->from, psnm->fromlen) == 0) + { + *plen = psnm->tolen; + return psnm->to; + } + } + else + { + if (strcmp(name, psnm->from) == 0) + { + *plen = psnm->tolen; + return psnm->to; + } } } |