[PATCH] D68441: Ignore --export-dynamic if --relocatable is given

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 8 00:29:29 PDT 2019


ruiu updated this revision to Diff 223793.
ruiu added a comment.
Herald added subscribers: dexonsmith, steven_wu, hiraditya.

- report error instead of ignoring -export-dynamic


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68441

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


Index: lld/test/ELF/lto/relocation-model.ll
===================================================================
--- lld/test/ELF/lto/relocation-model.ll
+++ lld/test/ELF/lto/relocation-model.ll
@@ -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.
 
Index: lld/test/ELF/driver.test
===================================================================
--- lld/test/ELF/driver.test
+++ lld/test/ELF/driver.test
@@ -50,6 +50,7 @@
 # RUN: not ld.lld -r -pie %t -o %tfail 2>&1 | FileCheck -check-prefix=ERR6 %s
 # ERR6: -r and -pie may not be used together
 
+## Attempt to use -shared and -pie together
 ## Attempt to use -shared and -pie together
 # RUN: not ld.lld -shared -pie %t -o %tfail 2>&1 | FileCheck -check-prefix=ERR7 %s
 # ERR7: -shared and -pie may not be used together
@@ -72,6 +73,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
Index: lld/ELF/Driver.cpp
===================================================================
--- lld/ELF/Driver.cpp
+++ lld/ELF/Driver.cpp
@@ -334,6 +334,8 @@
       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) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D68441.223793.patch
Type: text/x-patch
Size: 2189 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191008/e5a9abd1/attachment.bin>


More information about the llvm-commits mailing list