This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[gold patch] Add --export-dynamic-symbol option


This patch adds a new command-line option --export-dynamic-symbol=sym.
It's similar to --dynamic-list=list, but takes a single, mangled,
symbol name from the command line rather than using a version script
file. Like -u, it can be used repeatedly, and the symbols named by
this option will be treated as referenced, will cause an archive
member to be loaded, and will not be garbage collected.

Symbols named via --dynamic-list, on the other hand, do not prevent
garbage collection and do not cause archive members to be loaded. I
considered changing that, but decided not to at this time. If we do
decide to change that option, I'd want to do that as a separate patch.
Symbols in that file work more like a version script -- they're
treated as demangled names, may have approximate matching, there's no
error if such a symbol is never defined, and we check that list only
after garbage collection has taken place -- so it didn't quite seem
appropriate to make that option work the same way. The --dynamic-list
option is more like the --dynamic-list-xxx options: more passive,
applying only to symbols that have already survived archive selection
and garbage collection.

I've added a warning if there's an attempt to export a forced-local
symbol (e.g., a symbol with "hidden" visibility).

OK to commit?

-cary

	* archive.cc (Library_base::should_include_member): Check for
	--export-dynamic-symbol.
	* options.h (class General_options): Add --export-dynamic-symbol.
	* symtab.cc (Symbol::should_add_dynsym_entry): Check for
	--export-dynamic-symbol.
	(Symbol_table::gc_mark_undef_symbols): Likewise.
	(Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.

Attachment: gold-export-dynamic-symbol.txt
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]