mirror of
https://github.com/Ed94/Odin.git
synced 2026-07-29 10:50:05 +00:00
add support for linux_riscv64 and freestanding_riscv64
This commit is contained in:
@@ -5,7 +5,7 @@ for features regarding microarchitecture and target features of the compiler.
|
||||
|
||||
It is not pretty! But LLVM has no way to query this information with their C API.
|
||||
|
||||
It generates these globals (intended for `src/build_settings.cpp`:
|
||||
It generates these globals (intended for `src/build_settings_microarch.cpp`:
|
||||
|
||||
- `target_microarch_list`: an array of strings indexed by the architecture, each string is a comma-seperated list of microarchitectures available on that architecture
|
||||
- `target_features_list`: an array of strings indexed by the architecture, each string is a comma-seperated list of target features available on that architecture
|
||||
@@ -23,6 +23,6 @@ does not impact much at all, the only thing it will do is make LLVM print a mess
|
||||
## Usage
|
||||
|
||||
1. Make sure the table of architectures at the top of the python script is up-to-date (the triple can be any valid triple for the architecture)
|
||||
1. `./build.sh`
|
||||
1. `./build_featuregen.sh`
|
||||
1. `python3 featuregen.py`
|
||||
1. Copy the output into `src/build_settings.cpp`
|
||||
|
||||
Executable
+5
@@ -0,0 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -ex
|
||||
|
||||
$(llvm-config --bindir)/clang++ $(llvm-config --cxxflags --ldflags --libs) featuregen.cpp -o featuregen
|
||||
@@ -4,12 +4,13 @@ import os
|
||||
import sys
|
||||
|
||||
archs = [
|
||||
("amd64", "linux_amd64", "x86_64-pc-linux-gnu", [], []),
|
||||
("i386", "linux_i386", "i386-pc-linux-gnu", [], []),
|
||||
("arm32", "linux_arm32", "arm-linux-gnu", [], []),
|
||||
("arm64", "linux_arm64", "aarch64-linux-elf", [], []),
|
||||
("wasm32", "js_wasm32", "wasm32-js-js", [], []),
|
||||
("wasm64p32", "js_wasm64p32","wasm32-js-js", [], []),
|
||||
("amd64", "linux_amd64", "x86_64-pc-linux-gnu", [], []),
|
||||
("i386", "linux_i386", "i386-pc-linux-gnu", [], []),
|
||||
("arm32", "linux_arm32", "arm-linux-gnu", [], []),
|
||||
("arm64", "linux_arm64", "aarch64-linux-elf", [], []),
|
||||
("wasm32", "js_wasm32", "wasm32-js-js", [], []),
|
||||
("wasm64p32", "js_wasm64p32", "wasm32-js-js", [], []),
|
||||
("riscv64", "linux_riscv64", "riscv64-linux-gnu", [], []),
|
||||
];
|
||||
|
||||
SEEKING_CPUS = 0
|
||||
@@ -78,7 +79,8 @@ print("\t// TargetArch_Invalid:")
|
||||
print('\tstr_lit(""),')
|
||||
for arch, target, triple, cpus, features in archs:
|
||||
print(f"\t// TargetArch_{arch}:")
|
||||
print(f'\tstr_lit("{','.join(cpus)}"),')
|
||||
cpus_str = ','.join(cpus)
|
||||
print(f'\tstr_lit("{cpus_str}"),')
|
||||
print("};")
|
||||
|
||||
print("")
|
||||
@@ -89,7 +91,8 @@ print("\t// TargetArch_Invalid:")
|
||||
print('\tstr_lit(""),')
|
||||
for arch, target, triple, cpus, features in archs:
|
||||
print(f"\t// TargetArch_{arch}:")
|
||||
print(f'\tstr_lit("{','.join(features)}"),')
|
||||
features_str = ','.join(features)
|
||||
print(f'\tstr_lit("{features_str}"),')
|
||||
print("};")
|
||||
|
||||
print("")
|
||||
|
||||
Reference in New Issue
Block a user