Implement --build-id=none.

Both bfd and gold have this. It allows disabling build-id when it is the
default with by adding -Wl,--build-id=none no the clang command line.

llvm-svn: 268435
This commit is contained in:
Rafael Espindola 2016-05-03 20:55:47 +00:00
parent 1e4ba37df1
commit c5b8ed241d
2 changed files with 7 additions and 3 deletions

View File

@ -381,11 +381,13 @@ void LinkerDriver::readConfigs(opt::InputArgList &Args) {
Config->BuildId = BuildIdKind::Fnv1;
if (auto *Arg = Args.getLastArg(OPT_build_id_eq)) {
StringRef S = Arg->getValue();
if (S == "md5") {
if (S == "md5")
Config->BuildId = BuildIdKind::Md5;
} else if (S == "sha1") {
else if (S == "sha1")
Config->BuildId = BuildIdKind::Sha1;
} else
else if (S == "none")
Config->BuildId = BuildIdKind::None;
else
error("unknown --build-id style: " + S);
}

View File

@ -9,6 +9,8 @@
# RUN: llvm-objdump -s %t2 | FileCheck -check-prefix=SHA1 %s
# RUN: ld.lld %t -o %t2
# RUN: llvm-objdump -s %t2 | FileCheck -check-prefix=NONE %s
# RUN: ld.lld --build-id=md5 --build-id=none %t -o %t2
# RUN: llvm-objdump -s %t2 | FileCheck -check-prefix=NONE %s
.globl _start
_start: