[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",
|
"-mno-red-zone",
|
||||||
"-fshort-wchar",
|
"-fshort-wchar",
|
||||||
"-fno-omit-frame-pointer",
|
"-fno-omit-frame-pointer",
|
||||||
"-ggdb",
|
]
|
||||||
"-g3" ]
|
|
||||||
|
|
||||||
cxxflags: [ "-fno-exceptions", "-fno-rtti" ]
|
cxxflags: [ "-fno-exceptions", "-fno-rtti" ]
|
||||||
|
|
||||||
@@ -23,5 +22,5 @@ ldflags: [
|
|||||||
"-Wl,-entry:efi_main",
|
"-Wl,-entry:efi_main",
|
||||||
"-Wl,-subsystem:efi_application",
|
"-Wl,-subsystem:efi_application",
|
||||||
"-fuse-ld=lld-link",
|
"-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=hidden",
|
||||||
"-fvisibility-inlines-hidden",
|
"-fvisibility-inlines-hidden",
|
||||||
|
|
||||||
"-g3",
|
|
||||||
"-ggdb",
|
|
||||||
|
|
||||||
"-D__ELF__",
|
"-D__ELF__",
|
||||||
"-D__jsix__",
|
"-D__jsix__",
|
||||||
"-D__j6kernel",
|
"-D__j6kernel",
|
||||||
@@ -32,7 +29,8 @@ ccflags: [
|
|||||||
"-DPRINTF_ALIAS_STANDARD_FUNCTION_NAMES=1",
|
"-DPRINTF_ALIAS_STANDARD_FUNCTION_NAMES=1",
|
||||||
"-DPRINTF_INCLUDE_CONFIG_H=1",
|
"-DPRINTF_INCLUDE_CONFIG_H=1",
|
||||||
|
|
||||||
"--sysroot='${source_root}/sysroot'" ]
|
"--sysroot='${source_root}/sysroot'"
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
cflags: [ '-nostdinc' ]
|
cflags: [ '-nostdinc' ]
|
||||||
@@ -41,14 +39,14 @@ cxxflags: [
|
|||||||
"-fno-exceptions",
|
"-fno-exceptions",
|
||||||
"-fno-rtti",
|
"-fno-rtti",
|
||||||
"-nostdinc",
|
"-nostdinc",
|
||||||
]
|
]
|
||||||
|
|
||||||
ldflags: [
|
ldflags: [
|
||||||
"-g",
|
|
||||||
"-m", "elf_x86_64",
|
"-m", "elf_x86_64",
|
||||||
"-nostdlib",
|
"-nostdlib",
|
||||||
"-Bstatic",
|
"-Bstatic",
|
||||||
"--no-eh-frame-hdr",
|
"--no-eh-frame-hdr",
|
||||||
"-z", "norelro",
|
"-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",
|
"--target=x86_64-jsix-elf",
|
||||||
"-fno-omit-frame-pointer",
|
"-fno-omit-frame-pointer",
|
||||||
"-fno-stack-protector",
|
"-fno-stack-protector",
|
||||||
"-fpic",
|
|
||||||
"-fpie",
|
|
||||||
|
|
||||||
"-g3",
|
|
||||||
"-ggdb",
|
|
||||||
|
|
||||||
"-fvisibility=hidden",
|
"-fvisibility=hidden",
|
||||||
"-fvisibility-inlines-hidden",
|
"-fvisibility-inlines-hidden",
|
||||||
@@ -19,7 +14,10 @@ ccflags: [
|
|||||||
"-U__linux",
|
"-U__linux",
|
||||||
"-U__linux__",
|
"-U__linux__",
|
||||||
|
|
||||||
"--sysroot='${source_root}/sysroot'" ]
|
"--sysroot='${source_root}/sysroot'",
|
||||||
|
|
||||||
|
"-fpic"
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
cxxflags: [
|
cxxflags: [
|
||||||
@@ -28,7 +26,6 @@ cxxflags: [
|
|||||||
]
|
]
|
||||||
|
|
||||||
ldflags: [
|
ldflags: [
|
||||||
"-g",
|
|
||||||
"-m", "elf_x86_64",
|
"-m", "elf_x86_64",
|
||||||
"--sysroot='${source_root}/sysroot'",
|
"--sysroot='${source_root}/sysroot'",
|
||||||
"--no-eh-frame-hdr",
|
"--no-eh-frame-hdr",
|
||||||
@@ -36,6 +33,5 @@ ldflags: [
|
|||||||
"-z", "separate-code",
|
"-z", "separate-code",
|
||||||
"-lc++", "-lc++abi", "-lunwind",
|
"-lc++", "-lc++abi", "-lunwind",
|
||||||
"--no-dependent-libraries",
|
"--no-dependent-libraries",
|
||||||
"--dynamic-linker", "/tools/ld.so",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ class Manifest:
|
|||||||
name="kernel", target="kernel")
|
name="kernel", target="kernel")
|
||||||
|
|
||||||
self.init = self.__build_entry(modules,
|
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")
|
self.panics = [self.__build_entry(modules, i, target="kernel")
|
||||||
for i in config.get("panic", tuple())]
|
for i in config.get("panic", tuple())]
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# vim: ft=python
|
# vim: ft=python
|
||||||
|
|
||||||
init = module("srv.init",
|
init = module("srv.init",
|
||||||
targets = [ "user" ],
|
targets = [ "init" ],
|
||||||
deps = [ "libc", "elf", "bootproto", "zstd" ],
|
deps = [ "libc", "elf", "bootproto", "zstd" ],
|
||||||
description = "Init server",
|
description = "Init server",
|
||||||
ld_script = "init.ld",
|
ld_script = "init.ld",
|
||||||
@@ -14,4 +14,4 @@ init = module("srv.init",
|
|||||||
"pci.cpp",
|
"pci.cpp",
|
||||||
"service_locator.cpp",
|
"service_locator.cpp",
|
||||||
"start.s",
|
"start.s",
|
||||||
])
|
])
|
||||||
Reference in New Issue
Block a user