[build] Move init to its own target
In order to allow -fpic and -fpie in the user target, move init to it's own target -- it needs its own special build rules to make it loadable by boot.
This commit is contained in:
9
assets/build/config.debug.yaml
Normal file
9
assets/build/config.debug.yaml
Normal file
@@ -0,0 +1,9 @@
|
||||
---
|
||||
ccflags: [
|
||||
"-g3",
|
||||
"-ggdb",
|
||||
]
|
||||
|
||||
ldflags: [
|
||||
"-g",
|
||||
]
|
||||
@@ -12,8 +12,7 @@ ccflags: [
|
||||
"-mno-red-zone",
|
||||
"-fshort-wchar",
|
||||
"-fno-omit-frame-pointer",
|
||||
"-ggdb",
|
||||
"-g3" ]
|
||||
]
|
||||
|
||||
cxxflags: [ "-fno-exceptions", "-fno-rtti" ]
|
||||
|
||||
@@ -23,5 +22,5 @@ ldflags: [
|
||||
"-Wl,-entry:efi_main",
|
||||
"-Wl,-subsystem:efi_application",
|
||||
"-fuse-ld=lld-link",
|
||||
"-g" ]
|
||||
]
|
||||
|
||||
|
||||
34
assets/build/target.init.yaml
Normal file
34
assets/build/target.init.yaml
Normal file
@@ -0,0 +1,34 @@
|
||||
---
|
||||
ccflags: [
|
||||
"--target=x86_64-jsix-elf",
|
||||
"-fno-omit-frame-pointer",
|
||||
"-fno-stack-protector",
|
||||
|
||||
"-fvisibility=hidden",
|
||||
"-fvisibility-inlines-hidden",
|
||||
|
||||
"-D__ELF__",
|
||||
"-D__jsix__",
|
||||
"-U__linux",
|
||||
"-U__linux__",
|
||||
|
||||
"--sysroot='${source_root}/sysroot'"
|
||||
]
|
||||
|
||||
|
||||
cxxflags: [
|
||||
"-fno-exceptions",
|
||||
"-fno-rtti",
|
||||
]
|
||||
|
||||
ldflags: [
|
||||
"-Bstatic",
|
||||
"-m", "elf_x86_64",
|
||||
"--sysroot='${source_root}/sysroot'",
|
||||
"--no-eh-frame-hdr",
|
||||
"-L", "${source_root}/sysroot/lib",
|
||||
"-z", "separate-code",
|
||||
"-lc++", "-lc++abi", "-lunwind",
|
||||
"--no-dependent-libraries",
|
||||
]
|
||||
|
||||
@@ -21,9 +21,6 @@ ccflags: [
|
||||
"-fvisibility=hidden",
|
||||
"-fvisibility-inlines-hidden",
|
||||
|
||||
"-g3",
|
||||
"-ggdb",
|
||||
|
||||
"-D__ELF__",
|
||||
"-D__jsix__",
|
||||
"-D__j6kernel",
|
||||
@@ -32,7 +29,8 @@ ccflags: [
|
||||
"-DPRINTF_ALIAS_STANDARD_FUNCTION_NAMES=1",
|
||||
"-DPRINTF_INCLUDE_CONFIG_H=1",
|
||||
|
||||
"--sysroot='${source_root}/sysroot'" ]
|
||||
"--sysroot='${source_root}/sysroot'"
|
||||
]
|
||||
|
||||
|
||||
cflags: [ '-nostdinc' ]
|
||||
@@ -44,11 +42,11 @@ cxxflags: [
|
||||
]
|
||||
|
||||
ldflags: [
|
||||
"-g",
|
||||
"-m", "elf_x86_64",
|
||||
"-nostdlib",
|
||||
"-Bstatic",
|
||||
"--no-eh-frame-hdr",
|
||||
"-z", "norelro",
|
||||
"-z", "separate-code" ]
|
||||
"-z", "separate-code"
|
||||
]
|
||||
|
||||
|
||||
9
assets/build/target.user.exe.yaml
Normal file
9
assets/build/target.user.exe.yaml
Normal file
@@ -0,0 +1,9 @@
|
||||
---
|
||||
ccflags: [
|
||||
"-fpie"
|
||||
]
|
||||
|
||||
ldflags: [
|
||||
"-pie",
|
||||
"--dynamic-linker", "/tools/ld.so",
|
||||
]
|
||||
@@ -5,11 +5,6 @@ ccflags: [
|
||||
"--target=x86_64-jsix-elf",
|
||||
"-fno-omit-frame-pointer",
|
||||
"-fno-stack-protector",
|
||||
"-fpic",
|
||||
"-fpie",
|
||||
|
||||
"-g3",
|
||||
"-ggdb",
|
||||
|
||||
"-fvisibility=hidden",
|
||||
"-fvisibility-inlines-hidden",
|
||||
@@ -19,7 +14,10 @@ ccflags: [
|
||||
"-U__linux",
|
||||
"-U__linux__",
|
||||
|
||||
"--sysroot='${source_root}/sysroot'" ]
|
||||
"--sysroot='${source_root}/sysroot'",
|
||||
|
||||
"-fpic"
|
||||
]
|
||||
|
||||
|
||||
cxxflags: [
|
||||
@@ -28,7 +26,6 @@ cxxflags: [
|
||||
]
|
||||
|
||||
ldflags: [
|
||||
"-g",
|
||||
"-m", "elf_x86_64",
|
||||
"--sysroot='${source_root}/sysroot'",
|
||||
"--no-eh-frame-hdr",
|
||||
@@ -36,6 +33,5 @@ ldflags: [
|
||||
"-z", "separate-code",
|
||||
"-lc++", "-lc++abi", "-lunwind",
|
||||
"--no-dependent-libraries",
|
||||
"--dynamic-linker", "/tools/ld.so",
|
||||
]
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ class Manifest:
|
||||
name="kernel", target="kernel")
|
||||
|
||||
self.init = self.__build_entry(modules,
|
||||
config.get("init", None))
|
||||
config.get("init", None), target="init")
|
||||
|
||||
self.panics = [self.__build_entry(modules, i, target="kernel")
|
||||
for i in config.get("panic", tuple())]
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# vim: ft=python
|
||||
|
||||
init = module("srv.init",
|
||||
targets = [ "user" ],
|
||||
targets = [ "init" ],
|
||||
deps = [ "libc", "elf", "bootproto", "zstd" ],
|
||||
description = "Init server",
|
||||
ld_script = "init.ld",
|
||||
|
||||
Reference in New Issue
Block a user