[PATCH] D33461: ELF: The later of --build-id and --build-id= wins.
Peter Collingbourne via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue May 23 14:08:23 PDT 2017
pcc created this revision.
Herald added a subscriber: emaste.
If the compiler driver passes --build-id and the user uses -Wl to
pass --build-id= then the user's flag should take precedence.
https://reviews.llvm.org/D33461
Files:
lld/ELF/Driver.cpp
lld/test/ELF/build-id.s
Index: lld/test/ELF/build-id.s
===================================================================
--- lld/test/ELF/build-id.s
+++ lld/test/ELF/build-id.s
@@ -33,6 +33,10 @@
# RUN: ld.lld --build-id=md5 --build-id=none %t -o %t2
# RUN: llvm-objdump -s %t2 | FileCheck -check-prefix=NONE %s
+# RUN: ld.lld --build-id --build-id=none %t -o %t2 -no-threads
+# RUN: llvm-objdump -s %t2 | FileCheck -check-prefix=NONE %s
+# RUN: ld.lld --build-id=none --build-id %t -o %t2 -no-threads
+# RUN: llvm-objdump -s %t2 | FileCheck -check-prefix=DEFAULT %s
.globl _start
_start:
Index: lld/ELF/Driver.cpp
===================================================================
--- lld/ELF/Driver.cpp
+++ lld/ELF/Driver.cpp
@@ -572,10 +572,11 @@
// -build-id=sha1 are actually tree hashes for performance reasons.
static std::pair<BuildIdKind, std::vector<uint8_t>>
getBuildId(opt::InputArgList &Args) {
- if (Args.hasArg(OPT_build_id))
+ auto *Arg = Args.getLastArg(OPT_build_id, OPT_build_id_eq);
+ if (Arg->getOption().getID() == OPT_build_id)
return {BuildIdKind::Fast, {}};
- StringRef S = getString(Args, OPT_build_id_eq, "none");
+ StringRef S = Arg->getValue();
if (S == "md5")
return {BuildIdKind::Md5, {}};
if (S == "sha1" || S == "tree")
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D33461.99987.patch
Type: text/x-patch
Size: 1266 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170523/09914c4d/attachment.bin>
More information about the llvm-commits
mailing list