[PATCH master 2/3] kvx: select DEAD_CODE_DATA_ELIMINATION
Ahmad Fatoum <[email protected]>
| Newsgroups | org.infradead.lists.barebox |
|---|---|
| Message-ID | <[email protected]> |
We have code that depends on unreferenced functions being dropped, because otherwise they would lead to linker errors as they themself reference functions that aren't included in the build. To make such code not break the kvx build, enable linker garbage collection for it. To make this work two changes are needed in addition: - exact .text, .data and .bss matches changed to prefix matches as we want to merge the new subsections - kvx_start is identified as the entry point, so linker garbage collection knows from where to check reachability A search for `section' in arch/kvx and drivers/soc/kvx shows that the only custom sections are .exception and .startup, so we should have all our bases covered. It has been verified that barebox running in QEMU still reaches its shell with this change applied. Signed-off-by: Ahmad Fatoum <[email protected]> --- arch/kvx/Kconfig | 1 + arch/kvx/cpu/barebox.lds.S | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/arch/kvx/Kconfig b/arch/kvx/Kconfig index bbbec6471f06..14109c3cfcb7 100644 --- a/arch/kvx/Kconfig +++ b/arch/kvx/Kconfig @@ -22,6 +22,7 @@ config KVX select OFDEVICE select PARTITION select RESET_SOURCE + select LD_DEAD_CODE_DATA_ELIMINATION default y config 64BIT diff --git a/arch/kvx/cpu/barebox.lds.S b/arch/kvx/cpu/barebox.lds.S index b05c1f36e595..99a73ea0f7cc 100644 --- a/arch/kvx/cpu/barebox.lds.S +++ b/arch/kvx/cpu/barebox.lds.S @@ -8,6 +8,7 @@ #include <asm/barebox.lds.h> OUTPUT_FORMAT("elf64-kvx") +ENTRY(kvx_start) SECTIONS { @@ -15,7 +16,7 @@ SECTIONS .text ALIGN(4) : { *(.startup); _stext = .; - *(.text) + *(.text*) } /* Exception vector must be aligned on a huge frontier */ @@ -59,7 +60,7 @@ SECTIONS .data ALIGN(4): { sdata = .; _sdata = .; - *(.data) + *(.data*) . = ALIGN(8); __stack_end = .; . += CONFIG_STACK_SIZE; @@ -79,7 +80,7 @@ SECTIONS .bss ALIGN(16): { __bss_start = .; - *(.bss) + *(.bss*) . = ALIGN(16); __bss_stop = .; } -- 2.47.3