[bonnibel] Allow modules to list ld scripts in definition

Previously, to add a custom linker script, a module would need to modify
its variables after the fact to add to ldflags. Now module constructors
take a new keyword `ld_script` and handle the ldflags and dependencies
properly.
This commit is contained in:
Justin C. Miller
2023-01-31 23:57:39 -08:00
parent 61199d2f80
commit eba0127645
3 changed files with 18 additions and 7 deletions

View File

@@ -7,6 +7,7 @@ kernel = module("kernel",
targets = [ "kernel" ],
description = "jsix kernel",
deps = [ "util", "cpu", "bootproto", "j6" ],
ld_script = "kernel.ld",
sources = [
"apic.cpp",
"assert.cpp",
@@ -83,5 +84,3 @@ kernel.add_depends([
"syscalls.inc.cog",
"syscall_verify.cpp.cog",
], definitions)
kernel.variables['ldflags'] = ["${ldflags}", "-T", "${source_root}/src/kernel/kernel.ld"]

View File

@@ -6,6 +6,7 @@ panic = module("panic.serial",
deps = [ "util", "elf", "kernel" ],
includes = [ ".." ],
description = "Serial panic handler",
ld_script = "panic.serial.ld",
sources = [
"display.cpp",
"entry.s",
@@ -14,5 +15,3 @@ panic = module("panic.serial",
"symbol_table.cpp",
"../printf/printf.c",
])
panic.variables['ldflags'] = ["${ldflags}", "-T", "${source_root}/src/kernel/panic.serial/panic.serial.ld"]