[lto] PATCH: Add support for referencing types from function bodies

Mark Mitchell mark@codesourcery.com
Tue Sep 5 23:08:00 GMT 2006


Jakub Jelinek wrote:
> On Sun, Sep 03, 2006 at 09:55:50PM -0700, Mark Mitchell wrote:
>> This patch provides an interface for doing that.  During emission of
>> the function-body representation, when a global reference is required,
>> call one of the lto_*_ref functions (e.g., lto_type_ref), and emit the
>> reference returned.  Then, when reading a function body, call
> 
> If the references are relative to .debug_info start, then it would
> be desirable somewhere in the .lto section with the function bodies
> to have an ELF relocation against that .debug_info start, otherwise ld -r
> will make it impossible to read it correctly again.

That's a good point.  Will ld resolve relocations when doing ld -r, to 
the extent it's able to do so?  I'm trying to avoid having to process 
relocations explicitly within the LTO front end, to avoid 
target-dependent and object-file-format-dependent behavior.

Fundamentally, the problem is that the DWARF data is going to be in one 
section, while the LTO information will be in another.  (Neither is 
going to be marked as loadable, if that matters.)  I guess the easiest 
thing would just be for the LTO section to contain an absolute 
relocation against the symbol for the DIE of interest.  However, that 
would require the LTO reader process that relocation, since it can't be 
resolved by ld -r, as (a) it's in a different section, and (b) it's not 
going to have a load address anyhow.  That's why I came up with the 
section-index + offset idea.  Is there any way to make the offset 
automatically adjusted by ld -r?

Thanks,

-- 
Mark Mitchell
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713



More information about the Gcc-patches mailing list