[build] Address symbol visibility and DSO builds
Added an `API` macro in `j6/api.h` that expands to mark the given declaration as a default-visible symbol. Also change `format` and `vformat` to non-template functions, and make calls to `main`, `exit`, and the library init functions in `_start` GOT-relative.
This commit is contained in:
@@ -12,17 +12,17 @@ _libc_crt0_start:
|
||||
push 0
|
||||
mov rbp, rsp
|
||||
|
||||
call __init_libj6
|
||||
call __init_libj6 wrt ..got
|
||||
mov rbx, rax
|
||||
|
||||
call __init_libc
|
||||
call __init_libc wrt ..got
|
||||
|
||||
mov rdi, 0
|
||||
mov rsi, rsp
|
||||
mov rdx, 0 ; TODO: actually parse stack for argc, argv, envp
|
||||
mov rcx, rbx
|
||||
call main
|
||||
call main wrt ..got
|
||||
|
||||
mov rdi, rax
|
||||
call exit
|
||||
call exit wrt ..got
|
||||
.end:
|
||||
|
||||
@@ -27,7 +27,7 @@ for ext in ("h",):
|
||||
libc = module("libc",
|
||||
kind = "lib",
|
||||
deps = [ "j6" ],
|
||||
output = "libc.a",
|
||||
basename = "libc",
|
||||
include_phase = "late",
|
||||
sources = sources,
|
||||
public_headers = headers,
|
||||
@@ -35,6 +35,7 @@ libc = module("libc",
|
||||
|
||||
libc.variables["ccflags"] = [
|
||||
"${ccflags}",
|
||||
"-fvisibility=default",
|
||||
"-DPRINTF_SUPPORT_DECIMAL_SPECIFIERS=0",
|
||||
"-DPRINTF_SUPPORT_EXPONENTIAL_SPECIFIERS=0",
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user