Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by mx.groups.io with SMTP id smtpd.web08.619.1605049404482035674 for ; Tue, 10 Nov 2020 15:03:24 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@kernel.org header.s=default header.b=2D0gIbLP; spf=pass (domain: kernel.org, ip: 198.145.29.99, mailfrom: okaya@kernel.org) Received: from sinanubuntu.ckuic5o5zete5ommc4uz5anrqg.bx.internal.cloudapp.net (unknown [23.96.20.205]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 8C7DA207BB; Tue, 10 Nov 2020 23:03:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1605049403; bh=y5hmZ5/Xi3HBx6aVr3JhjlDRgBlSlYcdctUZHZlO3I4=; h=From:To:Cc:Subject:Date:From; b=2D0gIbLPieTfVcZbaPiBev1Fh9YtxVu1S8X/+0QtbqRwqcLFtaH69sgZN79EbOhwx bb+meg+PfWuk3dW0vME2ZAf5oCiIh1Gym8IJIoAc2AmK59D0zyZk3J4dAX1/1lYM78 8nvczT9byrRY1T4EQfB6JH4wwTA1PLSruqwyJ9qU= From: "Sinan Kaya" To: poky@lists.yoctoproject.org Cc: Sinan Kaya Subject: [PATCH v4] poky-tiny: enable section removal Date: Tue, 10 Nov 2020 23:03:19 +0000 Message-Id: <20201110230319.29851-1-okaya@kernel.org> X-Mailer: git-send-email 2.17.1 Use GCC sections flags so that unused sections can be garbage collected at link time. Signed-off-by: Sinan Kaya --- meta-poky/conf/distro/poky-tiny.conf | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/meta-poky/conf/distro/poky-tiny.conf b/meta-poky/conf/distro/poky-tiny.conf index c6d4b88f83d..eead97a404e 100644 --- a/meta-poky/conf/distro/poky-tiny.conf +++ b/meta-poky/conf/distro/poky-tiny.conf @@ -122,3 +122,17 @@ PNBLACKLIST[core-image-weston] = "not buildable with poky-tiny" # Disable python usage in opkg-utils since it won't build with tiny config PACKAGECONFIG_remove_pn-opkg-utils = "python" + +CFLAGS_SECTION_REMOVAL = "-ffunction-sections -fdata-sections" +LDFLAGS_SECTION_REMOVAL = "-Wl,--gc-sections" + +# packages with build problems using sections +CFLAGS_SECTION_REMOVAL_pn-glibc = "" +LDFLAGS_SECTION_REMOVAL_pn-glibc = "" +CFLAGS_SECTION_REMOVAL_pn-cairo = "" +LDFLAGS_SECTION_REMOVAL_pn-cairo = "" + +# set default for all targets +CFLAGS_append = " ${CFLAGS_SECTION_REMOVAL}" +LDFLAGS_append = " ${LDFLAGS_SECTION_REMOVAL}" + -- 2.17.1