[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:56:23 PDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rLLD341870: [ELF] Don't emit .relr.dyn section if there are no relocs (authored by phosek, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D51834?vs=164751&id=164753#toc

Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D51834

Files:
  ELF/SyntheticSections.h
  test/ELF/empty-pack-dyn-relocs.s


Index: ELF/SyntheticSections.h
===================================================================
--- ELF/SyntheticSections.h
+++ ELF/SyntheticSections.h
@@ -536,6 +536,7 @@
 class RelrBaseSection : public SyntheticSection {
 public:
   RelrBaseSection();
+  bool empty() const override { return Relocs.empty(); }
   std::vector<RelativeReloc> Relocs;
 };
 
Index: test/ELF/empty-pack-dyn-relocs.s
===================================================================
--- test/ELF/empty-pack-dyn-relocs.s
+++ 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


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D51834.164753.patch
Type: text/x-patch
Size: 820 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180910/0fcea2d6/attachment.bin>


More information about the llvm-commits mailing list