From 094b40659f8f3978939e18ae3331013da54faeac Mon Sep 17 00:00:00 2001 From: Toomas Soome Date: Sun, 8 Sep 2019 19:39:45 +0000 Subject: [PATCH] loader: --gc-sections needs sections to work with --gc-sections is not really useful unless we generate sections with -ffunction-sections -fdata-sections While there, i386/loader would win from --gc-sections too. --- stand/defs.mk | 1 + stand/i386/loader/Makefile | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/stand/defs.mk b/stand/defs.mk index 9b5d7960e410..1d07cda40300 100644 --- a/stand/defs.mk +++ b/stand/defs.mk @@ -65,6 +65,7 @@ CFLAGS+= -Ddouble=jagged-little-pill -Dfloat=floaty-mcfloatface # Experience has shown that problems arise between ~520k to ~530k. CFLAGS.clang+= -Oz CFLAGS.gcc+= -Os +CFLAGS+= -ffunction-sections -fdata-sections .endif # GELI Support, with backward compat hooks (mostly) diff --git a/stand/i386/loader/Makefile b/stand/i386/loader/Makefile index dbb993eaad02..d0611ef6a4d9 100644 --- a/stand/i386/loader/Makefile +++ b/stand/i386/loader/Makefile @@ -47,7 +47,7 @@ HELP_FILES= ${.CURDIR}/help.i386 CLEANFILES+= ${LOADER} ${LOADER}.bin CFLAGS+= -Wall -LDFLAGS+= -static -Ttext 0x0 +LDFLAGS+= -static -Ttext 0x0 -Wl,--gc-sections # i386 standalone support library LIBI386= ${BOOTOBJ}/i386/libi386/libi386.a