mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-06 03:08:31 +00:00
Get aarch64 hello world working
$ m=aarch64-tiny $ make -j8 m=$m o/$m/tool/hello/hello.com o/third_party/qemu/qemu-aarch64 $ o/third_party/qemu/qemu-aarch64 o/$m/tool/hello/hello.com hello world $ ls -hal o/$m/tool/hello/hello.com -rwxr-xr-x 1 jart jart 4.0K May 9 05:04 o/aarch64-tiny/tool/hello/hello.com
This commit is contained in:
parent
e5e3cdf447
commit
ae0ee59614
174 changed files with 1454 additions and 851 deletions
|
@ -60,7 +60,6 @@ M(1, g, "expm1", Expm1, expm1l(x), "𝑒ˣ-1")
|
|||
M(1, g, "exp2", Exp2, exp2l(x), "2ˣ")
|
||||
M(1, g, "exp10", Exp10, exp10l(x), "10ˣ")
|
||||
M(2, g, "ldexp", Ldexp, ldexpl(x, y), "𝑥×2ʸ")
|
||||
M(2, g, "scalb", Scalb, scalbl(x, y), "𝑥×2ʸ")
|
||||
|
||||
M(1, f, "log", Log, logl(x), "logₑ𝑥")
|
||||
M(1, g, "log2", Log2, log2l(x), "log₂𝑥")
|
||||
|
|
|
@ -147,8 +147,8 @@
|
|||
;; M-3 C-c C-c Compile w/ MODE=rel
|
||||
;; M-4 C-c C-c Compile w/ MODE=dbg
|
||||
;; M-5 C-c C-c Compile w/ MODE=""
|
||||
;; M-7 C-c C-c Compile w/ MODE=tinylinux
|
||||
;; M-8 C-c C-c Compile w/ clang tsan
|
||||
;; M-7 C-c C-c Compile w/ MODE=aarch64
|
||||
;; M-8 C-c C-c Compile w/ MODE=aarch64-tiny
|
||||
;; M-9 C-c C-c Compile w/ chibicc
|
||||
|
||||
(defun cosmo-intest (&optional file-name)
|
||||
|
@ -166,7 +166,7 @@
|
|||
((eq arg 5) "")
|
||||
((eq arg 6) "llvm")
|
||||
((eq arg 7) "aarch64")
|
||||
((eq arg 8) "tsan")
|
||||
((eq arg 8) "aarch64-tiny")
|
||||
(default default)
|
||||
((cosmo-intest) "dbg")
|
||||
(t "fastbuild")))
|
||||
|
@ -233,13 +233,13 @@
|
|||
" && "
|
||||
`("m=%s; f=o/$m/%s.com"
|
||||
,(concat "make -j12 $f MODE=$m")
|
||||
"./$f"))
|
||||
"build/run ./$f"))
|
||||
mode name))
|
||||
((eq kind 'test)
|
||||
(format `"m=%s; f=o/$m/%s.com.ok && make -j12 $f MODE=$m" mode name))
|
||||
((and (file-regular-p this)
|
||||
(file-executable-p this))
|
||||
(format "./%s" file))
|
||||
(format "build/run ./%s" file))
|
||||
('t
|
||||
(format
|
||||
(cosmo-join
|
||||
|
@ -606,7 +606,7 @@
|
|||
((file-executable-p file)
|
||||
(compile (if (cosmo-contains "/" file)
|
||||
file
|
||||
(format "./%s" file))))
|
||||
(format "build/run ./%s" file))))
|
||||
((memq major-mode '(c-mode c++-mode asm-mode fortran-mode))
|
||||
(let* ((mode (cosmo--make-mode arg))
|
||||
(compile-command (cosmo--compile-command this root 'run mode "" "" ".runs")))
|
||||
|
|
12
tool/hello/hello.c
Normal file
12
tool/hello/hello.c
Normal file
|
@ -0,0 +1,12 @@
|
|||
#include "libc/calls/calls.h"
|
||||
#include "libc/str/str.h"
|
||||
|
||||
// hello world with minimal build system dependencies
|
||||
|
||||
static ssize_t Write(int fd, const char *s) {
|
||||
return write(fd, s, strlen(s));
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
Write(1, "hello world\n");
|
||||
}
|
39
tool/hello/hello.mk
Normal file
39
tool/hello/hello.mk
Normal file
|
@ -0,0 +1,39 @@
|
|||
#-*-mode:makefile-gmake;indent-tabs-mode:t;tab-width:8;coding:utf-8-*-┐
|
||||
#───vi: set et ft=make ts=8 tw=8 fenc=utf-8 :vi───────────────────────┘
|
||||
|
||||
PKGS += TOOL_HELLO
|
||||
|
||||
TOOL_HELLO_SRCS := $(wildcard tool/hello/*.c)
|
||||
TOOL_HELLO_OBJS = $(TOOL_HELLO_SRCS:%.c=o/$(MODE)/%.o)
|
||||
TOOL_HELLO_COMS = $(TOOL_HELLO_SRCS:%.c=o/$(MODE)/%.com)
|
||||
TOOL_HELLO_BINS = $(TOOL_HELLO_COMS) $(TOOL_HELLO_COMS:%=%.dbg)
|
||||
|
||||
TOOL_HELLO_DIRECTDEPS = \
|
||||
LIBC_CALLS \
|
||||
LIBC_INTRIN \
|
||||
LIBC_NEXGEN32E \
|
||||
LIBC_RUNTIME \
|
||||
LIBC_STR \
|
||||
LIBC_STUBS
|
||||
|
||||
TOOL_HELLO_DEPS := \
|
||||
$(call uniq,$(foreach x,$(TOOL_HELLO_DIRECTDEPS),$($(x))))
|
||||
|
||||
o/$(MODE)/tool/hello/hello.pkg: \
|
||||
$(TOOL_HELLO_OBJS) \
|
||||
$(foreach x,$(TOOL_HELLO_DIRECTDEPS),$($(x)_A).pkg)
|
||||
|
||||
o/$(MODE)/tool/hello/%.com.dbg: \
|
||||
$(TOOL_HELLO_DEPS) \
|
||||
o/$(MODE)/tool/hello/%.o \
|
||||
o/$(MODE)/tool/hello/hello.pkg \
|
||||
$(CRT) \
|
||||
$(APE_NO_MODIFY_SELF)
|
||||
@$(APELINK)
|
||||
|
||||
$(TOOL_HELLO_OBJS): \
|
||||
$(BUILD_FILES) \
|
||||
tool/hello/hello.mk
|
||||
|
||||
.PHONY: o/$(MODE)/tool/hello
|
||||
o/$(MODE)/tool/hello: $(TOOL_HELLO_BINS) $(TOOL_HELLO_CHECKS)
|
|
@ -8,6 +8,7 @@ o/$(MODE)/tool: \
|
|||
o/$(MODE)/tool/curl \
|
||||
o/$(MODE)/tool/decode \
|
||||
o/$(MODE)/tool/hash \
|
||||
o/$(MODE)/tool/hello \
|
||||
o/$(MODE)/tool/lambda \
|
||||
o/$(MODE)/tool/net \
|
||||
o/$(MODE)/tool/plinko \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue