[patch] Fix pr21328.

Nick Kledzik kledzik at apple.com
Tue Nov 4 12:32:28 PST 2014


On Nov 4, 2014, at 11:58 AM, Rafael EspĂ­ndola <rafael.espindola at gmail.com> wrote:

>> 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).

Then LGTM.

-Nick



More information about the llvm-commits mailing list