aboutsummaryrefslogtreecommitdiff
path: root/lld/ELF/SyntheticSections.cpp
diff options
context:
space:
mode:
authorFangrui Song <i@maskray.me>2022-01-12 11:55:22 -0800
committerFangrui Song <i@maskray.me>2022-01-12 11:55:22 -0800
commitbf9c8636f2cd1c5e6338402b67de06f9ce74cdd9 (patch)
tree3b437bf83bfb318bf4122beff8c23ec64ae77983 /lld/ELF/SyntheticSections.cpp
parentf6fab68c30622b7c97b0d21b5ea02809210444eb (diff)
downloadllvm-bf9c8636f2cd1c5e6338402b67de06f9ce74cdd9.zip
llvm-bf9c8636f2cd1c5e6338402b67de06f9ce74cdd9.tar.gz
llvm-bf9c8636f2cd1c5e6338402b67de06f9ce74cdd9.tar.bz2
[ELF] Support discarding .relr.dyn
db08df0570b6dfaf00d7b1b8555c1d2d4effb224 does not work because part.relrDyn is a unique_ptr and `reset` destroys the object which may still be referenced. This commit uses the D114180 approach. Also improve the test to check that there is no R_X86_64_RELATIVE.
Diffstat (limited to 'lld/ELF/SyntheticSections.cpp')
-rw-r--r--lld/ELF/SyntheticSections.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/lld/ELF/SyntheticSections.cpp b/lld/ELF/SyntheticSections.cpp
index d0f3c87..680281f 100644
--- a/lld/ELF/SyntheticSections.cpp
+++ b/lld/ELF/SyntheticSections.cpp
@@ -1412,7 +1412,8 @@ DynamicSection<ELFT>::computeContents() {
addInt(isRela ? DT_RELACOUNT : DT_RELCOUNT, numRelativeRels);
}
}
- if (part.relrDyn && !part.relrDyn->relocs.empty()) {
+ if (part.relrDyn && part.relrDyn->getParent() &&
+ !part.relrDyn->relocs.empty()) {
addInSec(config->useAndroidRelrTags ? DT_ANDROID_RELR : DT_RELR,
*part.relrDyn);
addInt(config->useAndroidRelrTags ? DT_ANDROID_RELRSZ : DT_RELRSZ,