From: Waldemar Kozaczuk <[email protected]> Committer: Waldemar Kozaczuk <[email protected]> Branch: master
aarch64 linker: enforce some sections kept when garbage collection on This patch changes the aarch64 linker script to keep some sections when garbage collection (--gc-sections) is on when linking the kernel. This mostly involves adding KEEP directived to .fixup, .eh_frame*, .tracepoint_patch_sites* and .init* sections to make them retained when linking with garbage collection on. This changes to not have any effect on the linker result when garbage collection is off - the default. Signed-off-by: Waldemar Kozaczuk <[email protected]> --- diff --git a/arch/aarch64/loader.ld b/arch/aarch64/loader.ld --- a/arch/aarch64/loader.ld +++ b/arch/aarch64/loader.ld @@ -65,20 +65,20 @@ SECTIONS fault_fixup_start = .; *(.fixup) fault_fixup_end = .; - } : text + KEEP(*(.fixup)) } : text - .eh_frame : { *(.eh_frame) } : text - .eh_frame_hdr : { *(.eh_frame_hdr) } :text :eh_frame + .eh_frame : { *(.eh_frame) KEEP(*(.eh_frame)); } : text + .eh_frame_hdr : { *(.eh_frame_hdr) KEEP(*(.eh_frame_hdr)); } :text :eh_frame .rodata : { *(.rodata*) } :text .note : { *(.note*) } :text :note - .gcc_except_table : { *(.gcc_except_table) *(.gcc_except_table.*) } : text + .gcc_except_table : { *(.gcc_except_table) *(.gcc_except_table.*) KEEP(*(.gcc_except_table)); } : text .tracepoint_patch_sites : ALIGN(8) { HIDDEN(__tracepoint_patch_sites_start = .); *(.tracepoint_patch_sites) HIDDEN(__tracepoint_patch_sites_end = .); - } : text + KEEP(*(.tracepoint_patch_sites)); } : text .data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro .data.rel.ro.* .gnu.linkonce.d.rel.ro.*) } : text @@ -89,7 +89,7 @@ SECTIONS *(SORT_BY_NAME(.preinit_array.*) .preinit_array) *(SORT_BY_INIT_PRIORITY(.init_array.*) SORT_BY_INIT_PRIORITY(.ctors.*)) *(.init_array .ctors) - } : text + KEEP(*(.init_array .init_array.* .ctors.* .ctors)) } : text HIDDEN(_init_array_end = .); .percpu : ALIGN (4096) { -- You received this message because you are subscribed to the Google Groups "OSv Development" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/osv-dev/000000000000fff4fe05d2ff05a5%40google.com.
