[patch] Fix pr21328.

Nick Kledzik kledzik at apple.com
Mon Nov 3 16:49:59 PST 2014


On Nov 1, 2014, at 6:28 PM, Rafael EspĂ­ndola <rafael.espindola at gmail.com> wrote:

> That PR reduces to us producing a relocation for
> 
>  .section foo,bar
> La:
> Lb:
> .long   La-Lb
> 
> but not for
> 
>  .section foo,bar
> zed:
> La:
> Lb:
> .long   La-Lb
> 
> because we don't consider the space before the first visible symbol to
> be an atom. 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.

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

-Nick





More information about the llvm-commits mailing list