diff options
| author | Peter Collingbourne <peter@pcc.me.uk> | 2017-05-23 21:16:48 +0000 |
|---|---|---|
| committer | Peter Collingbourne <peter@pcc.me.uk> | 2017-05-23 21:16:48 +0000 |
| commit | 968fe938031846b58bd2980d51cb9053b820ac2d (patch) | |
| tree | ad6274cb0ee087b613f6da259da3d93cf59ff732 /lld/ELF/Driver.cpp | |
| parent | 4e382f9ee962322d32cf92841c3eb093e15a089b (diff) | |
| download | bcm5719-llvm-968fe938031846b58bd2980d51cb9053b820ac2d.tar.gz bcm5719-llvm-968fe938031846b58bd2980d51cb9053b820ac2d.zip | |
ELF: The later of --build-id and --build-id= wins.
If the compiler driver passes --build-id and the user uses -Wl to
pass --build-id= then the user's flag should take precedence.
Differential Revision: https://reviews.llvm.org/D33461
llvm-svn: 303689
Diffstat (limited to 'lld/ELF/Driver.cpp')
| -rw-r--r-- | lld/ELF/Driver.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lld/ELF/Driver.cpp b/lld/ELF/Driver.cpp index 737c6a6bf11..a15e88b313e 100644 --- a/lld/ELF/Driver.cpp +++ b/lld/ELF/Driver.cpp @@ -572,10 +572,14 @@ static std::pair<bool, bool> getHashStyle(opt::InputArgList &Args) { // -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) + return {BuildIdKind::None, {}}; + + 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") |

