bug-binutils
[Top][All Lists]
Advanced

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

[Bug ld/27566] New: [RISC-V] relocation truncated to fit: R_RISCV_GPREL_


From: address@hidden
Subject: [Bug ld/27566] New: [RISC-V] relocation truncated to fit: R_RISCV_GPREL_I against aymbol
Date: Fri, 12 Mar 2021 03:19:48 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=27566

            Bug ID: 27566
           Summary: [RISC-V] relocation truncated to fit: R_RISCV_GPREL_I
                    against aymbol
           Product: binutils
           Version: 2.36
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: ld
          Assignee: unassigned at sourceware dot org
          Reporter: lifang_xia@c-sky.com
  Target Milestone: ---

Here is case(It is not the orignal case, the original is that gp can't get the
.LANCHOR. I made this case simpler.):
===========================================
.option nopic

        .section        .rodata
        .align  10
.Lpadding0:
      .zero   0x10

        .section        .rodata
        .align  3
        .globl hello_rodata
        .set hello_rodata, . + 0x1800
.Lpadding:
        .zero   128

        .section .init_array
        .type   padding_init_array, @object
        .size   padding_init_array, 0x100
        .globl padding_init_array
padding_init_array:
        .zero 0x100

        .text
        .align  1
        .globl  main
        .type   main, @function
main:
        lui     a5,%hi(hello_rodata)
        addi    a5,a5,%lo(hello_rodata)
        .size   main, .-main
============================================================
The binutils
commit: ebdcad3fddf6ec21f6d4dcc702379a12718cf0c4
config: "../configure --target=riscv64-unknown-linux
target_alias=riscv64-unknown-linux"

============================================================
build case
./gas/as-new -o a.o a.s
./ld/ld-new -z relro -o a a.o -e main
=============================================================
In this case, the gp can access hello_rodata while relaxing. But the symbols
defined after ". = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT
(COMMONPAGESIZE));"(link file) may be increased with the paddings when
finishing lang_size_relro_segment. And the gp may not accessing the symbols.

In my opinion, if the symbol is not defined in data segment(between ". =
DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));" and ".
= DATA_SEGMENT_END (.);"), it should not convert to GPREL_I when linking with
"-z relro"

-- 
You are receiving this mail because:
You are on the CC list for the bug.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]