[LLVMdev] [PATCH] Symbol offsets
Rafael EspĂndola
rafael.espindola at gmail.com
Wed Jul 23 08:39:34 PDT 2014
On 20 July 2014 18:18, Ben Gamari <bgamari.foss at gmail.com> wrote:
> Rafael EspĂndola <rafael.espindola at gmail.com> writes:
>
>> Now that aliases can have any expressions, can't you use something like
>>
>> @data = private global [2 x i32] [i32 42, i32 43]
>> @symbol = alias getelementptr ([2 x i32]* @data, i32 0, i32 1)
>>
>> This produces
>>
>> .Ldata:
>> .long 42 # 0x2a
>> .long 43 # 0x2b
>> ...
>> .globl symbol
>> symbol = .Ldata+4
>>
>> That is, in the object file there is only one symbol (named symbol)
>> and it is at offset 4.
>>
> How would one define the body of the function `symbol` in this case?
I don't think it would work. For LLVM generated "data" (like function
bodies) it seems something like the prefix feature is what is needed.
Cheers,
Rafael
More information about the llvm-dev
mailing list