Skip to contentSkip to conversation

poky-tiny: enable section removal

PATCH Superseded Sinan Kaya 2 participants 2 messages Nov 9, 2020

v2 of 7 Superseded Latest is v7 →

lore
Share & tools
lore

Sinan Kaya

author
#0 lore raw

PATCH v2 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 | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
meta-poky/conf/distro/poky-tiny.conf +22 -0
index c6d4b88f83d..19e48851519 100644
@@ -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"
+
+
Signature · 1 line
2.17.1
#1 lore raw
Quoted 13 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 | 22 ++++++++++++++++++++++
  1 file changed, 22 insertions(+)
meta-poky/conf/distro/poky-tiny.conf +0 -0
index c6d4b88f83d..19e48851519 100644

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

Quoted 7 lines
meta-poky/conf/distro/poky-tiny.conf +4 -0
@@ -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"

lets not use += here with _append, and add a leading whitespace after first quote

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

Quoted 4 lines
meta-poky/conf/distro/poky-tiny.conf +4 -0
+
+# 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"

remove += here just = is enough with _remove

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

Quoted 5 lines
meta-poky/conf/distro/poky-tiny.conf +5 -0
+
+# perl won't cross compile with sections
+CFLAGS_remove_pn-perl += "-ffunction-sections -fdata-sections"
+LDFLAGS_remove_pn-perl += "-Wl,--gc-sections"
+

same above

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

Quoted 3 lines
meta-poky/conf/distro/poky-tiny.conf +3 -0
+# libdevmapper won't compile with sections
+# CFLAGS_remove_pn-libdevmapper += "-ffunction-sections -fdata-sections"
+# LDFLAGS_remove_pn-libdevmapper += "-Wl,--gc-sections"

same here

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

Quoted 4 lines
meta-poky/conf/distro/poky-tiny.conf +4 -0
+
+# Unknown float word ordering. You need to manually preset
+CFLAGS_remove_pn-cairo += "-ffunction-sections -fdata-sections"
+LDFLAGS_remove_pn-cairo += "-Wl,--gc-sections"

same here

Quoted 7 lines
meta-poky/conf/distro/poky-tiny.conf +2 -0
+
+