[PATCH] D37008: [ELF] - Do not allow --dynamic-list and --version-script together.
George Rimar via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 22 05:04:51 PDT 2017
grimar created this revision.
Herald added a subscriber: emaste.
In PR34057 was mentioned that currently we have difference
in behavior with ld.bfd when these options are used together.
LLD implements --dynamic-list as simplified version script.
It is generally unclear why would someone want to use them together.
And also currently it complains (warns) about having a duplicate symbol 'f'
in version script if `f` present both in dynamic list and version script, what
is not nice either.
It was suggested in comments to restrict such a combination,
and it seems reasonable solution to me.
https://reviews.llvm.org/D37008
Files:
ELF/Driver.cpp
test/ELF/version-script.s
Index: test/ELF/version-script.s
===================================================================
--- test/ELF/version-script.s
+++ test/ELF/version-script.s
@@ -38,9 +38,11 @@
# RUN: FileCheck -check-prefix=WARN2 %s
# WARN2: duplicate symbol 'foo1' in version script
+## --dynamic-list and --version-script may not be used together.
# RUN: echo "{ foo1; foo2; };" > %t.list
-# RUN: ld.lld --version-script %t.script --dynamic-list %t.list %t.o %t2.so -o %t2
-# RUN: llvm-readobj %t2 > /dev/null
+# RUN: not ld.lld --version-script %t.script --dynamic-list %t.list %t.o \
+# RUN: %t2.so -o %t2 2>&1 | FileCheck -check-prefix=ERR3 %s
+# ERR3: --version-script and --dynamic-list may not be used together
# DSO: DynamicSymbols [
# DSO-NEXT: Symbol {
Index: ELF/Driver.cpp
===================================================================
--- ELF/Driver.cpp
+++ ELF/Driver.cpp
@@ -276,6 +276,9 @@
if (Config->Pie)
error("-r and -pie may not be used together");
}
+
+ if (Args.hasArg(OPT_version_script) && Args.hasArg(OPT_dynamic_list))
+ error("--version-script and --dynamic-list may not be used together");
}
static int getInteger(opt::InputArgList &Args, unsigned Key, int Default) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D37008.112152.patch
Type: text/x-patch
Size: 1233 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170822/7e2ab929/attachment.bin>
More information about the llvm-commits
mailing list