[PATCH] Add plugin interface to LD [3/4] Get symbols and resolutions.

Dave Korn dave.korn.cygwin@gmail.com
Thu Sep 23 05:09:00 GMT 2010


  This one works by using the bfd linker's "notice symbol" callback to track
all symbols that are referenced by non-IR files, so that we can later
determine for prevailing defs from IR files whether or not they are IR-only.
It's pretty simple and the only minor trickiness is turing on notice_all
without inadvertently behaving like we've invoked --trace-sym on the whole world.

- As with the asymbol conversion in the previous patch, I'd appreciate extra
eyeballs looking at the logic here in get_symbols by which I determine
LDPR_xxx resolution types from the info in the linker hash table, just to
double-check my working.

  ld/ChangeLog:

	* ldmain.c (notice)[ENABLE_PLUGINS]: Call plugin_notice.
	* plugin.c (non_ironly_hash): Add new bfd hash table.
	(plugin_load_plugins): Exit early if no plugins to load.  If plugins
	do load successfully, set notice_all flag in link info.
	(add_symbols): Clean up for-loop slightly.
	(get_symbols): Implement.
	(init_non_ironly_hash): Lazily init non_ironly_hash table.
	(plugin_notice): Record symbols referenced from non-IR files in the
	non_ironly_hash.  Suppress tracing, cref generation and nocrossrefs
	tracking for symbols from dummy IR bfds.
	* plugin.h: Fix formatting.
	(plugin_notice): Add prototype.
	* testplug.c (dumpresolutions): New global var.
	(parse_options): Accept "dumpresolutions".
	(onall_symbols_read): Get syms and dump resolutions if it was given.

  ld/testsuite/ChangeLog:

	* ld-plugin/plugin-8.d: New testcase.
	* ld-plugin/plugin.exp: Invoke it.

    cheers,
      DaveK


-------------- next part --------------
A non-text attachment was scrubbed...
Name: ld-plugin-api-3-get-symbols.diff
Type: text/x-c
Size: 15916 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20100923/9a05f4c5/attachment.bin>


More information about the Binutils mailing list