[llvm] r254917 - Link declaration lazily.

Rafael EspĂ­ndola via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 9 11:19:39 PST 2015


On 9 December 2015 at 12:33, Tobias Edler Von Koch
<tobias at codeaurora.org> wrote:
> Hi Rafael,
>
> On 12/08/2015 08:25 PM, Rafael EspĂ­ndola via llvm-commits wrote:
>>
>> Note that the behaviour was not "preserve all globals". We were
>> already lazy linking declarations that can be dropped, like
>> linkonce_odr and internal.
>
>
> We're actually hitting an issue related to that. Our linker, during LTO,
> sometimes puts linkonce/linkonce_odr functions on the preserve list.
> However, this has currently no effect as they could be deleted a) during
> lazy IR linking if there are no uses to begin with, or b) during DCE if,
> say, they were inlined completely.
>
> To handle case b) we can introduce a use through @llvm.compiler.used in
> LTOCodeGenerator::applyRestriction but for a) that doesn't work because IR
> linking happens earlier.
>
> Any ideas?

Yes :-)

Check what the gold plugin does. If the gold linker asks for a value
to be preserved, it is changed to a weak/weak_odr to make sure it
survives all of the pipeline.

Cheers,
Rafael


More information about the llvm-commits mailing list