[PATCH] D51834: [ELF] Don't emit .relr.dyn section if there are no relocs
Petr Hosek via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 10 14:30:34 PDT 2018
phosek updated this revision to Diff 164751.
phosek marked an inline comment as done.
Repository:
rLLD LLVM Linker
https://reviews.llvm.org/D51834
Files:
lld/ELF/SyntheticSections.h
lld/test/ELF/empty-pack-dyn-relocs.s
Index: lld/test/ELF/empty-pack-dyn-relocs.s
===================================================================
--- /dev/null
+++ lld/test/ELF/empty-pack-dyn-relocs.s
@@ -0,0 +1,11 @@
+// REQUIRES: x86
+
+// RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
+// RUN: ld.lld -pie --pack-dyn-relocs=relr %t.o -o %t
+// RUN: llvm-readobj -sections %t | FileCheck %s
+
+.global _start
+_start:
+ nop
+
+# CHECK-NOT: Name: .relr.dyn
Index: lld/ELF/SyntheticSections.h
===================================================================
--- lld/ELF/SyntheticSections.h
+++ lld/ELF/SyntheticSections.h
@@ -536,6 +536,7 @@
class RelrBaseSection : public SyntheticSection {
public:
RelrBaseSection();
+ bool empty() const override { return Relocs.empty(); }
std::vector<RelativeReloc> Relocs;
};
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D51834.164751.patch
Type: text/x-patch
Size: 817 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180910/77d3998b/attachment.bin>
More information about the llvm-commits
mailing list