[llvm] r263521 - [MachO] Add MachO alt-entry directive support.

Rafael EspĂ­ndola via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 22 13:12:11 PDT 2016


On 22 March 2016 at 15:31, Lang Hames <lhames at gmail.com> wrote:
> Hi Rafael,
>
>> If the expected result is that bar is *not* .alt_entry because it has
>> the same value as foo than I think you will need to search the symbol
>> table in MC.
>
>
> This is the desired behavior for now. Recognizing 'label' and 'label + C'
> where C == 0 is a good approximation to it. Where this fails we get an
> extraneous .alt_entry bit set. I don't believe that is dangerous in
> practice, but it's not desired output (yet).
>
> Longer term, I believe the plan is to ensure that ld64 accepts .alt_entry
> bits on aliases of the form foo = bar, then we can just set the .alt_entry
> bit wherever we see a non-constant expression.

So, if approximating, the idea of given

bar:
...
foo = expr

evaluating expr and seeing if it simplifies to bar is definitely a
better approximation than doing it in codegen.

If you want you can actually avoid adding the flag in all cases by
checking if any one symbol has that value by keeping a hash table of
all symbol values.

Cheers,
Rafael


More information about the llvm-commits mailing list