diff options
| author | Rui Ueyama <ruiu@google.com> | 2018-08-01 22:31:31 +0000 |
|---|---|---|
| committer | Rui Ueyama <ruiu@google.com> | 2018-08-01 22:31:31 +0000 |
| commit | 5530f234f52fb9167a6cc7ebf33e96e50a44a214 (patch) | |
| tree | ed473a14e12b8a1b970f3a0ea7dbfa826b517d15 | |
| parent | 842bdd0071df8bd810fc963e8a1924af7fe14f55 (diff) | |
| download | bcm5719-llvm-5530f234f52fb9167a6cc7ebf33e96e50a44a214.tar.gz bcm5719-llvm-5530f234f52fb9167a6cc7ebf33e96e50a44a214.zip | |
Re-submit r338596 with a bug fix and a test.
llvm-svn: 338647
| -rw-r--r-- | lld/ELF/Driver.cpp | 11 | ||||
| -rw-r--r-- | lld/test/ELF/oformat-binary.s | 1 |
2 files changed, 5 insertions, 7 deletions
diff --git a/lld/ELF/Driver.cpp b/lld/ELF/Driver.cpp index 693dba64ab5..76b338d178d 100644 --- a/lld/ELF/Driver.cpp +++ b/lld/ELF/Driver.cpp @@ -497,14 +497,11 @@ static Target2Policy getTarget2(opt::InputArgList &Args) { } static bool isOutputFormatBinary(opt::InputArgList &Args) { - if (auto *Arg = Args.getLastArg(OPT_oformat)) { - StringRef S = Arg->getValue(); - if (S == "binary") - return true; - if (S.startswith("elf")) - return false; + StringRef S = Args.getLastArgValue(OPT_oformat, "elf"); + if (S == "binary") + return true; + if (!S.startswith("elf")) error("unknown --oformat value: " + S); - } return false; } diff --git a/lld/test/ELF/oformat-binary.s b/lld/test/ELF/oformat-binary.s index e68f07c5773..22a25f04c64 100644 --- a/lld/test/ELF/oformat-binary.s +++ b/lld/test/ELF/oformat-binary.s @@ -20,6 +20,7 @@ # ERR: unknown --oformat value: foo # RUN: ld.lld -o /dev/null %t --oformat elf +# RUN: ld.lld -o /dev/null %t --oformat elf-foo .text .align 4 |

