[PATCH] Makefile: Remove unused code and data

Anup Patel anup at brainfault.org
Sun Feb 4 23:43:07 PST 2024


On Tue, Dec 19, 2023 at 9:02 AM Xiang W <wxjstz at 126.com> wrote:
>
> Add compiler options to create separate sections for functions and
> static variables. And add options to the linker to remove unused
> sections.
>
> Signed-off-by: Xiang W <wxjstz at 126.com>

This patch breaks OpenSBI with LLVM.

Regards,
Anup

> ---
>  Makefile | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/Makefile b/Makefile
> index de4e73a..fbb64f2 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -331,7 +331,7 @@ GENFLAGS    +=      $(libsbiutils-genflags-y)
>  GENFLAGS       +=      $(platform-genflags-y)
>  GENFLAGS       +=      $(firmware-genflags-y)
>
> -CFLAGS         =       -g -Wall -Werror -ffreestanding -nostdlib -fno-stack-protector -fno-strict-aliasing
> +CFLAGS         =       -g -Wall -Werror -ffreestanding -nostdlib -fno-stack-protector -fno-strict-aliasing -ffunction-sections -fdata-sections
>  ifneq ($(DEBUG),)
>  CFLAGS         +=      -O0
>  else
> @@ -377,6 +377,7 @@ ARFLAGS             =       rcs
>  ELFFLAGS       +=      $(USE_LD_FLAG)
>  ELFFLAGS       +=      -Wl,--exclude-libs,ALL
>  ELFFLAGS       +=      -Wl,--build-id=none
> +ELFFLAGS       +=      -Wl,--gc-sections
>  ELFFLAGS       +=      $(platform-ldflags-y)
>  ELFFLAGS       +=      $(firmware-ldflags-y)
>
> --
> 2.43.0
>
>
> --
> opensbi mailing list
> opensbi at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/opensbi



More information about the opensbi mailing list