[LLVMdev] [PATCH] Symbol offsets

Rafael EspĂ­ndola rafael.espindola at gmail.com
Tue Jun 10 16:30:34 PDT 2014


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.


On 27 May 2014 09:13, Ben Gamari <bgamari.foss at gmail.com> wrote:
>
> Somehow this cover letter was dropped from my symbol offsets patch set:
>
>   1. http://lists.cs.uiuc.edu/pipermail/llvmdev/2014-May/073200.html
>   2. http://lists.cs.uiuc.edu/pipermail/llvmdev/2014-May/073201.html
>
>
> Original message
> -----------------
>
> About a year ago a proposal suggesting symbol offsets was brought to
> this list[1]. This proposal goes hand-in-hand with the prefix data
> proposal[2] which has now been implemented and I believe both of these
> arose in part due to GHC's requirement to place its info tables before
> symbol definitions[3]. Unfortunately, the current implementation of
> prefix data isn't terribly useful to GHC without symbol offsets[4,5]
>
> This weekend I implemented option (2) in the original proposal, then
> eventually implemented option (1) on top of this. Here is the
> result. Note that this can also be found on Github[6] for those who
> prefer this.
>
> A review would be greatly appreciated. One known deficiency of this set
> is the lack of tests. Unfortunately, due to the use of temporary symbols
> it's not clear to me how this feature can be reliably tested. Ideas
> are welcome.
>
> Cheers,
>
> - Ben
>
>
> [1] http://lists.cs.uiuc.edu/pipermail/llvmdev/2013-April/061511.html
> [2] http://lists.cs.uiuc.edu/pipermail/llvmdev/2013-July/063909.html
> [3] http://lists.cs.uiuc.edu/pipermail/llvmdev/2012-February/047514.html
> [4] http://www.haskell.org/pipermail/ghc-devs/2013-September/002565.html
> [5] https://ghc.haskell.org/trac/ghc/ticket/4213#comment:12
> [6] https://github.com/bgamari/llvm/compare/symbol-offset
>
>
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>



More information about the llvm-dev mailing list