diff --git a/src/system/boot/Jamfile b/src/system/boot/Jamfile index 3541e65466..b89309dc16 100644 --- a/src/system/boot/Jamfile +++ b/src/system/boot/Jamfile @@ -38,7 +38,7 @@ rule BuildAoutLoader { actions BuildAoutLoader { rm -f $(1) - $(TARGET_OBJCOPY_$(TARGET_PACKAGING_ARCH)) -O $(AOUT_FORMAT) $(2) $(1) + $(TARGET_OBJCOPY_$(TARGET_PACKAGING_ARCH)) -O $(AOUT_FORMAT) --impure -S $(2) $(1) } diff --git a/src/system/boot/platform/openfirmware/start.cpp b/src/system/boot/platform/openfirmware/start.cpp index c699823ecd..a2777e4177 100644 --- a/src/system/boot/platform/openfirmware/start.cpp +++ b/src/system/boot/platform/openfirmware/start.cpp @@ -27,9 +27,11 @@ extern "C" void _start(uint32 _unused1, uint32 _unused2, void *openFirmwareEntry); extern "C" void start(void *openFirmwareEntry); +#ifdef __powerpc__ // XCOFF "entry-point" is actually a pointer to the real code extern "C" void *_coff_start; void *_coff_start = (void *)&_start; +#endif // GCC defined globals extern void (*__ctor_list)(void); @@ -52,11 +54,13 @@ call_ctors(void) } +#ifdef __powerpc__ static void clear_bss(void) { memset(&__bss_start, 0, &_end - &__bss_start); } +#endif static void @@ -134,13 +138,15 @@ platform_boot_options(void) } -extern "C" void +extern "C" void __attribute__((section(".text.start"))) _start(uint32 _unused1, uint32 _unused3, void *openFirmwareEntry) { // According to the PowerPC bindings, OpenFirmware should have created // a stack of 32kB or higher for us at this point +#ifndef __sparc__ clear_bss(); +#endif call_ctors(); // call C++ constructors before doing anything else diff --git a/src/system/ldscripts/sparc/boot_loader_openfirmware.ld b/src/system/ldscripts/sparc/boot_loader_openfirmware.ld index 656f3689a2..3449242731 100644 --- a/src/system/ldscripts/sparc/boot_loader_openfirmware.ld +++ b/src/system/ldscripts/sparc/boot_loader_openfirmware.ld @@ -5,12 +5,13 @@ ENTRY(_start) SECTIONS { - . = 0x202000 + SIZEOF_HEADERS; + . = 0x202000; __text_begin = .; /* text/read-only data */ - .text : { *(.text .text.* .gnu.linkonce.t.*) + .text : { *(.text.start) /* Make sure entry point is at start of file */ + *(.text .text.* .gnu.linkonce.t.*) *(.rodata .rodata.* .gnu.linkonce.r.*) *(.sdata2) }