arm: kernel link cleanup and fixes
* Removes several previous hacks, and makes kernel loading by our bootloader more reliable. * Long list of "Couldn't find both text and data" errors no gone in our bootloader as it loads our kernel Change-Id: Ic9f5ed44975d41fb22d7ab19536261432abe84ba Reviewed-on: https://review.haiku-os.org/c/haiku/+/3444 Reviewed-by: Alex von Gluck IV <[email protected]> Reviewed-by: Fredrik Holmqvist <[email protected]> Reviewed-by: Adrien Destugues <[email protected]>
This commit is contained in:
committed by
Alex von Gluck IV
parent
64fc5a66b1
commit
cb26d04e81
@@ -401,21 +401,14 @@ rule KernelArchitectureSetup architecture
|
|||||||
|
|
||||||
switch $(cpu) {
|
switch $(cpu) {
|
||||||
case arm :
|
case arm :
|
||||||
# Workaround for ld using 32k for alignment despite forcing it in the config...
|
HAIKU_KERNEL_PIC_LINKFLAGS += -z max-page-size=0x1000 ;
|
||||||
# should definitely not be needed!
|
HAIKU_KERNEL_ADDON_LINKFLAGS += -z max-page-size=0x1000 ;
|
||||||
HAIKU_KERNEL_LINKFLAGS +=
|
HAIKU_KERNEL_PIC_CCFLAGS = -fno-pic ;
|
||||||
-Wl,-z -Wl,max-page-size=0x1000
|
|
||||||
-Wl,-z -Wl,common-page-size=0x1000 ;
|
|
||||||
|
|
||||||
case arm64 :
|
case arm64 :
|
||||||
# Workaround for ld using 32k for alignment despite forcing it in the config...
|
HAIKU_KERNEL_PIC_LINKFLAGS += -z max-page-size=0x1000 ;
|
||||||
# should definitely not be needed!
|
HAIKU_KERNEL_ADDON_LINKFLAGS += -z max-page-size=0x1000 ;
|
||||||
HAIKU_KERNEL_LINKFLAGS +=
|
HAIKU_KERNEL_PIC_CCFLAGS = -fno-pic ;
|
||||||
-Wl,-z -Wl,max-page-size=0x1000
|
|
||||||
-Wl,-z -Wl,common-page-size=0x1000 ;
|
|
||||||
|
|
||||||
HAIKU_KERNEL_PIC_CCFLAGS = -fPIC ;
|
|
||||||
HAIKU_KERNEL_PIC_LINKFLAGS = -shared -fPIC ;
|
|
||||||
|
|
||||||
case ppc :
|
case ppc :
|
||||||
# Build a position independent PPC kernel. We need to be able to
|
# Build a position independent PPC kernel. We need to be able to
|
||||||
|
|||||||
@@ -8,14 +8,20 @@ UsePrivateHeaders [ FDirName kernel boot platform efi ] ;
|
|||||||
local platform ;
|
local platform ;
|
||||||
for platform in [ MultiBootSubDirSetup efi ] {
|
for platform in [ MultiBootSubDirSetup efi ] {
|
||||||
on $(platform) {
|
on $(platform) {
|
||||||
|
{
|
||||||
|
local defines = _BOOT_MODE _BOOT_PLATFORM_EFI ;
|
||||||
|
defines = [ FDefines $(defines) ] ;
|
||||||
|
SubDirCcFlags $(defines) ;
|
||||||
|
SubDirC++Flags $(defines) -fno-rtti ;
|
||||||
|
}
|
||||||
|
|
||||||
local arch_src =
|
local arch_src =
|
||||||
crt0-efi-$(TARGET_ARCH).S
|
crt0-efi-$(TARGET_ARCH).S
|
||||||
entry.S
|
entry.S
|
||||||
relocation_func.cpp
|
relocation_func.cpp
|
||||||
|
arch_mmu.cpp
|
||||||
arch_smp.cpp
|
arch_smp.cpp
|
||||||
arch_start.cpp
|
arch_start.cpp
|
||||||
arch_mmu.cpp
|
|
||||||
arch_timer.cpp
|
arch_timer.cpp
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|||||||
@@ -1,64 +1,46 @@
|
|||||||
OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
|
OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
|
||||||
OUTPUT_ARCH(arm)
|
OUTPUT_ARCH(arm)
|
||||||
|
|
||||||
/* XXX: this shouldn't be needed to make kernel_arm have separate text and data segments!!! */
|
|
||||||
PHDRS
|
|
||||||
{
|
|
||||||
headers PT_PHDR PHDRS ;
|
|
||||||
text PT_LOAD FILEHDR PHDRS ;
|
|
||||||
data PT_LOAD ;
|
|
||||||
dynamic PT_DYNAMIC ;
|
|
||||||
}
|
|
||||||
|
|
||||||
ENTRY(_start)
|
ENTRY(_start)
|
||||||
SEARCH_DIR("libgcc");
|
|
||||||
SECTIONS
|
SECTIONS
|
||||||
{
|
{
|
||||||
. = 0x80000000 + SIZEOF_HEADERS;
|
. = 0x80000000 + SIZEOF_HEADERS;
|
||||||
|
|
||||||
.interp : { *(.interp) } :text
|
.interp : { *(.interp) }
|
||||||
.hash : { *(.hash) }
|
.hash : { *(.hash) }
|
||||||
.dynsym : { *(.dynsym) }
|
.dynsym : { *(.dynsym) }
|
||||||
.dynstr : { *(.dynstr) }
|
.dynstr : { *(.dynstr) }
|
||||||
.rel.text : { *(.rel.text) *(.rel.gnu.linkonce.t*) }
|
.rela.text : { *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) }
|
||||||
.rela.text : { *(.rela.text) *(.rela.gnu.linkonce.t*) }
|
.rela.data : { *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) }
|
||||||
.rel.data : { *(.rel.data) *(.rel.gnu.linkonce.d*) }
|
.rela.rodata : { *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) }
|
||||||
.rela.data : { *(.rela.data) *(.rela.gnu.linkonce.d*) }
|
|
||||||
.rel.rodata : { *(.rel.rodata) *(.rel.gnu.linkonce.r*) }
|
|
||||||
.rela.rodata : { *(.rela.rodata) *(.rela.gnu.linkonce.r*) }
|
|
||||||
.rel.got : { *(.rel.got) }
|
|
||||||
.rela.got : { *(.rela.got) }
|
.rela.got : { *(.rela.got) }
|
||||||
.rel.ctors : { *(.rel.ctors) }
|
|
||||||
.rela.ctors : { *(.rela.ctors) }
|
.rela.ctors : { *(.rela.ctors) }
|
||||||
.rel.dtors : { *(.rel.dtors) }
|
|
||||||
.rela.dtors : { *(.rela.dtors) }
|
.rela.dtors : { *(.rela.dtors) }
|
||||||
.rel.init : { *(.rel.init) }
|
|
||||||
.rela.init : { *(.rela.init) }
|
.rela.init : { *(.rela.init) }
|
||||||
.rel.fini : { *(.rel.fini) }
|
|
||||||
.rela.fini : { *(.rela.fini) }
|
.rela.fini : { *(.rela.fini) }
|
||||||
.rel.bss : { *(.rel.bss) }
|
.rela.bss : { *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) }
|
||||||
.rela.bss : { *(.rela.bss) }
|
|
||||||
.rel.plt : { *(.rel.plt) }
|
|
||||||
.rela.plt : { *(.rela.plt) }
|
.rela.plt : { *(.rela.plt) }
|
||||||
.init : { *(.init) } =0x9090
|
.init : { *(.init) } =0x9090
|
||||||
.plt : { *(.plt) }
|
.plt : { *(.plt) }
|
||||||
|
|
||||||
/* text/read-only data */
|
/* text/read-only data */
|
||||||
.text : { *(.text .gnu.linkonce.t.*) } :text =0x9090
|
.text : { *(.text .text.* .gnu.linkonce.t.*) } =0x9090
|
||||||
|
|
||||||
.rodata : { *(.rodata) }
|
.rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) }
|
||||||
|
|
||||||
/* exception unwinding - should really not be needed! XXX: find the correct place. */
|
/*
|
||||||
__exidx_start = .;
|
. = ALIGN(0x8);
|
||||||
.ARM.exidx : { *(.ARM.exidx* .gnu.linkonce.armexidx.*) }
|
altcodepatch_begin = .;
|
||||||
__exidx_end = .;
|
.altcodepatch : { *(.altcodepatch) }
|
||||||
|
altcodepatch_end = .;
|
||||||
|
*/
|
||||||
|
|
||||||
/* writable data */
|
/* writable data */
|
||||||
. = ALIGN(0x1000);
|
. = ALIGN (0x1000);
|
||||||
__data_start = .;
|
__data_start = .;
|
||||||
.data : { *(.data .gnu.linkonce.d.*) } :data
|
.data : { *(.data .data.* .gnu.linkonce.d.*) }
|
||||||
|
|
||||||
. = ALIGN(0x4);
|
. = ALIGN(0x8);
|
||||||
__ctor_list = .;
|
__ctor_list = .;
|
||||||
.ctors : { *(.init_array) *(.ctors) }
|
.ctors : { *(.init_array) *(.ctors) }
|
||||||
__ctor_end = .;
|
__ctor_end = .;
|
||||||
@@ -66,14 +48,14 @@ SECTIONS
|
|||||||
.dtors : { *(.fini_array) *(.dtors) }
|
.dtors : { *(.fini_array) *(.dtors) }
|
||||||
__dtor_end = .;
|
__dtor_end = .;
|
||||||
.got : { *(.got.plt) *(.got) }
|
.got : { *(.got.plt) *(.got) }
|
||||||
.dynamic : { *(.dynamic) } :dynamic :data
|
.dynamic : { *(.dynamic) }
|
||||||
|
|
||||||
/* uninitialized data (in same segment as writable data) */
|
/* uninitialized data (in same segment as writable data) */
|
||||||
__bss_start = .;
|
__bss_start = .;
|
||||||
.bss : { *(.bss) }
|
.bss : { *(.bss .bss.* .gnu.linkonce.b.*) }
|
||||||
|
|
||||||
. = ALIGN(0x1000);
|
. = ALIGN(0x1000);
|
||||||
_end = .;
|
_end = . ;
|
||||||
|
|
||||||
/* Strip unnecessary stuff */
|
/* Strip unnecessary stuff */
|
||||||
/DISCARD/ : { *(.comment .note .eh_frame) }
|
/DISCARD/ : { *(.comment .note .eh_frame) }
|
||||||
|
|||||||
Reference in New Issue
Block a user