[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

@@ -28,14 +28,16 @@ load_file(
const wchar_t *path);
/// Parse and load an ELF file in memory into a loaded image.
/// \arg disk The opened UEFI filesystem to load from
/// \arg desc The descriptor identifying the program
/// \arg name The human-readable name of the program to load
/// \arg disk The opened UEFI filesystem to load from
/// \arg desc The descriptor identifying the program
/// \arg name The human-readable name of the program to load
/// \arg verify If this is the kernel and should have its header verified
bootproto::program *
load_program(
fs::file &disk,
const wchar_t *name,
const descriptor &desc);
const descriptor &desc,
bool verify = false);
/// Load a file from disk into memory, creating an init args module
/// \arg disk The opened UEFI filesystem to load from
@@ -51,10 +53,5 @@ load_module(
bootproto::module_type type,
uint16_t subtype);
/// Verify that a loaded ELF has the j6 kernel header
/// \arg program The program to check for a header
void
verify_kernel_header(bootproto::program &program);
} // namespace loader
} // namespace boot