[PATCH v3 1/1] Makefile: enable --gc-sections
Jessica Clarke
jrtc27 at jrtc27.com
Wed Sep 11 10:03:40 PDT 2024
On 5 Sep 2024, at 10:31, Kele Zhang <zhangcola2003 at gmail.com> wrote:
>
> The --gc-sections option enables the linker to perform garbage
> collection of unreferenced code and data, thereby reducing the binary
> size.
>
> The -ffunction-sections option will place each function into a separate
> section, so it is necessary to add .text.* to the linker script.
>
> Signed-off-by: Kele Zhang <zhangcola2003 at gmail.com>
> Signed-off-by: Yuan Tan <tanyuan at tinylab.org>
> Signed-off-by: Zhangjin Wu <falcon at tinylab.org>
> —
> ...
> @@ -424,6 +420,13 @@ MERGEFLAGS += -m elf$(PLATFORM_RISCV_XLEN)lriscv
>
> DTSCPPFLAGS = $(CPPFLAGS) -nostdinc -nostdlib -fno-builtin -D__DTS__ -x assembler-with-cpp
>
> +ifneq ($(DEBUG),)
> +CFLAGS += -O0
> +ELFFLAGS += -Wl,--print-gc-sections
This line is using spaces not tabs.
Jess
More information about the opensbi
mailing list