[Skiboot] [PATCH] Honor DEAD_CODE_ELIMINATION flag

Nicholas Piggin npiggin at gmail.com
Fri Feb 28 13:00:44 AEDT 2020


Mauro S. M. Rodrigues's on February 28, 2020 3:14 am:
> While trying to reduce the size of the final binary I found
> DEAD_CODE_ELIMINATION=1 but it didn't change the binary size and
> known ununsed functions were seen when inspecting the elf with nm.
> 
> Even though the necessary parameters for compiler, -ffunction-sections
> and -fdata-sections, are set, ld's --gc-sections wasn't, so add it in
> order to honor the flag.
> 
> Signed-off-by: Mauro S. M. Rodrigues <maurosr at linux.vnet.ibm.com>
> ---
>  Makefile.main | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/Makefile.main b/Makefile.main
> index 7ff2d21be..52251aa7e 100644
> --- a/Makefile.main
> +++ b/Makefile.main
> @@ -171,6 +171,7 @@ endif
>  
>  ifeq ($(DEAD_CODE_ELIMINATION),1)
>  LDFLAGS += -Wl,--gc-sections
> +LDFLAGS_FINAL += --gc-sections
>  endif
>  
>  AFLAGS := -D__ASSEMBLY__ -m64

Obviously required, I got the same thing lying around.

Reviewed-by: Nicholas Piggin <npiggin at gmail.com>

Did you get much savings? It wasn't a great deal when I last tried.

Thanks,
Nick


More information about the Skiboot mailing list