[PATCH] D70695: [ELF] Support input section description .rel[a].dyn in /DISCARD/

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 25 21:51:59 PST 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rGa71c1e2a576a: [ELF] Support input section description .rel[a].dyn in /DISCARD/ (authored by MaskRay).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D70695/new/

https://reviews.llvm.org/D70695

Files:
  lld/ELF/LinkerScript.cpp
  lld/test/ELF/linkerscript/discard-section-err.s


Index: lld/test/ELF/linkerscript/discard-section-err.s
===================================================================
--- lld/test/ELF/linkerscript/discard-section-err.s
+++ lld/test/ELF/linkerscript/discard-section-err.s
@@ -20,8 +20,19 @@
 # RUN: ld.lld -pie -o %t --script %t.script %t.o
 
 # RUN: echo "SECTIONS { /DISCARD/ : { *(.rela.dyn) } }" > %t.script
-# RUN: not ld.lld -pie -o %t --script %t.script %t.o 2>&1 | \
-# RUN:   FileCheck -check-prefix=RELADYN %s
-# RELADYN: discarding .rela.dyn section is not allowed
+# RUN: ld.lld -pie -o %t %t.o
+# RUN: llvm-readobj -S %t | FileCheck --check-prefix=RELADYN %s
+# RELADYN: Name: .rela.dyn
+# RUN: ld.lld -pie -o %t --script %t.script %t.o
+# RUN: llvm-readobj -S %t | FileCheck /dev/null --implicit-check-not='Name: .rela.dyn'
+
+# RUN: echo "SECTIONS { /DISCARD/ : { *(.relr.dyn) } }" > %t.script
+# RUN: not ld.lld -pie --pack-dyn-relocs=relr -o %t --script %t.script %t.o 2>&1 | \
+# RUN:   FileCheck -check-prefix=RELRDYN %s
+# RELRDYN: discarding .relr.dyn section is not allowed
 
-.comm foo,4,4
+.data
+.align 8
+foo:
+## Emits an R_X86_64_RELATIVE in -pie mode.
+.quad foo
Index: lld/ELF/LinkerScript.cpp
===================================================================
--- lld/ELF/LinkerScript.cpp
+++ lld/ELF/LinkerScript.cpp
@@ -442,7 +442,7 @@
 }
 
 void LinkerScript::discard(InputSectionBase *s) {
-  if (s == in.shStrTab || s == mainPart->relaDyn || s == mainPart->relrDyn)
+  if (s == in.shStrTab || s == mainPart->relrDyn)
     error("discarding " + s->name + " section is not allowed");
 
   // You can discard .hash and .gnu.hash sections by linker scripts. Since


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D70695.231003.patch
Type: text/x-patch
Size: 1652 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191126/0a9be91d/attachment.bin>


More information about the llvm-commits mailing list