diff options
Diffstat (limited to 'bfd')
-rw-r--r-- | bfd/ChangeLog | 9 | ||||
-rw-r--r-- | bfd/elflink.c | 7 | ||||
-rw-r--r-- | bfd/linker.c | 9 |
3 files changed, 23 insertions, 2 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index dc3aa2f..c9c2407 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,5 +1,14 @@ 2017-11-28 Alan Modra <amodra@gmail.com> + PR 22471 + * elflink.c (_bfd_elf_merge_symbol): Allow weak symbols to override + early passes over linker script symbols. + * linker.c (_bfd_generic_link_add_one_symbol): Allow symbols to + override early passes over linker script symbols. Clear ldscript_def + on symbol definitions. + +2017-11-28 Alan Modra <amodra@gmail.com> + * elf64-mmix.c (bfd_elf64_bfd_copy_link_hash_symbol_type): Define. 2017-11-28 H.J. Lu <hongjiu.lu@intel.com> diff --git a/bfd/elflink.c b/bfd/elflink.c index ddd088c..fed7caa 100644 --- a/bfd/elflink.c +++ b/bfd/elflink.c @@ -1471,10 +1471,15 @@ _bfd_elf_merge_symbol (bfd *abfd, treated as strong if the new symbol is from a dynamic library. This reflects the way glibc's ld.so works. + Also allow a weak symbol to override a linker script symbol + defined by an early pass over the script. This is done so the + linker knows the symbol is defined in an object file, for the + DEFINED script function. + Do this before setting *type_change_ok or *size_change_ok so that we warn properly when dynamic library symbols are overridden. */ - if (newdef && !newdyn && olddyn) + if (newdef && !newdyn && (olddyn || h->root.ldscript_def)) newweak = FALSE; if (olddef && newdyn) oldweak = FALSE; diff --git a/bfd/linker.c b/bfd/linker.c index a96c6ed..9c19df4 100644 --- a/bfd/linker.c +++ b/bfd/linker.c @@ -1443,9 +1443,14 @@ _bfd_generic_link_add_one_symbol (struct bfd_link_info *info, do { enum link_action action; + int prev; + prev = h->type; + /* Treat symbols defined by early linker script pass as undefined. */ + if (h->ldscript_def) + prev = bfd_link_hash_undefined; cycle = FALSE; - action = link_action[(int) row][(int) h->type]; + action = link_action[(int) row][prev]; switch (action) { case FAIL: @@ -1489,6 +1494,7 @@ _bfd_generic_link_add_one_symbol (struct bfd_link_info *info, h->u.def.section = section; h->u.def.value = value; h->linker_def = 0; + h->ldscript_def = 0; /* If we have been asked to, we act like collect2 and identify all functions that might be global @@ -1588,6 +1594,7 @@ _bfd_generic_link_add_one_symbol (struct bfd_link_info *info, else h->u.c.p->section = section; h->linker_def = 0; + h->ldscript_def = 0; break; case REF: |