[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:
Justin C. Miller
2023-07-31 00:16:02 -07:00
parent 21916ab869
commit bbe27c6b53
8 changed files with 66 additions and 21 deletions

View File

@@ -0,0 +1,9 @@
---
ccflags: [
"-g3",
"-ggdb",
]
ldflags: [
"-g",
]

View File

@@ -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" ]
]

View 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",
]

View File

@@ -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' ]
@@ -41,14 +39,14 @@ cxxflags: [
"-fno-exceptions",
"-fno-rtti",
"-nostdinc",
]
]
ldflags: [
"-g",
"-m", "elf_x86_64",
"-nostdlib",
"-Bstatic",
"--no-eh-frame-hdr",
"-z", "norelro",
"-z", "separate-code" ]
"-z", "separate-code"
]

View File

@@ -0,0 +1,9 @@
---
ccflags: [
"-fpie"
]
ldflags: [
"-pie",
"--dynamic-linker", "/tools/ld.so",
]

View File

@@ -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",
]