[LLVMdev] [PATCH] Symbol offsets

Ben Gamari bgamari.foss at gmail.com
Tue Jul 15 10:26:03 PDT 2014


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.
>
I believe we could but I'll have to try implementing it to know for
certain. Thanks for the suggestion!

Cheers,

- Ben

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 472 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140715/9940d4be/attachment.sig>


More information about the llvm-dev mailing list