Skip to contentSkip to conversation

poky-tiny: enable section removal

PATCH Superseded Sinan Kaya 3 participants 5 messages Nov 13, 2020

v5 of 7 Superseded Latest is v7 →

lore
Share & tools
lore

Sinan Kaya

author
#0 lore raw

PATCH v5 1/1 poky-tiny: enable section removal

Use GCC sections flags so that unused sections can be garbage collected at link time.

---
 meta-poky/conf/distro/poky-tiny.conf | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
meta-poky/conf/distro/poky-tiny.conf +18 -0
index c6d4b88f83d..583088185c6 100644
@@ -122,3 +122,21 @@ 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 = ""
+
+# omit section removal on native builds
+CFLAGS_SECTION_REMOVAL_class-native = ""
+LDFLAGS_SECTION_REMOVAL_class-native = ""
+
+# set default for all targets
+CFLAGS_append = " ${CFLAGS_SECTION_REMOVAL}"
+LDFLAGS_append = " ${LDFLAGS_SECTION_REMOVAL}"
+
Signature · 1 line
2.17.1
#1 lore raw
Quoted 25 lines · Sinan Kaya

Use GCC sections flags so that unused sections can be garbage collected at link time.

---
 meta-poky/conf/distro/poky-tiny.conf | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
meta-poky/conf/distro/poky-tiny.conf +8 -0
index c6d4b88f83d..583088185c6 100644
@@ -122,3 +122,21 @@ 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 = ""

meta-poky/conf/distro/poky-tiny.conf PNBLACKLIST[core-image-weston] = "not buildable with poky-tiny" · line 142

Quoted 10 lines
meta-poky/conf/distro/poky-tiny.conf +10 -0
+LDFLAGS_SECTION_REMOVAL_pn-cairo = ""
+
+# omit section removal on native builds
+CFLAGS_SECTION_REMOVAL_class-native = ""
+LDFLAGS_SECTION_REMOVAL_class-native = ""
+
+# set default for all targets
+CFLAGS_append = " ${CFLAGS_SECTION_REMOVAL}"
+LDFLAGS_append = " ${LDFLAGS_SECTION_REMOVAL}"
+

I think this should be an independent .inc file in oe-core much like lto.inc, perhaps something like size_opts.inc and here it could just in added via a include/require directive

Could be useful for non-poky distros as well.

Quoted 4 lines
author
#2 lore raw
Quoted 13 lines · Khem Raj

meta-poky/conf/distro/poky-tiny.conf PNBLACKLIST[core-image-weston] = "not buildable with poky-tiny" · line 142

Quoted 9 lines
meta-poky/conf/distro/poky-tiny.conf +8 -0
+# omit section removal on native builds
+CFLAGS_SECTION_REMOVAL_class-native = ""
+LDFLAGS_SECTION_REMOVAL_class-native = ""
+
+# set default for all targets
+CFLAGS_append = " ${CFLAGS_SECTION_REMOVAL}"
+LDFLAGS_append = " ${LDFLAGS_SECTION_REMOVAL}"
+

I think this should be an independent .inc file in oe-core much like lto.inc, perhaps something like size_opts.inc and here it could just in added via a include/require directive

Quoted 2 lines

Could be useful for non-poky distros as well.

Sure, I can move there once I get a successful build hint from Richard.

#3 lore raw
Quoted 14 lines · Sinan Kaya
Quoted 13 lines · Khem Raj

meta-poky/conf/distro/poky-tiny.conf PNBLACKLIST[core-image-weston] = "not buildable with poky-tiny" · line 142

Quoted 9 lines
meta-poky/conf/distro/poky-tiny.conf +8 -0
+# omit section removal on native builds
+CFLAGS_SECTION_REMOVAL_class-native = ""
+LDFLAGS_SECTION_REMOVAL_class-native = ""
+
+# set default for all targets
+CFLAGS_append = " ${CFLAGS_SECTION_REMOVAL}"
+LDFLAGS_append = " ${LDFLAGS_SECTION_REMOVAL}"
+

I think this should be an independent .inc file in oe-core much like lto.inc, perhaps something like size_opts.inc and here it could just in added via a include/require directive

Quoted 5 lines
Quoted 2 lines

Could be useful for non-poky distros as well.

Sure, I can move there once I get a successful build hint from Richard.

Fails in perl this time:

https://autobuilder.yoctoproject.org/typhoon/#/builders/15/builds/2981

Cheers,

Richard