* [binutils-gdb] section-match: Check parent archive name as well
@ 2023-06-28 16:10 Michael Matz
0 siblings, 0 replies; only message in thread
From: Michael Matz @ 2023-06-28 16:10 UTC (permalink / raw)
To: bfd-cvs
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=edc1244e9b864daf7b3905fdcbe15407b6aa79e4
commit edc1244e9b864daf7b3905fdcbe15407b6aa79e4
Author: Michael Matz <matz@suse.de>
Date: Mon Jun 26 17:11:31 2023 +0200
section-match: Check parent archive name as well
rewriting the section matching routines lost a special case
of matching: section statements of the form
NAME(section-glob)
normally match against NAME being an object file, but like in
the exclude list we happened to accept archive names as NAME
(undocumented). The documented way to specify (all) archive members
is by using e.g.
lib.a:(section-glob)
(that does work also with the prefix tree matcher).
But I intended to not actually change behaviour with the prefix
tree implementation. So, let's also implement checking against
archive names with a similar FIXME comment we already have in
walk_wild_file_in_exclude_list.
PR 30590
ld/
* ldlang.c (walk_wild_section_match): Also look at archive
parents for a name match.
Diff:
---
ld/ldlang.c | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/ld/ldlang.c b/ld/ldlang.c
index 78716f17729..e359a89fcc0 100644
--- a/ld/ldlang.c
+++ b/ld/ldlang.c
@@ -445,8 +445,19 @@ walk_wild_section_match (lang_wild_statement_type *ptr,
about unset local_sym_name (in which case lookup_name simply adds
the input file again). */
const char *filename = file->local_sym_name;
- if (filename == NULL
- || filename_cmp (filename, file_spec) != 0)
+ lang_input_statement_type *arch_is;
+ if (filename && filename_cmp (filename, file_spec) == 0)
+ ;
+ /* FIXME: see also walk_wild_file_in_exclude_list for why we
+ also check parents BFD (local_sym_)name to match input statements
+ with unadorned archive names. */
+ else if (file->the_bfd
+ && file->the_bfd->my_archive
+ && (arch_is = bfd_usrdata (file->the_bfd->my_archive))
+ && arch_is->local_sym_name
+ && filename_cmp (arch_is->local_sym_name, file_spec) == 0)
+ ;
+ else
return;
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-06-28 16:10 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-28 16:10 [binutils-gdb] section-match: Check parent archive name as well Michael Matz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).