integrate target features into building assembly code

This brings us up to par from what stage1 does. There will still be an
open issue for completing this.
This commit is contained in:
Andrew Kelley
2020-09-14 23:03:13 -07:00
parent 1ad60c4386
commit 6e9396e32b
2 changed files with 15 additions and 5 deletions

View File

@@ -1,4 +1,3 @@
* integrate target features into building assembly code
* handle .d files from c objects
* glibc .so files
* support rpaths in ELF linker code
@@ -46,3 +45,4 @@
* improve robustness of response file parsing
* there are a couple panic("TODO") in clang options parsing
* std.testing needs improvement to support exposing directory path for its tmp dir (look for "bogus")
* integrate target features into building assembly code

View File

@@ -1241,10 +1241,20 @@ fn addCCArgs(
},
.so, .assembly, .ll, .bc, .unknown => {},
}
// TODO CLI args for cpu features when compiling assembly
//for (size_t i = 0; i < g->zig_target->llvm_cpu_features_asm_len; i += 1) {
// try argv.append(g->zig_target->llvm_cpu_features_asm_ptr[i]);
//}
// Argh, why doesn't the assembler accept the list of CPU features?!
// I don't see a way to do this other than hard coding everything.
switch (target.cpu.arch) {
.riscv32, .riscv64 => {
if (std.Target.riscv.featureSetHas(target.cpu.features, .relax)) {
try argv.append("-mrelax");
} else {
try argv.append("-mno-relax");
}
},
else => {
// TODO
},
}
if (target.os.tag == .freestanding) {
try argv.append("-ffreestanding");