44 lines
823 B
Go
Raw Normal View History

2023-10-29 12:24:40 +01:00
package config
2024-08-12 12:16:01 +02:00
import "runtime"
2023-10-29 12:24:40 +01:00
const (
2024-07-13 14:18:55 +02:00
// This is the absolute virtual minimum address we can load a program at, see `sysctl vm.mmap_min_addr`.
MinAddress = 0x10000
// The base address is the virtual address for our ELF file.
2023-10-29 12:24:40 +01:00
BaseAddress = 0x40 * MinAddress
)
2023-10-31 21:13:14 +01:00
var (
2024-07-29 14:44:16 +02:00
// Shows the assembly instructions at the end of the compilation.
2024-08-12 12:16:01 +02:00
Assembler bool
2024-07-29 14:44:16 +02:00
// Calculates the result of operations on constants at compile time.
2024-08-12 12:16:01 +02:00
ConstantFold bool
2024-07-29 14:44:16 +02:00
// Skips writing the executable to disk.
2024-08-12 12:16:01 +02:00
Dry bool
// Target architecture.
TargetArch string
// Target platform.
TargetOS string
2023-10-31 21:13:14 +01:00
)
2024-08-12 12:16:01 +02:00
// Reset resets the configuration to its default values.
func Reset() {
Assembler = false
ConstantFold = true
Dry = false
TargetArch = runtime.GOARCH
TargetOS = runtime.GOOS
if TargetOS == "darwin" {
TargetOS = "mac"
}
}
2024-08-13 19:34:54 +02:00
//