Simplified executable file formats
This commit is contained in:
parent
1cb93b39a7
commit
999e60e294
29 changed files with 236 additions and 218 deletions
|
@ -10,11 +10,11 @@ import (
|
|||
"git.akyoto.dev/cli/q/src/asm"
|
||||
"git.akyoto.dev/cli/q/src/config"
|
||||
"git.akyoto.dev/cli/q/src/core"
|
||||
"git.akyoto.dev/cli/q/src/exe/elf"
|
||||
"git.akyoto.dev/cli/q/src/exe/macho"
|
||||
"git.akyoto.dev/cli/q/src/exe/pe"
|
||||
"git.akyoto.dev/cli/q/src/os/linux"
|
||||
"git.akyoto.dev/cli/q/src/os/linux/elf"
|
||||
"git.akyoto.dev/cli/q/src/os/mac"
|
||||
"git.akyoto.dev/cli/q/src/os/mac/macho"
|
||||
"git.akyoto.dev/cli/q/src/os/windows/pe"
|
||||
)
|
||||
|
||||
// Result contains all the compiled functions in a build.
|
||||
|
@ -147,14 +147,11 @@ func write(writer io.Writer, code []byte, data []byte) error {
|
|||
|
||||
switch config.TargetOS {
|
||||
case "linux":
|
||||
exe := elf.New(code, data)
|
||||
exe.Write(buffer)
|
||||
elf.Write(buffer, code, data)
|
||||
case "mac":
|
||||
exe := macho.New(code, data)
|
||||
exe.Write(buffer)
|
||||
macho.Write(buffer, code, data)
|
||||
case "windows":
|
||||
exe := pe.New(code, data)
|
||||
exe.Write(buffer)
|
||||
pe.Write(buffer, code, data)
|
||||
default:
|
||||
return fmt.Errorf("unsupported platform '%s'", config.TargetOS)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue