[PATCH 6/6] aix: implement TLS relocation for gas and ld
CHIGOT, CLEMENT
clement.chigot@atos.net
Fri Mar 5 13:37:17 GMT 2021
>> --- a/ld/emultempl/aix.em
>> +++ b/ld/emultempl/aix.em
>> @@ -969,6 +969,26 @@ gld${EMULATION_NAME}_before_allocation (void)
>> sec->flags |= SEC_KEEP;
>> }
>>
>> + /* Make sure .tdata is removed if empty, even with -r flag.
>> + .tdata is always being generated because its size is needed
>> + to cumpute .data address. */
>> + if (bfd_link_relocatable (&link_info))
>> + {
>> + asection *sec;
>> +
>> + sec = bfd_get_section_by_name (link_info.output_bfd,
>> + ".tdata");
>
> Needs a "sec != NULL" test here, and I think even with that this code
> won't work as you expect. I might be wrong though, did you test to
> see whether a non-empty .tdata is kept?
>
>> + if (sec->rawsize == 0
>> + && (sec->flags & SEC_KEEP) == 0
>> + && !bfd_section_removed_from_list (link_info.output_bfd,
>> + sec))
>> + {
>> + sec->flags |= SEC_EXCLUDE;
>> + bfd_section_list_remove (link_info.output_bfd, sec);
>> + link_info.output_bfd->section_count--;
>> + }
>> + }
>> +
>> before_allocation_default ();
>> }
Indeed, a non-empty .tdata is being removed too.
My goal here is to avoid having a ".tdata" section in every files generated
with "-r". The reason why it keeps appearing is because I'm using .tdata size
to compute "dot" in aix.sc.
I'm sure it can be fixed directly inside aix.sc but I didn't find how, as I need
to place .tdata before .data and have everything align correctly...
Otherwise, any ideas how to detect when .tdata is non-empty there ?
Thanks,
Clément
More information about the Binutils
mailing list