[PATCH] D66704: [ELF] Error if --strip-all and --emit-relocs are used together

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Aug 25 23:23:26 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL369878: [ELF] Error if --strip-all and --emit-relocs are used together (authored by MaskRay, committed by ).

Repository:
  rL LLVM

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

https://reviews.llvm.org/D66704

Files:
  lld/trunk/ELF/Driver.cpp
  lld/trunk/test/ELF/strip-all.s


Index: lld/trunk/ELF/Driver.cpp
===================================================================
--- lld/trunk/ELF/Driver.cpp
+++ lld/trunk/ELF/Driver.cpp
@@ -314,6 +314,9 @@
   if (!config->relocatable && !config->defineCommon)
     error("-no-define-common not supported in non relocatable output");
 
+  if (config->strip == StripPolicy::All && config->emitRelocs)
+    error("--strip-all and --emit-relocs may not be used together");
+
   if (config->zText && config->zIfuncNoplt)
     error("-z text and -z ifunc-noplt may not be used together");
 
Index: lld/trunk/test/ELF/strip-all.s
===================================================================
--- lld/trunk/test/ELF/strip-all.s
+++ lld/trunk/test/ELF/strip-all.s
@@ -21,6 +21,9 @@
 #RUN: ld.lld %t.o -s -o %t1
 #RUN: llvm-objdump -section-headers %t1 | FileCheck %s -check-prefix AFTER
 
+# RUN: not ld.lld %t.o --strip-all --emit-relocs -o /dev/null 2>&1 | FileCheck --check-prefix=ERR %s
+# ERR: error: --strip-all and --emit-relocs may not be used together
+
 # exits with return code 42 on linux
 .globl _start
 _start:


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D66704.217082.patch
Type: text/x-patch
Size: 1094 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190826/e326fe9d/attachment.bin>


More information about the llvm-commits mailing list