zig cc: handle the -r flag

This makes -r treated the same as -c which is to output an object file.
Zig's ELF linker code already handles multiple object files into an
object file with the -r flag to LLD.

closes #11683
This commit is contained in:
Andrew Kelley 2023-04-07 15:13:33 -07:00
parent aa45854ec3
commit c22a30ac99
3 changed files with 32 additions and 19 deletions

View File

@ -4002,7 +4002,7 @@ flagpd1("malign-double"),
m("maltivec"),
flagpd1("mamdgpu-ieee"),
m("mamx-bf16"),
flagpd1("mamx-fp16"),
m("mamx-fp16"),
m("mamx-int8"),
m("mamx-tile"),
flagpd1("marm"),
@ -4027,10 +4027,10 @@ m("mavx512vl"),
m("mavx512vnni"),
m("mavx512vp2intersect"),
m("mavx512vpopcntdq"),
flagpd1("mavxifma"),
flagpd1("mavxneconvert"),
m("mavxifma"),
m("mavxneconvert"),
m("mavxvnni"),
flagpd1("mavxvnniint8"),
m("mavxvnniint8"),
flagpd1("mbackchain"),
flagpd1("mbig-endian"),
m("mbmi"),
@ -4039,6 +4039,7 @@ flagpd1("mbranch-likely"),
flagpd1("mbranch-target-enforce"),
flagpd1("mbranches-within-32B-boundaries"),
m("mbulk-memory"),
m("mcabac"),
flagpd1("mcheck-zero-division"),
m("mcldemote"),
m("mclflushopt"),
@ -4047,7 +4048,7 @@ m("mclzero"),
flagpd1("mcmodel=medany"),
flagpd1("mcmodel=medlow"),
m("mcmpb"),
flagpd1("mcmpccxadd"),
m("mcmpccxadd"),
flagpd1("mcmse"),
flagpd1("mcode-object-v3"),
flagpd1("mconstant-cfstrings"),
@ -4185,7 +4186,7 @@ m("mno-aes"),
m("mno-altivec"),
flagpd1("mno-amdgpu-ieee"),
m("mno-amx-bf16"),
flagpd1("mno-amx-fp16"),
m("mno-amx-fp16"),
m("mno-amx-int8"),
m("mno-amx-tile"),
m("mno-atomics"),
@ -4207,10 +4208,10 @@ m("mno-avx512vl"),
m("mno-avx512vnni"),
m("mno-avx512vp2intersect"),
m("mno-avx512vpopcntdq"),
flagpd1("mno-avxifma"),
flagpd1("mno-avxneconvert"),
m("mno-avxifma"),
m("mno-avxneconvert"),
m("mno-avxvnni"),
flagpd1("mno-avxvnniint8"),
m("mno-avxvnniint8"),
flagpd1("mno-backchain"),
m("mno-bmi"),
m("mno-bmi2"),
@ -4223,7 +4224,7 @@ m("mno-clflushopt"),
m("mno-clwb"),
m("mno-clzero"),
m("mno-cmpb"),
flagpd1("mno-cmpccxadd"),
m("mno-cmpccxadd"),
flagpd1("mno-code-object-v3"),
flagpd1("mno-constant-cfstrings"),
flagpd1("mno-constructor-aliases"),
@ -4249,7 +4250,7 @@ flagpd1("mno-fix-cortex-a72-aes-1655431"),
m("mno-float128"),
m("mno-fma"),
m("mno-fma4"),
flagpd1("mno-fmv"),
m("mno-fmv"),
flagpd1("mno-fp-ret-in-387"),
m("mno-fprnd"),
m("mno-fpu"),
@ -4322,13 +4323,13 @@ m("mno-popcntd"),
m("mno-power10-vector"),
m("mno-power8-vector"),
m("mno-power9-vector"),
flagpd1("mno-prefetchi"),
m("mno-prefetchi"),
m("mno-prefetchwt1"),
flagpd1("mno-prefixed"),
m("mno-prfchw"),
m("mno-ptwrite"),
flagpd1("mno-pure-code"),
flagpd1("mno-raoint"),
m("mno-raoint"),
m("mno-rdpid"),
m("mno-rdpru"),
m("mno-rdrnd"),
@ -4438,7 +4439,7 @@ m("mpower10-vector"),
m("mcrypto"),
m("mpower8-vector"),
m("mpower9-vector"),
flagpd1("mprefetchi"),
m("mprefetchi"),
m("mprefetchwt1"),
flagpd1("mprefixed"),
m("mprfchw"),
@ -4446,7 +4447,7 @@ m("mprivileged"),
m("mptwrite"),
flagpd1("mpure-code"),
flagpd1("mqdsp6-compat"),
flagpd1("mraoint"),
m("mraoint"),
m("mrdpid"),
m("mrdpru"),
m("mrdrnd"),
@ -4533,9 +4534,9 @@ m("mv67"),
flagpd1("mv67t"),
m("mv68"),
m("mv69"),
flagpd1("mv71"),
m("mv71"),
flagpd1("mv71t"),
flagpd1("mv73"),
m("mv73"),
m("mvaes"),
m("mvirt"),
m("mvis"),
@ -4950,7 +4951,14 @@ flagpd1("print-stats"),
flagpd1("private_bundle"),
flagpd1("pthread"),
flagpd1("pthreads"),
flagpd1("r"),
.{
.name = "r",
.syntax = .flag,
.zig_equivalent = .r,
.pd1 = true,
.pd2 = false,
.psl = false,
},
.{
.name = "rdynamic",
.syntax = .flag,

View File

@ -1569,7 +1569,7 @@ fn buildOutputType(
out_path = it.only_arg;
}
},
.c => c_out_mode = .object, // -c
.c, .r => c_out_mode = .object, // -c or -r
.asm_only => c_out_mode = .assembly, // -S
.preprocess_only => c_out_mode = .preprocessor, // -E
.emit_llvm => emit_llvm = true,
@ -5134,6 +5134,7 @@ pub const ClangArgIterator = struct {
target,
o,
c,
r,
m,
x,
other,

View File

@ -34,6 +34,10 @@ const known_options = [_]KnownOpt{
.name = "c",
.ident = "c",
},
.{
.name = "r",
.ident = "r",
},
.{
.name = "l",
.ident = "l",