diff options
Diffstat (limited to 'bfd')
-rw-r--r-- | bfd/ChangeLog | 12 | ||||
-rw-r--r-- | bfd/plugin.c | 10 | ||||
-rw-r--r-- | bfd/syms.c | 17 |
3 files changed, 28 insertions, 11 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 676f4ad..6f7f19a 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,15 @@ +2019-05-04 Alan Modra <amodra@gmail.com> + + PR 24511 + * syms.c (coff_section_type): Only allow '.', '$' and numeric + following the standard section names. + (bfd_decode_symclass): Prioritize section flag tests in + decode_section_type before name tests in coff_section_type. + * plugin.c (bfd_plugin_canonicalize_symtab): Init fake_section + and fake_common_section using BFD_FAKE_SECTION. Use "fake" as + their names and choose standard .text section flags for + fake_section. + 2019-05-02 Nick Clifton <nickc@redhat.com> PR 24493 diff --git a/bfd/plugin.c b/bfd/plugin.c index 8cb44ce..376e92c 100644 --- a/bfd/plugin.c +++ b/bfd/plugin.c @@ -530,13 +530,13 @@ bfd_plugin_canonicalize_symtab (bfd *abfd, struct plugin_data_struct *plugin_data = abfd->tdata.plugin_data; long nsyms = plugin_data->nsyms; const struct ld_plugin_symbol *syms = plugin_data->syms; - static asection fake_section; - static asection fake_common_section; + static asection fake_section + = BFD_FAKE_SECTION (fake_section, NULL, "plug", 0, + SEC_ALLOC | SEC_LOAD | SEC_CODE | SEC_HAS_CONTENTS); + static asection fake_common_section + = BFD_FAKE_SECTION (fake_common_section, NULL, "plug", 0, SEC_IS_COMMON); int i; - fake_section.name = ".text"; - fake_common_section.flags = SEC_IS_COMMON; - for (i = 0; i < nsyms; i++) { asymbol *s = bfd_alloc (abfd, sizeof (asymbol)); @@ -595,8 +595,9 @@ static const struct section_to_type stt[] = /* Return the single-character symbol type corresponding to section S, or '?' for an unknown COFF section. - Check for any leading string which matches, so .text5 returns - 't' as well as .text */ + Check for leading strings which match, followed by a number, '.', + or '$' so .text5 matches the .text entry, but .init_array doesn't + match the .init entry. */ static char coff_section_type (const char *s) @@ -604,8 +605,12 @@ coff_section_type (const char *s) const struct section_to_type *t; for (t = &stt[0]; t->section; t++) - if (!strncmp (s, t->section, strlen (t->section))) - return t->type; + { + size_t len = strlen (t->section); + if (strncmp (s, t->section, len) == 0 + && memchr (".$0123456789", s[len], 13) != 0) + return t->type; + } return '?'; } @@ -700,9 +705,9 @@ bfd_decode_symclass (asymbol *symbol) c = 'a'; else if (symbol->section) { - c = coff_section_type (symbol->section->name); + c = decode_section_type (symbol->section); if (c == '?') - c = decode_section_type (symbol->section); + c = coff_section_type (symbol->section->name); } else return '?'; |