Add OS field to Target
This commit is contained in:
parent
10246f7268
commit
92ad52b2aa
|
@ -16,8 +16,13 @@ type Target struct {
|
|||
// of the Word type.
|
||||
WordSize uint64
|
||||
|
||||
// Arch specifies the machine architecture
|
||||
// Arch specifies the machine architecture. Values must correspond
|
||||
// directly to those recognized by LLVM in a target triple.
|
||||
Arch string
|
||||
|
||||
// OS specifies the machine operating system. Values must correspond
|
||||
// directly to those recognized by LLVM in a target triple.
|
||||
OS string
|
||||
}
|
||||
|
||||
type generator struct {
|
||||
|
|
|
@ -4,7 +4,14 @@ package native
|
|||
|
||||
import "git.tebibyte.media/fspl/fspl/generator"
|
||||
|
||||
// LLVM supported operating systems (note: capitalization is wrong)
|
||||
// https://llvm.org/doxygen/Triple_8h_source.html
|
||||
// GOOS and GOARCH values:
|
||||
// https://go.dev/doc/install/source#environment
|
||||
|
||||
// NativeTarget returns a target describing the current system.
|
||||
func NativeTarget () generator.Target {
|
||||
return nativeTarget()
|
||||
target := nativeArch()
|
||||
target.OS = nativeOS()
|
||||
return target
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ package native
|
|||
|
||||
import "git.tebibyte.media/fspl/fspl/generator"
|
||||
|
||||
func nativeTarget () generator.Target {
|
||||
func nativeArch () generator.Target {
|
||||
return generator.Target {
|
||||
WordSize: 32,
|
||||
Arch: "i386",
|
||||
|
|
|
@ -2,7 +2,7 @@ package native
|
|||
|
||||
import "git.tebibyte.media/fspl/fspl/generator"
|
||||
|
||||
func nativeTarget () generator.Target {
|
||||
func nativeArch () generator.Target {
|
||||
return generator.Target {
|
||||
WordSize: 64,
|
||||
Arch: "x86_64",
|
||||
|
|
|
@ -2,7 +2,7 @@ package native
|
|||
|
||||
import "git.tebibyte.media/fspl/fspl/generator"
|
||||
|
||||
func nativeTarget () generator.Target {
|
||||
func nativeArch () generator.Target {
|
||||
// this may not be accurate, can't find info online about amd64p32
|
||||
return generator.Target {
|
||||
WordSize: 32,
|
||||
|
|
|
@ -2,7 +2,7 @@ package native
|
|||
|
||||
import "git.tebibyte.media/fspl/fspl/generator"
|
||||
|
||||
func nativeTarget () generator.Target {
|
||||
func nativeArch () generator.Target {
|
||||
return generator.Target {
|
||||
WordSize: 32,
|
||||
Arch: "arm",
|
||||
|
|
|
@ -2,7 +2,7 @@ package native
|
|||
|
||||
import "git.tebibyte.media/fspl/fspl/generator"
|
||||
|
||||
func nativeTarget () generator.Target {
|
||||
func nativeArch () generator.Target {
|
||||
return generator.Target {
|
||||
WordSize: 64,
|
||||
Arch: "aarch64",
|
||||
|
|
|
@ -2,7 +2,7 @@ package native
|
|||
|
||||
import "git.tebibyte.media/fspl/fspl/generator"
|
||||
|
||||
func nativeTarget () generator.Target {
|
||||
func nativeArch () generator.Target {
|
||||
return generator.Target {
|
||||
WordSize: 64,
|
||||
Arch: "aarch64_be",
|
||||
|
|
|
@ -2,7 +2,7 @@ package native
|
|||
|
||||
import "git.tebibyte.media/fspl/fspl/generator"
|
||||
|
||||
func nativeTarget () generator.Target {
|
||||
func nativeArch () generator.Target {
|
||||
return generator.Target {
|
||||
WordSize: 32,
|
||||
Arch: "armeb",
|
||||
|
|
|
@ -2,7 +2,7 @@ package native
|
|||
|
||||
import "git.tebibyte.media/fspl/fspl/generator"
|
||||
|
||||
func nativeTarget () generator.Target {
|
||||
func nativeArch () generator.Target {
|
||||
return generator.Target {
|
||||
WordSize: 32,
|
||||
Arch: "mips",
|
||||
|
|
|
@ -2,7 +2,7 @@ package native
|
|||
|
||||
import "git.tebibyte.media/fspl/fspl/generator"
|
||||
|
||||
func nativeTarget () generator.Target {
|
||||
func nativeArch () generator.Target {
|
||||
return generator.Target {
|
||||
WordSize: 64,
|
||||
Arch: "mips64",
|
||||
|
|
|
@ -2,7 +2,7 @@ package native
|
|||
|
||||
import "git.tebibyte.media/fspl/fspl/generator"
|
||||
|
||||
func nativeTarget () generator.Target {
|
||||
func nativeArch () generator.Target {
|
||||
return generator.Target {
|
||||
WordSize: 64,
|
||||
Arch: "mips64el",
|
||||
|
|
|
@ -2,7 +2,7 @@ package native
|
|||
|
||||
import "git.tebibyte.media/fspl/fspl/generator"
|
||||
|
||||
func nativeTarget () generator.Target {
|
||||
func nativeArch () generator.Target {
|
||||
return generator.Target {
|
||||
WordSize: 32,
|
||||
Arch: "mipsel",
|
||||
|
|
|
@ -2,7 +2,7 @@ package native
|
|||
|
||||
import "git.tebibyte.media/fspl/fspl/generator"
|
||||
|
||||
func nativeTarget () generator.Target {
|
||||
func nativeArch () generator.Target {
|
||||
return generator.Target {
|
||||
WordSize: 32,
|
||||
Arch: "ppc32",
|
||||
|
|
|
@ -2,7 +2,7 @@ package native
|
|||
|
||||
import "git.tebibyte.media/fspl/fspl/generator"
|
||||
|
||||
func nativeTarget () generator.Target {
|
||||
func nativeArch () generator.Target {
|
||||
return generator.Target {
|
||||
WordSize: 64,
|
||||
Arch: "ppc64",
|
||||
|
|
|
@ -2,7 +2,7 @@ package native
|
|||
|
||||
import "git.tebibyte.media/fspl/fspl/generator"
|
||||
|
||||
func nativeTarget () generator.Target {
|
||||
func nativeArch () generator.Target {
|
||||
return generator.Target {
|
||||
WordSize: 64,
|
||||
Arch: "ppc64le",
|
||||
|
|
|
@ -2,7 +2,7 @@ package native
|
|||
|
||||
import "git.tebibyte.media/fspl/fspl/generator"
|
||||
|
||||
func nativeTarget () generator.Target {
|
||||
func nativeArch () generator.Target {
|
||||
return generator.Target {
|
||||
WordSize: 32,
|
||||
Arch: "riscv32",
|
||||
|
|
|
@ -2,7 +2,7 @@ package native
|
|||
|
||||
import "git.tebibyte.media/fspl/fspl/generator"
|
||||
|
||||
func nativeTarget () generator.Target {
|
||||
func nativeArch () generator.Target {
|
||||
return generator.Target {
|
||||
WordSize: 32,
|
||||
Arch: "sparc",
|
||||
|
|
|
@ -2,7 +2,7 @@ package native
|
|||
|
||||
import "git.tebibyte.media/fspl/fspl/generator"
|
||||
|
||||
func nativeTarget () generator.Target {
|
||||
func nativeArch () generator.Target {
|
||||
return generator.Target {
|
||||
WordSize: 64,
|
||||
Arch: "sparcv9",
|
||||
|
|
|
@ -2,7 +2,7 @@ package native
|
|||
|
||||
import "git.tebibyte.media/fspl/fspl/generator"
|
||||
|
||||
func nativeTarget () generator.Target {
|
||||
func nativeArch () generator.Target {
|
||||
// FIXME: golang doesn't discern between 32/64 bit wasm so we assume 64
|
||||
// bit here
|
||||
return generator.Target {
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
package native
|
||||
|
||||
func nativeOS () string {
|
||||
return "aix"
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
package native
|
||||
|
||||
func nativeOS () string {
|
||||
return "linux"
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
package native
|
||||
|
||||
func nativeOS () string {
|
||||
return "darwin"
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
package native
|
||||
|
||||
func nativeOS () string {
|
||||
return "dragonfly"
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
package native
|
||||
|
||||
func nativeOS () string {
|
||||
return "freebsd"
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
package native
|
||||
|
||||
func nativeOS () string {
|
||||
// does not seem to be supported by LLVM at the moment
|
||||
return "illumos"
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
package native
|
||||
|
||||
func nativeOS () string {
|
||||
return "ios"
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
package native
|
||||
|
||||
func nativeOS () string {
|
||||
return "unknown"
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
package native
|
||||
|
||||
func nativeOS () string {
|
||||
return "linux"
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
package native
|
||||
|
||||
func nativeOS () string {
|
||||
return "nacl"
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
package native
|
||||
|
||||
func nativeOS () string {
|
||||
return "netbsd"
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
package native
|
||||
|
||||
func nativeOS () string {
|
||||
return "openbsd"
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
package native
|
||||
|
||||
func nativeOS () string {
|
||||
// does not seem to be supported by LLVM at the moment
|
||||
return "plan9"
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
package native
|
||||
|
||||
func nativeOS () string {
|
||||
return "solaris"
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
package native
|
||||
|
||||
func nativeOS () string {
|
||||
return "win32"
|
||||
}
|
Loading…
Reference in New Issue