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]

Update LTO plugin interface


Hi,

Here is a proposal to update LTO plugin interface.  Any comments?

Thanks.

-- 
H.J.
---
Goal:  We should preserve the same linker command line order as if
there are no IR.
Problem:
	a. LTO may generate extra symbol references which aren't in IR.
	b. It was worked around with -pass-through hack.  But it doesn't
preserve the link command line order.

Proposal:
	a. Remove -pass-through hack in GCC.
	b. Compiler plugin controls what linker uses to generate the final executable:
		i. The linker command line order should be the same, with or without LTO.
	c. Add a cmdline bit field to
	struct ld_plugin_input_file
	{
	   const char *name;
	   int fd;
	   off_t offset;
	   off_t filesize;
	   void *handle;
	   unsigned int cmdline : 1;
	};
	It is used by linker to tell plugin that the input file comes from
linker command line.
	d. 2 stage linker:
		i. Stage 1: Normal symbol resolution with plugin.
		ii. Stage 2:
			1) Call the "all symbols read" handler to get the final linker inputs.
			2) Discard all previous inputs.
			3) Generate the final executable with inputs from plugin.
	e. Compiler plugin:
		i. For a file, which comes from the linker command line and isn't
claimed by plugin, save it in the linker pass-through list in the same
order as it comes in.
		ii. For the first file claimed by plugin,  remember the last
pass-through linker input.
		iii. The "all symbols read" handler adds input files to the linker
in the order:
			1) All linker input files on the linker pass-through list up to the
first file claimed by plugin.
			2) All linker input files generated by plugin.
			3) The rest of linker input files on the linker pass-through list.
	f. Limitation:
		i. All files claimed by plugin are grouped together.  Any archives
between files claimed by plugin are placed after all linker input
files generated by plugin when passed to linker.


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