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

            Bug ID: 31969
           Summary: [RISCV] -static -pie produces GOT dependent code
           Product: binutils
           Version: 2.41
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: ld
          Assignee: unassigned at sourceware dot org
          Reporter: alexey.lapshin at espressif dot com
  Target Milestone: ---

after compiling a code with `-fpie` option:

```
reset_vector:
    la      t0, _vector_table
    csrw    mtvec, t0
    call    _vector_table
    j       __start
```

And linking with `-static -pie --no-dynamic-linker` I got:

```
00000080 <reset_vector>:
      80:       00001297                auipc   t0,0x1
      84:       4d82a283                lw      t0,1240(t0) # 1558
<_GLOBAL_OFFSET_TABLE_+0x4>  # Why not PC-relative ?
      88:       30529073                csrw    mtvec,t0
      8c:       3f95                    jal     0 <_vector_table> # PC-relative
- nice.
      8e:       a009                    j       90 <__start>
```

referencing to _GLOBAL_OFFSET_TABLE_, it seems to be only dynamic linking
feature why does it appear for static linking?

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

Reply via email to