[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug ld/24685] New: [RISCV] R_RISCV_CALL_PLT should not create a canonic
From: |
maskray at google dot com |
Subject: |
[Bug ld/24685] New: [RISCV] R_RISCV_CALL_PLT should not create a canonical PLT in -no-pie mode |
Date: |
Sat, 15 Jun 2019 08:41:25 +0000 |
https://sourceware.org/bugzilla/show_bug.cgi?id=24685
Bug ID: 24685
Summary: [RISCV] R_RISCV_CALL_PLT should not create a canonical
PLT in -no-pie mode
Product: binutils
Version: 2.33 (HEAD)
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: ld
Assignee: unassigned at sourceware dot org
Reporter: maskray at google dot com
Target Milestone: ---
A canonical PLT (the term is not widely used. I just saw it used by a few
people) in an executable has a section index of SHN_UNDEF but a non-zero
st_value. It is only used for pointer equality. Dynamic loaders
(musl/glibc/etc) resolve the symbol value to the canonical PLT.
% cat a.c
#include <stdio.h>
int main(){puts("hello");}
% riscv-gcc -fuse-ld=bfd -fpie -pie a.c -o a && readelf -W --dyn-s a | grep
puts
2: 0000000000000000 0 FUNC GLOBAL DEFAULT UND puts
% riscv-gcc -fuse-ld=bfd -fpie -no-pie a.c -o a && readelf -W --dyn-s a | grep
puts
1: 0000000000010420 0 FUNC GLOBAL DEFAULT UND puts
-fpie/-fpic produces an R_RISCV_CALL_PLT relocation. Because puts is not taken
address, its address in the executable is insignificant, the canonical PLT is
not necessary.
Other architectures (e.g. R_386_PC32 R_X86_64_PLT32 R_PPC64_REL24) don't create
a canonical PLT in this case, e.g.:
% gcc -fuse-ld=bfd -fpie -pie a.c -o a && readelf -W --dyn-s a | grep puts
2: 0000000000000000 0 FUNC GLOBAL DEFAULT UND puts@GLIBC_2.2.5 (2)
% gcc -fuse-ld=bfd -fpie -no-pie a.c -o a && readelf -W --dyn-s a | grep puts
1: 0000000000000000 0 FUNC GLOBAL DEFAULT UND puts@GLIBC_2.2.5 (2)
The semantics of R_RISCV_CALL_PLT need some refinement. A proposal to deprecate
R_RISCV_CALL is reported at
https://github.com/riscv/riscv-elf-psabi-doc/issues/98
--
You are receiving this mail because:
You are on the CC list for the bug.
- [Bug ld/24685] New: [RISCV] R_RISCV_CALL_PLT should not create a canonical PLT in -no-pie mode,
maskray at google dot com <=