diff options
author | Alan Modra <amodra@gmail.com> | 2017-09-02 11:08:05 +0930 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2017-09-02 17:39:04 +0930 |
commit | 1fa4ec6ae707402c6b61cde33cfe4bdeafd53f82 (patch) | |
tree | 2db8c41ce002aebac5440e5a6349d1c4a3a91517 /ld/ldmain.c | |
parent | ad71ce8de7dba823f5fc478e6d5eba03f1a2e822 (diff) | |
download | gdb-1fa4ec6ae707402c6b61cde33cfe4bdeafd53f82.zip gdb-1fa4ec6ae707402c6b61cde33cfe4bdeafd53f82.tar.gz gdb-1fa4ec6ae707402c6b61cde33cfe4bdeafd53f82.tar.bz2 |
LTO rescan archives
ld ought to be more clever about where it puts LTO recompiled objects.
Ideally the recompiled objects ought to be ordered to the same place
their IR objects were, and files extracted from archives on the second
pass ought to go in the same place as they would if extracted on the
first pass. This patch addresses the archive problem. Without this
fix, objects extracted from archives might be placed after the crt
files intended to go at the end of an executable or shared library,
possibly causing exception handling failures.
* ldlang.h (lang_input_statement_type): Expand comments.
(LANG_FOR_EACH_INPUT_STATEMENT): Rewrite without casts.
* ldlang.c (lang_for_each_input_file): Likewise.
(load_symbols): Set usrdata for archives.
(find_rescan_insertion): New function.
(lang_process): Trim off and reinsert entries added to file chain
when rescanning archives for LTO.
* ldmain.c (add_archive_element): Set my_archive input_statement
next pointer to last element added.
Diffstat (limited to 'ld/ldmain.c')
-rw-r--r-- | ld/ldmain.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/ld/ldmain.c b/ld/ldmain.c index 2b09f20..d223587 100644 --- a/ld/ldmain.c +++ b/ld/ldmain.c @@ -793,6 +793,7 @@ add_archive_element (struct bfd_link_info *info, bfd **subsbfd ATTRIBUTE_UNUSED) { lang_input_statement_type *input; + lang_input_statement_type *parent; lang_input_statement_type orig_input; input = (lang_input_statement_type *) @@ -802,6 +803,10 @@ add_archive_element (struct bfd_link_info *info, input->local_sym_name = abfd->filename; input->the_bfd = abfd; + parent = abfd->my_archive->usrdata; + if (parent != NULL && !parent->flags.reload) + parent->next = (lang_statement_union_type *) input; + /* Save the original data for trace files/tries below, as plugins (if enabled) may possibly alter it to point to a replacement BFD, but we still want to output the original BFD filename. */ |