ARM64 Linaro toochain Link error ( R_AARCH64_LD_PREL_LO19 )

Hi Experts,

I am getting following linker error from Linaro aarch64 tool chain( aarch64-linux-gnu-gcc, gcc-linaro-aarch64-linux-gnu-4.8-2014.03_linux),  for our code which uses  pBitReverseIndex, pSignTable  global pointers which is declared out side the assembly file.

Linking CXX executable decoder-app

(.text+0x14): relocation truncated to fit: R_AARCH64_LD_PREL_LO19 against symbol `pBitReverseIndex' defined in .data.rel section in ../../../../*****.a(dct.c.o)

../../../..**********r.a(dct_opt.s.o): In function `dct':

(.text+0x20): relocation truncated to fit: R_AARCH64_LD_PREL_LO19 against symbol `pRevTable' defined in .data.rel section in ../../../../l*****r.a(dct.c.o)

../../../../lib-decoder/libhd-decoder.a(dct_opt.s.o): In function `dct':

(.text+0x28): relocation truncated to fit: R_AARCH64_LD_PREL_LO19 against symbol `pSignTable' defined in .data.rel section in ../../../..*******.a(dct.c.o)

../../../../****r.a(dct_opt.s.o): In function `L_PreRotateLoop':

collect2: error: ld returned 1 exit status

The DCT assembly function uses BitReverseIndex, SignTable, CosineTable etc. declared inside DCT.c

We are using LDR instruction inside assembly to load the address of these tables :

LDR                 x17, pSignTable

LDR                 x15, pRevTable

These tables and pointers are declared DCT.c

const Int32 SignTable[4]= {1, 1, 1, -1};

const Int8 RevTable[16]= {0,1,2,3,4,5,6,7,0xc,0xd,0xe,0xf,8,9,0xa,0xb};

const Int8* const pRevTable = RevTable;

const Int32* const pSignTable = SignTable;

We also tried with ADR instruction which satisfies position independent coding. But we couldn't fix this issue.

Parents
  • LDR x17,=SignTable


    will load the address of SignTable. I guess you actually didn't really want pSignTable

    The = is needed with LDR to put the address into a literal pool beside the code.

    See about literal pools and LTORG, and also ADRL and MOVL which are also useful for this sort of thing in the ARM compiler armasm User Guide or Reference Guide

    ADR and LDR with a label like you had are limited to using a label which is not too far away relative to the PC.

Reply
  • LDR x17,=SignTable


    will load the address of SignTable. I guess you actually didn't really want pSignTable

    The = is needed with LDR to put the address into a literal pool beside the code.

    See about literal pools and LTORG, and also ADRL and MOVL which are also useful for this sort of thing in the ARM compiler armasm User Guide or Reference Guide

    ADR and LDR with a label like you had are limited to using a label which is not too far away relative to the PC.

Children
More questions in this forum