Bug 26222 - Support 64-bit PC relative relocation (R_MIPS_PC64 via R_MIPS_PC32/R_MIPS_64/R_MIPS_NONE)
Summary: Support 64-bit PC relative relocation (R_MIPS_PC64 via R_MIPS_PC32/R_MIPS_64...
Status: UNCONFIRMED
Alias: None
Product: binutils
Classification: Unclassified
Component: gas (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-07-09 05:19 UTC by Fangrui Song
Modified: 2020-07-09 05:19 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Fangrui Song 2020-07-09 05:19:49 UTC
% cat a.s
.globl foo
foo:

.data
.quad foo-.

% mips64el-linux-gnuabi64-as a.s -o a.o
a.s: Assembler messages:
a.s:5: Error: PC-relative reference to a different section

# See https://sourceware.org/pipermail/binutils/2020-February/110231.html
# Since https://reviews.llvm.org/D80390
# will be available in LLVM/clang 11.0.0
% llvm-mc -filetype=obj -triple=mips64el a.s -o a.o
% readelf -Wr a.o

Relocation section '.rela.data' at offset 0xc0 contains 1 entry:
    Offset             Info             Type               Symbol's Value  Symbol's Name + Addend
0000000000000000  00000001000012f8 R_MIPS_PC32            0000000000000000 foo + 0
                    Type2: R_MIPS_64        
                    Type3: R_MIPS_NONE

Having a way to specify 64-bit PC relative relocation will be valuable. I have seen several places where we have to use SHF_WRITE+R_MIPS_64 due to the lack of R_MIPS_PC64