diff options
| author | 2022-08-24 07:04:02 +0200 | |
|---|---|---|
| committer | 2022-08-24 07:04:02 +0200 | |
| commit | d5c61681198527d70bc95f8ed10f19e881ac51b3 (patch) | |
| tree | 5e82ecd7d5197cdf2c7c96ac628436fe1beff37f /src/targ.cff | |
| parent | e5ed3b20351a2715fe88d9a5dbcc8e6757fe96aa (diff) | |
arch stuff
Diffstat (limited to 'src/targ.cff')
| -rw-r--r-- | src/targ.cff | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/targ.cff b/src/targ.cff index c5fc093..f0b500b 100644 --- a/src/targ.cff +++ b/src/targ.cff @@ -31,3 +31,17 @@ extern fn targ_ini(name *const u8) bool { } return #f; } + +extern fn triple2targ(triple *const u8) *const u8 { + let arch = (do + let delim = strstr(triple, "-"); + delim ? triple[0::delim - triple] : spanz(triple); + ); + let rest = arch.#ptr + arch.#len; + defmacro archp(s) [ (strncmp(s, arch.#ptr, arch.#len) == 0) ] + defmacro restp(s) [ (strstr(rest, s) != #null) ] + switch { + case archp("x86_64") and !restp("windows"); return "amd64-sysv"; + } + return #null; +} |