[lld] 2d077d6 - [ELF] Make TargetInfo::writeIgotPlt a no-op
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 10 10:02:24 PST 2020
Author: Fangrui Song
Date: 2020-01-10T09:59:22-08:00
New Revision: 2d077d6dfa7909a21293ebdac81488367628e0fa
URL: https://github.com/llvm/llvm-project/commit/2d077d6dfa7909a21293ebdac81488367628e0fa
DIFF: https://github.com/llvm/llvm-project/commit/2d077d6dfa7909a21293ebdac81488367628e0fa.diff
LOG: [ELF] Make TargetInfo::writeIgotPlt a no-op
RELA targets don't read initial .got.plt entries.
REL targets (ARM, x86-32) write the address of the IFUNC resolver to the
entry (`write32le(buf, s.getVA())`).
The default writeIgotPlt() is not meaningful. Make it a no-op. AArch64
and x86-64 will have 0 as initial .got.plt entries associated with
IFUNC.
Reviewed By: peter.smith
Differential Revision: https://reviews.llvm.org/D72474
Added:
Modified:
lld/ELF/Target.cpp
lld/ELF/Target.h
lld/test/ELF/aarch64-gnu-ifunc-plt.s
lld/test/ELF/gnu-ifunc-plt.s
Removed:
################################################################################
diff --git a/lld/ELF/Target.cpp b/lld/ELF/Target.cpp
index aaae89bd087f..70a68fd8db9e 100644
--- a/lld/ELF/Target.cpp
+++ b/lld/ELF/Target.cpp
@@ -150,10 +150,6 @@ bool TargetInfo::inBranchRange(RelType type, uint64_t src, uint64_t dst) const {
return true;
}
-void TargetInfo::writeIgotPlt(uint8_t *buf, const Symbol &s) const {
- writeGotPlt(buf, s);
-}
-
RelExpr TargetInfo::adjustRelaxExpr(RelType type, const uint8_t *data,
RelExpr expr) const {
return expr;
diff --git a/lld/ELF/Target.h b/lld/ELF/Target.h
index 7284bfd39b89..72067366b875 100644
--- a/lld/ELF/Target.h
+++ b/lld/ELF/Target.h
@@ -32,7 +32,7 @@ class TargetInfo {
virtual void writeGotPltHeader(uint8_t *buf) const {}
virtual void writeGotHeader(uint8_t *buf) const {}
virtual void writeGotPlt(uint8_t *buf, const Symbol &s) const {};
- virtual void writeIgotPlt(uint8_t *buf, const Symbol &s) const;
+ virtual void writeIgotPlt(uint8_t *buf, const Symbol &s) const {}
virtual int64_t getImplicitAddend(const uint8_t *buf, RelType type) const;
virtual int getTlsGdRelaxSkip(RelType type) const { return 1; }
diff --git a/lld/test/ELF/aarch64-gnu-ifunc-plt.s b/lld/test/ELF/aarch64-gnu-ifunc-plt.s
index 08a6c4941450..91e812950d2f 100644
--- a/lld/test/ELF/aarch64-gnu-ifunc-plt.s
+++ b/lld/test/ELF/aarch64-gnu-ifunc-plt.s
@@ -23,8 +23,8 @@
// GOTPLT: Contents of section .got.plt:
// GOTPLT-NEXT: 230440 00000000 00000000 00000000 00000000
// GOTPLT-NEXT: 230450 00000000 00000000 f0022100 00000000
-// GOTPLT-NEXT: 230460 f0022100 00000000 f0022100 00000000
-// GOTPLT-NEXT: 230470 f0022100 00000000
+// GOTPLT-NEXT: 230460 f0022100 00000000 00000000 00000000
+// GOTPLT-NEXT: 230470 00000000 00000000
// Check that the PLTRELSZ tag does not include the IRELATIVE relocations
// CHECK: DynamicSection [
diff --git a/lld/test/ELF/gnu-ifunc-plt.s b/lld/test/ELF/gnu-ifunc-plt.s
index 2fad0b1de6b9..3d0cec038a9c 100644
--- a/lld/test/ELF/gnu-ifunc-plt.s
+++ b/lld/test/ELF/gnu-ifunc-plt.s
@@ -25,8 +25,8 @@
// GOTPLT: Contents of section .got.plt:
// GOTPLT-NEXT: 203430 40232000 00000000 00000000 00000000
// GOTPLT-NEXT: 203440 00000000 00000000 06132000 00000000
-// GOTPLT-NEXT: 203450 16132000 00000000 26132000 00000000
-// GOTPLT-NEXT: 203460 36132000 00000000
+// GOTPLT-NEXT: 203450 16132000 00000000 00000000 00000000
+// GOTPLT-NEXT: 203460 00000000 00000000
// Check that the PLTRELSZ tag does not include the IRELATIVE relocations
// CHECK: DynamicSection [
More information about the llvm-commits
mailing list