bug-binutils
[Top][All Lists]
Advanced

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

[Bug ld/24983] New: RISC-V GP linker relaxation is not performed with -n


From: bmeng.cn at gmail dot com
Subject: [Bug ld/24983] New: RISC-V GP linker relaxation is not performed with -nostdlib
Date: Tue, 10 Sep 2019 05:07:54 +0000

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

            Bug ID: 24983
           Summary: RISC-V GP linker relaxation is not performed with
                    -nostdlib
           Product: binutils
           Version: 2.30
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: ld
          Assignee: unassigned at sourceware dot org
          Reporter: bmeng.cn at gmail dot com
  Target Milestone: ---

See the following test case
$ cat test.c
int a = 1;

int main()
{
    return a;
}

Building the test case with "-nostdlib" seems to disable the GP linker
relaxation:
$ riscv64-unknown-linux-gnu-gcc test.c -o test -nostdlib
$ riscv64-unknown-linux-gnu-objdump -d test | grep gp
<return nothing>

But if we compile test.c without "-nostdlib":
$ riscv64-unknown-linux-gnu-gcc test.c -o test
$ riscv64-unknown-linux-gnu-objdump -d test | grep gp
   103bc:       00002197                auipc   gp,0x2
   103c0:       46418193                addi    gp,gp,1124 # 12820
<__global_pointer$>
   1041c:       8141c783                lbu     a5,-2028(gp) # 12034 <_edata>
   1042a:       80f18a23                sb      a5,-2028(gp) # 12034 <_edata>
   10440:       8101a783                lw      a5,-2032(gp) # 12030 <a>

Note: this bug was previously filed in GCC bugzila, and it was suggested it
should be filed against binutils.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91713

-- 
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]