[LLVMdev] [AArch64] Question about far call

Weiming Zhao weimingz at codeaurora.org
Thu Jun 19 18:01:17 PDT 2014


Hi, 

 

For the following code:

void  foo ();

int main () {foo();}

 

llvm emits "bl foo"

 

Then I set foo at a far address in linking:

aarch64-linux-gnu-gcc -Wl,--defsym=foo=0x80000000  a.o -o a.exe

 

I got an error from ld:

     a.c:(.text+0x8): relocation truncated to fit: R_AARCH64_CALL26 against
symbol `foo' define in *ABS* section in a.exe

 

The question is: do I miss some options or pragmas during compilation ?

Should I expect llvm to emit the following code?

                movz     x8, #:abs_g3:foo

                movk     x8, #:abs_g2_nc:foo

                movk     x8, #:abs_g1_nc:foo

                movk     x8, #:abs_g0_nc:foo

                ldr          x8, [x8]

                blr          x8

 

or I miss some flag during linking?

 

PS. The above test works fine with arm v7 targart. (clang emits "bl foo" and
ld generates veneer)

 

Thanks,

Weiming

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140619/f4af6377/attachment.html>


More information about the llvm-dev mailing list