m68k: force fold segments into text, [ro]data & shave 100kB of ELF stuff

For some reason the kernel ended up with a bunch of .text.foo or
.data.rel.bar sections, each with their own ELF section headers and
other metadata. Forcing them into the base sections drops the binary
size by about 100kB, even for the stripped one.

I suspect it should work on other archs as well.

Change-Id: I7a8f46480d71267c07b75325423a0f5bfd2d12fb
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3101
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
This commit is contained in:
François Revol 2020-07-27 03:01:11 +02:00 committed by Alex von Gluck IV
parent ab51e305e9
commit d4b7d64b81

View File

@ -43,28 +43,27 @@ SECTIONS
.plt : { *(.plt) }
/* text/read-only data */
.text : { *(.text .gnu.linkonce.t.*) } :text =0x9090
.rodata : { *(.rodata) }
.text : {
*(.text .text.* .gnu.linkonce.t.*) *(.rodata .rodata.*)
} :text =0x9090
/* writable data */
. = ALIGN(0x1000);
__data_start = .;
.data : { *(.data .gnu.linkonce.d.*) } :data
.data : {
. = ALIGN(0x4);
__ctor_list = .;
*(.ctors)
__ctor_end = .;
*(.data .data.* .gnu.linkonce.d.*)
*(.got.plt) *(.got)
} :data
. = ALIGN(0x4);
__ctor_list = .;
.ctors : { *(.ctors) }
__ctor_end = .;
__dtor_list = .;
.dtors : { *(.dtors) }
__dtor_end = .;
.got : { *(.got.plt) *(.got) }
.dynamic : { *(.dynamic) } :dynamic :data
/* uninitialized data (in same segment as writable data) */
__bss_start = .;
.bss : { *(.bss) } :data
.bss : { *(.bss .bss.*) } :data
. = ALIGN(0x1000);
_end = . ;