riscv64 -mcmodel=medany relocation truncated to fit: R_RISCV_PCREL_HI20 against symbol ...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

I am facing an issue during linking when building code for riscv64 with gcc-15:


$ cat al.c 
int a[1];

__UINTPTR_TYPE__ foo(void)
{
        return (__UINTPTR_TYPE__)a + 0x7fffffff;
}

int main() {}
$ riscv64-unknown-linux-gnu-gcc-15 al.c -O -mcmodel=medany -save-temps
a-al.o: in function `foo':
al.c:(.text+0x0): relocation truncated to fit: R_RISCV_PCREL_HI20 against symbol `a' defined in .sbss section in a-al.o
collect2: error: ld returned 1 exit status


this seems to be caused by relocation:

$ objdump -r a-al.o

a-al.o:     file format elf64-littleriscv

RELOCATION RECORDS FOR [.text]:
OFFSET           TYPE              VALUE
0000000000000000 R_RISCV_PCREL_HI20  a+0x000000007fffffff
0000000000000000 R_RISCV_RELAX     *ABS*+0x000000007fffffff
0000000000000004 R_RISCV_PCREL_LO12_I  .L0 
0000000000000004 R_RISCV_RELAX     *ABS*
...



Is it an issue in gcc, binutils - or in the code?


Thank you,
Zdenek Sojka




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux