[PATCH] Add default parameter to MCSymbol accessors to control IsUsed

Rafael EspĂ­ndola via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 25 06:26:22 PDT 2015


Taking a look.

On 21 August 2015 at 17:34, Vedant Kumar <vsk at apple.com> wrote:
> Ping
>
> We were discussing "invalid reassignment to non-absolute variable" and whether we still need it around.
>
> thanks
> vedant
>
>> On Aug 13, 2015, at 9:31 AM, Vedant Kumar <vsk at apple.com> wrote:
>>
>> Hi Rafael,
>>
>> Sorry for the delay on this.
>>
>>> I think that dates from the early days of MC. My understanding is that
>>> it was added just as a safety so that we have to reason about code
>>> like
>>>
>>> foo = bar
>>> .long foo
>>> foo = zed
>>> .long foo
>>>
>>> Should that produce two relocations with bar, two with foo or one each?
>>
>> Here is what GAS does:
>>
>> SYMBOL TABLE:
>> 00000000 l    d  .text        00000000 .text
>> 00000000 l    d  .data        00000000 .data
>> 00000000 l    d  .bss 00000000 .bss
>> 00000000         *UND*        00000000 bar
>> 00000000         *UND*        00000000 zed
>>
>> RELOCATION RECORDS FOR [.text]:
>> OFFSET   TYPE              VALUE
>> 00000000 R_386_32          bar
>> 00000004 R_386_32          zed
>>
>> Here is a different test that initially triggered this issue:
>>
>>> foo = bar
>>> .long foo
>>> foo = bar
>>> .long foo
>>
>>
>> And here is GAS's output:
>>
>> RELOCATION RECORDS FOR [.text]:
>> OFFSET   TYPE              VALUE
>> 00000000 R_386_32          bar
>> 00000004 R_386_32          bar
>>
>> With the patch I suggested, both of these examples just work with llvm-mc. Here's what the relocation table looks like on Darwin for comparison:
>>
>> Relocation information (__TEXT,__text) 2 entries
>> address  pcrel length extern type    scattered symbolnum/value
>> 00000004 0     2      1      0       0         1
>> 00000000 0     2      1      0       0         1
>>
>> This looks sane to me. I've updated the patch to get rid of the "invalid reassignment to non-absolute variable" error and fixed the test cases. Could you review it for any issues?
>>
>> thanks
>> vedant
>>
>> <MCSymbol-patch1-NFC.patch><MCSymbol-patch2.patch>
>


More information about the llvm-commits mailing list