[patch] Fix pr21328.

Rafael EspĂ­ndola rafael.espindola at gmail.com
Tue Nov 4 11:58:45 PST 2014


> My understanding is that it is a regular atom and no
>> relocation is necessary.
> To the linker, if the section does not start at a symbol, there is an implicit atom at the start of the section that goes up to the first symbol.

Perfect!

>>
>> If that is the case, the attached patch fixes the bug.
>
>>    A_Base = FA->getAtom();
>> -  if (!A_Base)
>> -    return false;
>> -
>>    B_Base = FB.getAtom();
>> -  if (!B_Base)
>> -    return false;
>>
>>    // If the atoms are the same, they are guaranteed to have the same address.
>>    if (A_Base == B_Base)
> Is there any other case where getAtom() would return NULL?  (other that the fragment is at the start of a section).  If so, this changes the behavior in that case.

Given how MCMachOStreamer::FinishImpl is setting the atoms it seems to
me that the only fragments with null atoms are those before any symbol
in the section. I think the only difference caused by this patch is
when comparing to fragments that come before any symbol (that is, the
intended change).

Cheers,
Rafael



More information about the llvm-commits mailing list