q/src/config/config.go
2024-08-14 17:49:07 +02:00

50 lines
1.0 KiB
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 decides the alignment of the sections and it must be a multiple of the page size.
Align = 0x1000
// The code offset is the offset of the executable machine code within the file.
CodeOffset = Align
)
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"
}
}
//