Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by mx.groups.io with SMTP id smtpd.web09.19604.1604960742788162754 for ; Mon, 09 Nov 2020 14:25:42 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@kernel.org header.s=default header.b=ERUtHIie; 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 4EA8F20656; Mon, 9 Nov 2020 22:25:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604960741; bh=l6tkJys+jvKDFOC0GWfff+5NzqEcYipemwYenLdwse0=; h=From:To:Cc:Subject:Date:From; b=ERUtHIieRXWTiw5AgDM9qyWhD2AZpBTtbc2Pmk3GCrl/wIZaa+iYq7ThqIhMBAIw2 ychzk46CoHui6Io4mODdiii4PGtToO3EzTZ0hUaTRI7ntn1bFnzsTthRPN58KpdmSz Gr7+SCFMqN7KzzqFp6vaaS3GadeBjwyt+0H1yN50= From: "Sinan Kaya" To: poky@lists.yoctoproject.org Cc: Sinan Kaya Subject: [PATCH v2] poky-tiny: enable section removal Date: Mon, 9 Nov 2020 22:25:35 +0000 Message-Id: <20201109222535.60899-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 | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/meta-poky/conf/distro/poky-tiny.conf b/meta-poky/conf/distro/poky-tiny.conf index c6d4b88f83d..19e48851519 100644 --- a/meta-poky/conf/distro/poky-tiny.conf +++ b/meta-poky/conf/distro/poky-tiny.conf @@ -122,3 +122,25 @@ 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" + +# set default for all targets +CFLAGS_append += "-ffunction-sections -fdata-sections" +LDFLAGS_append += "-Wl,--gc-sections" + +# gc-sections requires either an entry or an undefined symbol +CFLAGS_remove_pn-glibc += "-ffunction-sections -fdata-sections" +LDFLAGS_remove_pn-glibc += "-Wl,--gc-sections" + +# perl won't cross compile with sections +CFLAGS_remove_pn-perl += "-ffunction-sections -fdata-sections" +LDFLAGS_remove_pn-perl += "-Wl,--gc-sections" + +# libdevmapper won't compile with sections +# CFLAGS_remove_pn-libdevmapper += "-ffunction-sections -fdata-sections" +# LDFLAGS_remove_pn-libdevmapper += "-Wl,--gc-sections" + +# Unknown float word ordering. You need to manually preset +CFLAGS_remove_pn-cairo += "-ffunction-sections -fdata-sections" +LDFLAGS_remove_pn-cairo += "-Wl,--gc-sections" + + -- 2.17.1