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