[LLVMdev] Hwo to guess PC-relative offset

Tim Northover t.p.northover at gmail.com
Tue Jun 30 08:02:21 PDT 2015


On 30 June 2015 at 06:23, HEITZMANN Frédéric 218168
<frederic.heitzmann at cea.fr> wrote:
> Is there a way to tell llvm to put the constant in .text section ?

You'd need some kind of stubbed version of ConstantIslands that just
put the islands at the beginning or end of a function. It would be
much simpler than the ARM version though (at least initially), most of
the complexity comes from finite reachability.

But there's a lot to be said for just letting it stay in .rodata. The
linker's going to be doing that kind of job anyway, so just let it get
on with resolving offsets. Both x86 and AArch64 take this approach (in
AArch64's case despite there being explicit instructions in the
architecture designed to handle inline constants -- we just decided it
wasn't worth the aggro of duplicating ARM's ConstantIsland mess so
they're unused in LLVM).

Cheers.

Tim.




More information about the llvm-dev mailing list