summaryrefslogtreecommitdiff
path: root/bfd/linker.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2017-11-27 18:43:03 +1030
committerAlan Modra <amodra@gmail.com>2017-11-28 22:56:59 +1030
commitcd5b2babea487b0a71a14b593af98330efd8d73e (patch)
tree736755eaaa569004fd116c748d77e2e0ac8f023f /bfd/linker.c
parenta83ef4d139c377e0e87d105977d85c6ef9fbb162 (diff)
Copying symbol type in ld script assignments
There is a call to update_definedness between code that evaluates an assignment expression value and code that transfers symbol attributes. When script assignment expressions contain DEFINED, that can mean the wrong symbol type is copied. This patch tracks symbols read during expression evaluation, rather than examining the expression and re-evaluating conditionals. Not only does this simplify the code, it also means ld can now copy symbol types in more complex expressions. An unfortunate side effect of copying symbol type for more complex expressions affects mmix, which uses PROVIDE (Main = DEFINED (Main) ? Main : (DEFINED (_start) ? _start : _start.)); in a default script. So now _start or _start. symbol type may be copied, losing the function type specially set up for Main. This can be avoided by making bfd_copy_link_hash_symbol_type do nothing for mmix. bfd/ * elf64-mmix.c (bfd_elf64_bfd_copy_link_hash_symbol_type): Define. ld/ * ldexp.h (struct ldexp_control): Add "assign_src". * ldexp.c (fold_trinary): Save and restore assign_src around condition evaluation. (fold_name <NAME>): Set expld.assign_src. (try_copy_symbol_type): Delete. (exp_fold_tree_1): Set symbol type using expld.assign_src.
Diffstat (limited to 'bfd/linker.c')
0 files changed, 0 insertions, 0 deletions