[kernel] Hide kernel symbols by default

Using `-fvisibility=hidden` when building the kernel, and then
`--discard-all` when stripping it, we shave almost 100KiB off of the
resulting ELF file.

Also dropped some unused symbols from the linker script, and rearranged
the sections so that the file is able to be mapped directly into memory
instead of having each section copied.
This commit is contained in:
Justin C. Miller
2023-01-29 19:36:20 -08:00
parent e2e1696b7e
commit 5ea5978ee8
17 changed files with 126 additions and 120 deletions

View File

@@ -1,32 +1,32 @@
global get_rsp
global get_rsp: function hidden
get_rsp:
mov rax, rsp
ret
global get_rip
global get_rip: function hidden
get_rip:
pop rax ; do the same thing as 'ret', except with 'jmp'
jmp rax ; with the return address still in rax
global get_caller
global get_caller: function hidden
get_caller:
; No prelude - don't touch rsp or rbp
mov rax, [rbp+8]
ret
global get_grandcaller
global get_grandcaller: function hidden
get_grandcaller:
; No prelude - don't touch rsp or rbp
mov rax, [rbp]
mov rax, [rax+8]
ret
global get_gsbase
global get_gsbase: function hidden
get_gsbase:
rdgsbase rax
ret
global _halt
global _halt: function hidden
_halt:
hlt
jmp _halt