mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
x64: use correct exe name and set +x
This commit is contained in:
parent
c11025f01f
commit
94318b1287
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
@ -46,7 +46,7 @@ jobs:
|
|||||||
- name: Bare metal
|
- name: Bare metal
|
||||||
run: ./v -freestanding -o bare vlib/os/bare/bare_example_linux.v
|
run: ./v -freestanding -o bare vlib/os/bare/bare_example_linux.v
|
||||||
- name: x64 machine code generation
|
- name: x64 machine code generation
|
||||||
run: ./v -x64 examples/x64/hello_world.v
|
run: cd examples/x64 && ./v -x64 hello_world.v && ./hello_world
|
||||||
|
|
||||||
build-ubuntu-tcc:
|
build-ubuntu-tcc:
|
||||||
runs-on: ubuntu-18.04
|
runs-on: ubuntu-18.04
|
||||||
|
@ -1,25 +1,6 @@
|
|||||||
module compiler
|
module compiler
|
||||||
|
|
||||||
import filepath
|
//import filepath
|
||||||
|
|
||||||
//import compiler.x64
|
//import compiler.x64
|
||||||
|
|
||||||
pub fn (v mut V) compile_x64() {
|
|
||||||
$if !linux {
|
|
||||||
println('v -x64 can only generate Linux binaries for now')
|
|
||||||
println('You are not on a Linux system, so you will not ' +
|
|
||||||
'be able to run the resulting executable')
|
|
||||||
}
|
|
||||||
|
|
||||||
v.files << v.v_files_from_dir(filepath.join(v.pref.vlib_path, 'builtin', 'bare'))
|
|
||||||
v.files << v.dir
|
|
||||||
v.x64.generate_elf_header()
|
|
||||||
for f in v.files {
|
|
||||||
v.parse(f, .decl)
|
|
||||||
}
|
|
||||||
for f in v.files {
|
|
||||||
v.parse(f, .main)
|
|
||||||
}
|
|
||||||
v.x64.generate_elf_footer()
|
|
||||||
|
|
||||||
}
|
|
||||||
|
@ -347,6 +347,26 @@ pub fn (v mut V) compile() {
|
|||||||
v.cc()
|
v.cc()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn (v mut V) compile_x64() {
|
||||||
|
$if !linux {
|
||||||
|
println('v -x64 can only generate Linux binaries for now')
|
||||||
|
println('You are not on a Linux system, so you will not ' +
|
||||||
|
'be able to run the resulting executable')
|
||||||
|
}
|
||||||
|
|
||||||
|
v.files << v.v_files_from_dir(filepath.join(v.pref.vlib_path, 'builtin', 'bare'))
|
||||||
|
v.files << v.dir
|
||||||
|
v.x64.generate_elf_header()
|
||||||
|
for f in v.files {
|
||||||
|
v.parse(f, .decl)
|
||||||
|
}
|
||||||
|
for f in v.files {
|
||||||
|
v.parse(f, .main)
|
||||||
|
}
|
||||||
|
v.x64.generate_elf_footer()
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
fn (v mut V) generate_init() {
|
fn (v mut V) generate_init() {
|
||||||
$if js { return }
|
$if js { return }
|
||||||
if v.pref.build_mode == .build_module {
|
if v.pref.build_mode == .build_module {
|
||||||
|
@ -88,7 +88,8 @@ pub fn (g mut Gen) generate_elf_footer() {
|
|||||||
g.write64_at(file_size, g.file_size_pos) // set file size 64 bit value
|
g.write64_at(file_size, g.file_size_pos) // set file size 64 bit value
|
||||||
g.write64_at(file_size, g.file_size_pos+8)
|
g.write64_at(file_size, g.file_size_pos+8)
|
||||||
// Create the binary
|
// Create the binary
|
||||||
f := os.create('out.bin') or { panic(err) }
|
f := os.create(g.out_name) or { panic(err) }
|
||||||
|
C.chmod(g.out_name.str, 0775)
|
||||||
f.write_bytes(g.buf.data, g.buf.len)
|
f.write_bytes(g.buf.data, g.buf.len)
|
||||||
f.close()
|
f.close()
|
||||||
println('x64 elf binary has been successfully generated')
|
println('x64 elf binary has been successfully generated')
|
||||||
|
Loading…
Reference in New Issue
Block a user