bare: stdint.h
parent
56fee6835a
commit
a545ccb740
|
@ -4,6 +4,7 @@ const (
|
||||||
|
|
||||||
c_headers = '
|
c_headers = '
|
||||||
|
|
||||||
|
//#include <inttypes.h> // int64_t etc
|
||||||
#include <stdio.h> // TODO remove all these includes, define all function signatures and types manually
|
#include <stdio.h> // TODO remove all these includes, define all function signatures and types manually
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
@ -168,9 +169,11 @@ var map_int = function() {}
|
||||||
|
|
||||||
c_builtin_types = '
|
c_builtin_types = '
|
||||||
|
|
||||||
|
//#include <inttypes.h> // int64_t etc
|
||||||
|
//#include <stdint.h> // int64_t etc
|
||||||
|
|
||||||
//================================== TYPEDEFS ================================*/
|
//================================== TYPEDEFS ================================*/
|
||||||
|
|
||||||
#include <inttypes.h> // int64_t etc
|
|
||||||
typedef int64_t i64;
|
typedef int64_t i64;
|
||||||
typedef int16_t i16;
|
typedef int16_t i16;
|
||||||
typedef int8_t i8;
|
typedef int8_t i8;
|
||||||
|
|
|
@ -234,7 +234,14 @@ pub fn (v mut V) compile() {
|
||||||
$if js {
|
$if js {
|
||||||
cgen.genln(js_headers)
|
cgen.genln(js_headers)
|
||||||
} $else {
|
} $else {
|
||||||
|
if !v.pref.is_bare {
|
||||||
|
cgen.genln('#include <inttypes.h>') // int64_t etc
|
||||||
|
} else {
|
||||||
|
cgen.genln('#include <stdint.h>')
|
||||||
|
}
|
||||||
|
|
||||||
cgen.genln(c_builtin_types)
|
cgen.genln(c_builtin_types)
|
||||||
|
|
||||||
if !v.pref.is_bare {
|
if !v.pref.is_bare {
|
||||||
cgen.genln(c_headers)
|
cgen.genln(c_headers)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
.intel_syntax noprefix
|
.intel_syntax noprefix
|
||||||
.text
|
.text
|
||||||
.globl _start, syscall5
|
.globl _start, main__syscall5
|
||||||
|
|
||||||
_start:
|
_start:
|
||||||
xor rbp,rbp
|
xor rbp,rbp
|
||||||
|
@ -16,7 +16,7 @@
|
||||||
ret /* should never be reached, but if the OS somehow fails
|
ret /* should never be reached, but if the OS somehow fails
|
||||||
to kill us, it will cause a segmentation fault */
|
to kill us, it will cause a segmentation fault */
|
||||||
|
|
||||||
syscall5:
|
main__syscall5:
|
||||||
mov rax,rdi
|
mov rax,rdi
|
||||||
mov rdi,rsi
|
mov rdi,rsi
|
||||||
mov rsi,rdx
|
mov rsi,rdx
|
||||||
|
@ -26,7 +26,7 @@
|
||||||
syscall
|
syscall
|
||||||
ret
|
ret
|
||||||
|
|
||||||
syscall6:
|
main__syscall6:
|
||||||
mov rax,rdi
|
mov rax,rdi
|
||||||
mov rdi,rsi
|
mov rdi,rsi
|
||||||
mov rsi,rdx
|
mov rsi,rdx
|
||||||
|
|
Loading…
Reference in New Issue