[lld] r374022 - Report error if -export-dynamic is used with -r

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 8 01:03:40 PDT 2019


Author: ruiu
Date: Tue Oct  8 01:03:40 2019
New Revision: 374022

URL: http://llvm.org/viewvc/llvm-project?rev=374022&view=rev
Log:
Report error if -export-dynamic is used with -r

The combination of the two flags doesn't make sense. And other linkers
seem to just ignore --export-dynamic if --relocatable is given, but
we probably should report it as an error to let users know that is
an invalid combination.

Fixes https://bugs.llvm.org/show_bug.cgi?id=43552

Differential Revision: https://reviews.llvm.org/D68441

Modified:
    lld/trunk/ELF/Driver.cpp
    lld/trunk/test/ELF/driver.test
    lld/trunk/test/ELF/lto/relocation-model.ll

Modified: lld/trunk/ELF/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Driver.cpp?rev=374022&r1=374021&r2=374022&view=diff
==============================================================================
--- lld/trunk/ELF/Driver.cpp (original)
+++ lld/trunk/ELF/Driver.cpp Tue Oct  8 01:03:40 2019
@@ -334,6 +334,8 @@ static void checkOptions() {
       error("-r and --icf may not be used together");
     if (config->pie)
       error("-r and -pie may not be used together");
+    if (config->exportDynamic)
+      error("-r and --export-dynamic may not be used together");
   }
 
   if (config->executeOnly) {

Modified: lld/trunk/test/ELF/driver.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/driver.test?rev=374022&r1=374021&r2=374022&view=diff
==============================================================================
--- lld/trunk/test/ELF/driver.test (original)
+++ lld/trunk/test/ELF/driver.test Tue Oct  8 01:03:40 2019
@@ -72,6 +72,10 @@
 # RUN: not ld.lld %t -z max-page-size 2>&1 | FileCheck -check-prefix=ERR11 %s
 # ERR11: unknown -z value: max-page-size
 
+## Attempt to use -r and --export-dynamic together
+# RUN: not ld.lld -r -export-dynamic %t -o %tfail 2>&1 | FileCheck -check-prefix=ERR12 %s
+# ERR12: -r and --export-dynamic may not be used together
+
 .globl _start
 _start:
   nop

Modified: lld/trunk/test/ELF/lto/relocation-model.ll
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/lto/relocation-model.ll?rev=374022&r1=374021&r2=374022&view=diff
==============================================================================
--- lld/trunk/test/ELF/lto/relocation-model.ll (original)
+++ lld/trunk/test/ELF/lto/relocation-model.ll Tue Oct  8 01:03:40 2019
@@ -14,9 +14,6 @@
 ; RUN: ld.lld %t.o -o %t-out -save-temps --export-dynamic --noinhibit-exec
 ; RUN: llvm-readobj -r %t-out.lto.o | FileCheck %s --check-prefix=STATIC
 
-; RUN: ld.lld %t.o -o %t-out -save-temps -r --export-dynamic
-; RUN: llvm-readobj -r %t-out.lto.o | FileCheck %s --check-prefix=STATIC
-
 
 ;; PIC source.
 
@@ -29,9 +26,6 @@
 ; RUN: ld.lld %t.pic.o -o %t-out -save-temps --export-dynamic --noinhibit-exec
 ; RUN: llvm-readobj -r %t-out.lto.o | FileCheck %s --check-prefix=STATIC
 
-; RUN: ld.lld %t.pic.o -o %t-out -save-temps -r --export-dynamic
-; RUN: llvm-readobj -r %t-out.lto.o | FileCheck %s --check-prefix=PIC
-
 
 ;; Explicit flag.
 




More information about the llvm-commits mailing list