[llvm-commits] Atom alignment

Evandro Menezes emenezes at codeaurora.org
Tue Oct 23 08:34:29 PDT 2012


On 10/23/12 07:43, Sid Manning wrote:
> @@ -640,9 +636,20 @@
>           symbolData = llvm::ArrayRef<uint8_t>((uint8_t *)symbolContents.data()
>                                       + (*si)->st_value, contentSize);
>   
> +        // Alignment will be equal to st_value when the symbol is a
> +        // common symbol, otherwise equal to the lesser of either the
> +        // section's alignment or the symbol's original alignment.
> +        uint64_t alignment;
> +        if (isCommon)
> +          alignment = (*si)->st_value;
> +        else if ((*si)->st_value == 0)
> +          alignment = (i.first)->sh_addralign;
> +        else if ((alignment =
> +                 (1 << (llvm::CountTrailingZeros_64((*si)->st_value) - 1))) >
Do not subtract one from the number of trailing zeros, lest you end up 
with a negative shift count.  And you also need to indent this line by 
one space.
> +                 (i.first)->sh_addralign)
> +          alignment = (i.first)->sh_addralign;
>   
>           unsigned int referenceStart = _references.size();
> -
>           // Only relocations that are inside the domain of the atom are
>           // added.
HTH

-- 
Evandro Menezes          Austin, TX          emenezes at codeaurora.org
Qualcomm Innovation Center, Inc is a member of the Code Aurora Forum




More information about the llvm-commits mailing list