diff options
-rw-r--r-- | lld/ELF/Driver.cpp | 3 | ||||
-rw-r--r-- | lld/test/ELF/strip-all.s | 3 |
2 files changed, 6 insertions, 0 deletions
diff --git a/lld/ELF/Driver.cpp b/lld/ELF/Driver.cpp index 88376b5340c..8996386e99a 100644 --- a/lld/ELF/Driver.cpp +++ b/lld/ELF/Driver.cpp @@ -314,6 +314,9 @@ static void checkOptions() { 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"); diff --git a/lld/test/ELF/strip-all.s b/lld/test/ELF/strip-all.s index f322119b0db..7e05ba81608 100644 --- a/lld/test/ELF/strip-all.s +++ b/lld/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: |