45 lines
923 B
Go

package config
import "runtime"
const (
// 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.
BaseAddress = 0x40 * MinAddress
// Align is the alignment of the sections and it must be a multiple of the page size.
Align = 0x1000
)
var (
// Shows the assembly instructions at the end of the compilation.
Assembler bool
// Calculates the result of operations on constants at compile time.
ConstantFold bool
// Skips writing the executable to disk.
Dry bool
// Target architecture.
TargetArch string
// Target platform.
TargetOS string
)
// 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"
}
}