[kernel] Make lld output SysV ABI ELF binaries

lld started creating ELF files with OSABI set to GNU instead of SysV.
Make sure to pass the option to tell lld we want plain SysV binaries.

Also, some debug output in boot if verification fails in ELF loading.
This commit is contained in:
Justin C. Miller
2022-09-16 19:35:36 -07:00
parent 5c26308b23
commit b4f13d694f
2 changed files with 13 additions and 1 deletions

View File

@@ -47,6 +47,7 @@ variables:
ldflags: [ ldflags: [
"-g", "-g",
"-m", "elf_x86_64",
"-nostdlib", "-nostdlib",
"-Bstatic", "-Bstatic",
"--no-eh-frame-hdr", "--no-eh-frame-hdr",

View File

@@ -72,8 +72,19 @@ load_program(
create_module(data, desc, true); create_module(data, desc, true);
elf::file program(data.pointer, data.count); elf::file program(data.pointer, data.count);
if (!program.valid()) if (!program.valid()) {
auto *header = program.header();
console::print(L" progam size: %d\r\n", data.count);
console::print(L" word size: %d\r\n", header->word_size);
console::print(L" endianness: %d\r\n", header->endianness);
console::print(L" ELF ident version: %d\r\n", header->ident_version);
console::print(L" OS ABI: %d\r\n", header->os_abi);
console::print(L" file type: %d\r\n", header->file_type);
console::print(L" machine type: %d\r\n", header->machine_type);
console::print(L" ELF version: %d\r\n", header->version);
error::raise(uefi::status::load_error, L"ELF file not valid"); error::raise(uefi::status::load_error, L"ELF file not valid");
}
size_t num_sections = 0; size_t num_sections = 0;
for (auto &seg : program.programs()) { for (auto &seg : program.programs()) {