[lld] r341870 - [ELF] Don't emit .relr.dyn section if there are no relocs
Petr Hosek via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 10 14:54:56 PDT 2018
Author: phosek
Date: Mon Sep 10 14:54:56 2018
New Revision: 341870
URL: http://llvm.org/viewvc/llvm-project?rev=341870&view=rev
Log:
[ELF] Don't emit .relr.dyn section if there are no relocs
This resolves PR38875.
Differential Revision: https://reviews.llvm.org/D51834
Added:
lld/trunk/test/ELF/empty-pack-dyn-relocs.s
Modified:
lld/trunk/ELF/SyntheticSections.h
Modified: lld/trunk/ELF/SyntheticSections.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SyntheticSections.h?rev=341870&r1=341869&r2=341870&view=diff
==============================================================================
--- lld/trunk/ELF/SyntheticSections.h (original)
+++ lld/trunk/ELF/SyntheticSections.h Mon Sep 10 14:54:56 2018
@@ -536,6 +536,7 @@ struct RelativeReloc {
class RelrBaseSection : public SyntheticSection {
public:
RelrBaseSection();
+ bool empty() const override { return Relocs.empty(); }
std::vector<RelativeReloc> Relocs;
};
Added: lld/trunk/test/ELF/empty-pack-dyn-relocs.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/empty-pack-dyn-relocs.s?rev=341870&view=auto
==============================================================================
--- lld/trunk/test/ELF/empty-pack-dyn-relocs.s (added)
+++ lld/trunk/test/ELF/empty-pack-dyn-relocs.s Mon Sep 10 14:54:56 2018
@@ -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
More information about the llvm-commits
mailing list