mirror of
https://github.com/intel/llvm.git
synced 2026-02-05 04:46:27 +08:00
Parse and store the value of the -O option.
llvm-svn: 251136
This commit is contained in:
@@ -66,6 +66,7 @@ struct Configuration {
|
||||
ELFKind EKind = ELFNoneKind;
|
||||
uint16_t EMachine = llvm::ELF::EM_NONE;
|
||||
uint64_t EntryAddr = -1;
|
||||
unsigned Optimize = 0;
|
||||
};
|
||||
|
||||
extern Configuration *Config;
|
||||
|
||||
@@ -156,6 +156,12 @@ void LinkerDriver::createFiles(opt::InputArgList &Args) {
|
||||
Config->SoName = getString(Args, OPT_soname);
|
||||
Config->Sysroot = getString(Args, OPT_sysroot);
|
||||
|
||||
if (auto *Arg = Args.getLastArg(OPT_O)) {
|
||||
StringRef Val = Arg->getValue();
|
||||
if (Val.getAsInteger(10, Config->Optimize))
|
||||
error("Invalid optimization level");
|
||||
}
|
||||
|
||||
if (auto *Arg = Args.getLastArg(OPT_hash_style)) {
|
||||
StringRef S = Arg->getValue();
|
||||
if (S == "gnu") {
|
||||
|
||||
@@ -12,6 +12,8 @@ def Bstatic: Flag<["-"], "Bstatic">,
|
||||
def L : Joined<["-"], "L">, MetaVarName<"<dir>">,
|
||||
HelpText<"Directory to search for libraries">;
|
||||
|
||||
def O : Joined<["-"], "O">, HelpText<"Optimize">;
|
||||
|
||||
def allow_multiple_definition: Flag<["--"], "allow-multiple-definition">,
|
||||
HelpText<"Allow multiple definitions">;
|
||||
|
||||
@@ -125,7 +127,6 @@ def alias_script_T : Separate<["-"], "T">, Alias<script>;
|
||||
def alias_undefined_u : Separate<["-"], "u">, Alias<undefined>;
|
||||
|
||||
// Options listed below are silently ignored now.
|
||||
def O3 : Flag<["-"], "O3">;
|
||||
def build_id : Flag<["--"], "build-id">;
|
||||
def eh_frame_hdr : Flag<["--"], "eh-frame-hdr">;
|
||||
def end_group : Flag<["--"], "end-group">;
|
||||
|
||||
Reference in New Issue
Block a user