[PATCH] Prevent LTO section collision for a symbol name starting with '*'.
Martin Liška
mliska@suse.cz
Fri Aug 23 16:42:00 GMT 2019
On 8/23/19 5:05 PM, Jan Hubicka wrote:
>> On 8/23/19 4:37 PM, Jan Hubicka wrote:
>>>> On 8/23/19 2:33 PM, Martin Liška wrote:
>>>>> So in WPA, we shift order by order_base. For streaming purpose I'll need
>>>>> something like symtab_node::lgen_order that will be streamer_read_hwi (ib).
>>>>
>>>> And we'll probably need to stream the original LGEN symtab_node::order
>>>> in order to read proper section during LTRANS. Am I right?
>>>
>>> Well, at WPA time you know node->order and from lto_file_data you know
>>> how to recalculate node->order to original node->order at compile time.
>>
>> How can I recalculate that? One possible solution is to store order_base
>> for each struct lto_file_decl_data *file_data in input_node function.
>
> Yep, i would keep order_base in file_data.
Fine.
>>
>>> During the section copying you can arrange it to be renamed to new
>>> node->order which you then stream from WPA to ltrans.
>>
>> That's a nice solution. Can you please point me to the code which
>> does that?
>
> copy_function_or_variable preserves section name but it seems like it
> should be easy to invent new name there.
Great, thanks.
>>
>> And what's your opinion about section naming scheme $name.$order.$file_hash?
>
> Why you need the file hash? I hope the orders would be reasonably stable
> way to code things w/o conflicts.
Sorry, I mean the hash which we use in LGEN even now. So e.g.:
readelf -S -W main.o
There are 17 section headers, starting at offset 0x958:
Section Headers:
[Nr] Name Type Address Off Size ES Flg Lk Inf Al
...
[ 6] .gnu.lto_main.e4fa533f2618f732 PROGBITS 0000000000000000 00007c 000287 00 E 0 0 1
So my question should be if we want $name.$order as a section name?
Martin
>
> Honza
>>
>> Thanks,
>> Martin
>>
>>>
>>> Honza
>>>>
>>>> Martin
>>
More information about the Gcc-patches
mailing list