zig cc: detect -mcpu, -march, -mtune

However these are all treated like zig's -mcpu parameter.

See #4784
This commit is contained in:
Andrew Kelley 2020-04-01 18:05:06 -04:00
parent eefb0a36c0
commit 4848b28ec8
No known key found for this signature in database
GPG Key ID: 7C5F548F728501A9
5 changed files with 49 additions and 11 deletions

View File

@ -1658,7 +1658,7 @@ sepd1("Zlinker-input"),
.{
.name = "library-directory",
.syntax = .separate,
.zig_equivalent = .linker_input_l,
.zig_equivalent = .lib_dir,
.pd1 = false,
.pd2 = true,
.psl = false,
@ -4534,7 +4534,7 @@ joinpd1("target-sdk-version="),
.{
.name = "library-directory=",
.syntax = .joined,
.zig_equivalent = .linker_input_l,
.zig_equivalent = .lib_dir,
.pd1 = false,
.pd2 = true,
.psl = false,
@ -5254,8 +5254,22 @@ joinpd1("fixit="),
joinpd1("gstabs"),
joinpd1("gxcoff"),
jspd1("iquote"),
joinpd1("march="),
joinpd1("mtune="),
.{
.name = "march=",
.syntax = .joined,
.zig_equivalent = .mcpu,
.pd1 = true,
.pd2 = false,
.psl = false,
},
.{
.name = "mtune=",
.syntax = .joined,
.zig_equivalent = .mcpu,
.pd1 = true,
.pd2 = false,
.psl = false,
},
.{
.name = "rtlib=",
.syntax = .joined,
@ -5320,7 +5334,14 @@ joinpd1("gcoff"),
joinpd1("mabi="),
joinpd1("mabs="),
joinpd1("masm="),
joinpd1("mcpu="),
.{
.name = "mcpu=",
.syntax = .joined,
.zig_equivalent = .mcpu,
.pd1 = true,
.pd2 = false,
.psl = false,
},
joinpd1("mfpu="),
joinpd1("mhvx="),
joinpd1("mmcu="),
@ -5635,7 +5656,7 @@ jspd1("J"),
.{
.name = "L",
.syntax = .joined_or_separate,
.zig_equivalent = .linker_input_l,
.zig_equivalent = .lib_dir,
.pd1 = true,
.pd2 = false,
.psl = false,

View File

@ -1288,7 +1288,8 @@ pub const ClangArgIterator = extern struct {
verbose_cmds,
for_linker,
linker_input_z,
linker_input_l,
lib_dir,
mcpu,
};
const Args = struct {

View File

@ -735,9 +735,12 @@ static int main0(int argc, char **argv) {
linker_args.append(buf_create_from_str("-z"));
linker_args.append(buf_create_from_str(it.only_arg));
break;
case Stage2ClangArgLinkerInputL:
case Stage2ClangArgLibDir:
lib_dirs.append(it.only_arg);
break;
case Stage2ClangArgMCpu:
mcpu = it.only_arg;
break;
}
}
// Parse linker args

View File

@ -347,7 +347,8 @@ enum Stage2ClangArg {
Stage2ClangArgVerboseCmds,
Stage2ClangArgForLinker,
Stage2ClangArgLinkerInputZ,
Stage2ClangArgLinkerInputL,
Stage2ClangArgLibDir,
Stage2ClangArgMCpu,
};
// ABI warning

View File

@ -176,11 +176,23 @@ const known_options = [_]KnownOpt{
},
.{
.name = "L",
.ident = "linker_input_l",
.ident = "lib_dir",
},
.{
.name = "library-directory",
.ident = "linker_input_l",
.ident = "lib_dir",
},
.{
.name = "mcpu",
.ident = "mcpu",
},
.{
.name = "march",
.ident = "mcpu",
},
.{
.name = "mtune",
.ident = "mcpu",
},
};