add noinhibit exec option

llvm-svn: 172204
This commit is contained in:
Shankar Easwaran 2013-01-11 15:11:47 +00:00
parent af96edbad2
commit 7381db059a
6 changed files with 16 additions and 6 deletions

View File

@ -116,7 +116,8 @@ struct LinkerOptions {
, _entrySymbol(std::move(other._entrySymbol))
, _relocatable(other._relocatable)
, _outputCommands(other._outputCommands)
, _outputYAML(other._outputYAML) {}
, _outputYAML(other._outputYAML)
, _noInhibitExec(other._noInhibitExec) {}
std::vector<LinkerInput> _input;
std::vector<std::string> _llvmArgs;
@ -127,6 +128,7 @@ struct LinkerOptions {
/// \brief -###
unsigned _outputCommands : 1;
unsigned _outputYAML : 1;
unsigned _noInhibitExec : 1;
private:
LinkerOptions(const LinkerOptions&) LLVM_DELETED_FUNCTION;

View File

@ -11,3 +11,6 @@ def relocatable : Flag<["-"], "relocatable">;
def OCTOTHORPE_OCTOTHORPE_OCTOTHORPE : Flag<["-"], "###">;
def emit_yaml : Flag<["-"], "emit-yaml">;
def noinhibit_exec : Flag<["-"], "noinhibit-exec">,
HelpText<"Retain the executable output file whenever it is still usable">;

View File

@ -146,6 +146,9 @@ public:
if (llvm::opt::Arg *A = _inputArgs->getLastArg(ld::OPT_emit_yaml))
newArgs->AddFlagArg(A, _core.getOption(core::OPT_emit_yaml));
if (llvm::opt::Arg *A = _inputArgs->getLastArg(ld::OPT_noinhibit_exec))
newArgs->AddFlagArg(A, _core.getOption(core::OPT_noinhibit_exec));
// Copy input args.
for (llvm::opt::arg_iterator it = _inputArgs->filtered_begin(ld::OPT_INPUT),
ie = _inputArgs->filtered_end();
@ -228,6 +231,7 @@ LinkerOptions lld::generateOptions(const llvm::opt::ArgList &args) {
ret._relocatable = args.hasArg(core::OPT_relocatable);
ret._outputCommands = args.hasArg(core::OPT_OCTOTHORPE_OCTOTHORPE_OCTOTHORPE);
ret._outputYAML = args.hasArg(core::OPT_emit_yaml);
ret._noInhibitExec = args.hasArg(core::OPT_noinhibit_exec);
return std::move(ret);
}

View File

@ -23,3 +23,6 @@ def m : Separate<["-"], "m">;
def static : Flag<["-"], "static">;
def L : Joined<["-"], "L">;
def noinhibit_exec : Flag<["--"], "noinhibit-exec">,
HelpText<"Retain the executable output file whenever it is still usable">;

View File

@ -67,11 +67,11 @@ void LinkerInvocation::operator()() {
}
struct Blah : ResolverOptions {
Blah()
Blah(const LinkerOptions &options)
: ResolverOptions() {
_undefinesAreErrors = true;
_undefinesAreErrors = !options._noInhibitExec;
}
} ro;
} ro(_options);
auto writer = target->getWriter();

View File

@ -1,2 +0,0 @@
# Will fail with unersolved symbol
RUN: lld -flavor ld -target x86_64-linux || exit 0