Skip to contentSkip to conversation

lto.inc: Add global LTO distro policy file

PATCH Superseded Khem Raj 3 participants 9 messages Mar 23, 2020 – Mar 24, 2020

v1 of 5 Superseded Latest is v5 →

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

PATCH 1/1 lto.inc: Add global LTO distro policy file

Distros which want to enable LTO can utilize this file, it only covers packages from OE-Core, other layers should include there own exclusion list for recipe which dont work with LTO

---
 meta/conf/distro/include/lto.inc | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)
 create mode 100644 meta/conf/distro/include/lto.inc
meta/conf/distro/include/lto.inc new file +23 -0
new file mode 100644
index 0000000000..0cedc8deca
@@ -0,0 +1,23 @@
+LTO_pn-glibc = ""
+LTO_pn-gcc-runtime = ""
+LTO_pn-libgcc-initial = ""
+LTO_pn-libgcc = ""
+LTO_pn-libpam = ""
+LTO_pn-elfutils = ""
+LTO_pn-perl = ""
+LTO_pn-busybox = ""
+LTO_pn-libxcrypt = ""
+LTO_pn-curl = ""
+LTO_pn-libcap = ""
+LTO_pn-python3 = ""
+LTO_pn-libproxy = ""
+LTO_pn-libbsd = ""
+
+LTO ?= "-flto"
+
+SELECTED_OPTIMIZATION_append_class-target = " ${LTO}"
+TARGET_LDFLAGS_append_class-target = " ${LTO}"
+
+SELECTED_OPTIMIZATION[vardeps] += "LTO"
+
+PACKAGE_DEBUG_SPLIT_STYLE = "debug-without-src"
Signature · 1 line
2.25.2
#1 lore raw
Quoted 32 lines · Khem Raj

Distros which want to enable LTO can utilize this file, it only covers
packages from OE-Core, other layers should include there own exclusion
list for recipe which dont work with LTO

---
 meta/conf/distro/include/lto.inc | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)
 create mode 100644 meta/conf/distro/include/lto.inc
meta/conf/distro/include/lto.inc new file +13 -0
new file mode 100644
index 0000000000..0cedc8deca
@@ -0,0 +1,23 @@
+LTO_pn-glibc = ""
+LTO_pn-gcc-runtime = ""
+LTO_pn-libgcc-initial = ""
+LTO_pn-libgcc = ""
+LTO_pn-libpam = ""
+LTO_pn-elfutils = ""
+LTO_pn-perl = ""
+LTO_pn-busybox = ""
+LTO_pn-libxcrypt = ""
+LTO_pn-curl = ""
+LTO_pn-libcap = ""
+LTO_pn-python3 = ""
+LTO_pn-libproxy = ""

meta/conf/distro/include/lto.inc line 23

Quoted 10 lines
meta/conf/distro/include/lto.inc new file +10 -0
+LTO_pn-libbsd = ""
+
+LTO ?= "-flto"
+
+SELECTED_OPTIMIZATION_append_class-target = " ${LTO}"
+TARGET_LDFLAGS_append_class-target = " ${LTO}"
+
+SELECTED_OPTIMIZATION[vardeps] += "LTO"
+
+PACKAGE_DEBUG_SPLIT_STYLE = "debug-without-src"

Why do we need to specify the debug split style here?

Cheers,

Richard

author
#2 lore raw
Quoted 38 lines · Richard Purdie
Quoted 36 lines · Khem Raj

Distros which want to enable LTO can utilize this file, it only covers
packages from OE-Core, other layers should include there own exclusion
list for recipe which dont work with LTO

---
 meta/conf/distro/include/lto.inc | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)
 create mode 100644 meta/conf/distro/include/lto.inc
meta/conf/distro/include/lto.inc new file +17 -0
new file mode 100644
index 0000000000..0cedc8deca
@@ -0,0 +1,23 @@
+LTO_pn-glibc = ""
+LTO_pn-gcc-runtime = ""
+LTO_pn-libgcc-initial = ""
+LTO_pn-libgcc = ""
+LTO_pn-libpam = ""
+LTO_pn-elfutils = ""
+LTO_pn-perl = ""
+LTO_pn-busybox = ""
+LTO_pn-libxcrypt = ""
+LTO_pn-curl = ""
+LTO_pn-libcap = ""
+LTO_pn-python3 = ""
+LTO_pn-libproxy = ""
+LTO_pn-libbsd = ""
+
+LTO ?= "-flto"
+
Quoted 9 lines

meta/conf/distro/include/lto.inc line 23

Quoted 6 lines
meta/conf/distro/include/lto.inc new file +6 -0
+SELECTED_OPTIMIZATION_append_class-target = " ${LTO}"
+TARGET_LDFLAGS_append_class-target = " ${LTO}"
+
+SELECTED_OPTIMIZATION[vardeps] += "LTO"
+
+PACKAGE_DEBUG_SPLIT_STYLE = "debug-without-src"

Why do we need to specify the debug split style here?

debug file generator does not generate debugsrc packages with lto i have not investigates in
detail but its due to the fact that .o files are not normal elf objs

Quoted 5 lines

Cheers,

Richard

#3 lore raw
In reply to Khem Raj
Quoted 11 lines · Khem Raj

Distros which want to enable LTO can utilize this file, it only covers packages from OE-Core, other layers should include there own exclusion list for recipe which dont work with LTO
...
+++ b/meta/conf/distro/include/lto.inc

meta/conf/distro/include/lto.inc new file +5 -0
@@ -0,0 +1,23 @@
+LTO_pn-glibc = ""
+LTO_pn-gcc-runtime = ""
+LTO_pn-libgcc-initial = ""
+LTO_pn-libgcc = ""
+LTO_pn-libpam = ""

meta/conf/distro/include/lto.inc line 14

Quoted 10 lines
meta/conf/distro/include/lto.inc new file +9 -0
+LTO_pn-elfutils = ""
+LTO_pn-perl = ""
+LTO_pn-busybox = ""
+LTO_pn-libxcrypt = ""
+LTO_pn-curl = ""
+LTO_pn-libcap = ""
+LTO_pn-python3 = ""
+LTO_pn-libproxy = ""
+LTO_pn-libbsd = ""
...

It would be better to have these in the individual recipes, it is much easier to understand what is going on when all recipe-specific information is in the recipe.

Otherwise this will end as an implementation of workarounds that might not even be needed anymore, for a previous example with several workarounds that were no longer needed see
https://git.openembedded.org/openembedded-core/commit/?id=8bbb17d2dcafa9b4e26941a55932f4be2782e1d1

cu
Adrian

#4 lore raw
Quoted 20 lines · Adrian Bunk
Quoted 19 lines · Khem Raj

Distros which want to enable LTO can utilize this file, it only covers
packages from OE-Core, other layers should include there own exclusion
list for recipe which dont work with LTO
...
+++ b/meta/conf/distro/include/lto.inc

meta/conf/distro/include/lto.inc new file +11 -0
@@ -0,0 +1,23 @@
+LTO_pn-glibc = ""
+LTO_pn-gcc-runtime = ""
+LTO_pn-libgcc-initial = ""
+LTO_pn-libgcc = ""
+LTO_pn-libpam = ""
+LTO_pn-elfutils = ""
+LTO_pn-perl = ""
+LTO_pn-busybox = ""
+LTO_pn-libxcrypt = ""
+LTO_pn-curl = ""
+LTO_pn-libcap = ""
Quoted 8 lines

meta/conf/distro/include/lto.inc line 14

Quoted 4 lines
meta/conf/distro/include/lto.inc new file +3 -0
+LTO_pn-python3 = ""
+LTO_pn-libproxy = ""
+LTO_pn-libbsd = ""
...

It would be better to have these in the individual recipes, it is much easier to understand what is going on when all recipe-specific information is in the recipe.

I disagree. These files do let someone working on specific enablement see the status collectively and allow people to opt in/out of a given development feature.

At some point in the future that can tip into making more sense in a recipe but its a staged process and things often make sense to start like this.

Cheers,

Richard

author
#5 lore raw
Quoted 31 lines · Richard Purdie
Quoted 20 lines · Adrian Bunk
Quoted 19 lines · Khem Raj

Distros which want to enable LTO can utilize this file, it only covers
packages from OE-Core, other layers should include there own exclusion
list for recipe which dont work with LTO
...
+++ b/meta/conf/distro/include/lto.inc

meta/conf/distro/include/lto.inc new file +11 -0
@@ -0,0 +1,23 @@
+LTO_pn-glibc = ""
+LTO_pn-gcc-runtime = ""
+LTO_pn-libgcc-initial = ""
+LTO_pn-libgcc = ""
+LTO_pn-libpam = ""
+LTO_pn-elfutils = ""
+LTO_pn-perl = ""
+LTO_pn-busybox = ""
+LTO_pn-libxcrypt = ""
+LTO_pn-curl = ""
+LTO_pn-libcap = ""
Quoted 8 lines

meta/conf/distro/include/lto.inc line 14

Quoted 4 lines
meta/conf/distro/include/lto.inc new file +3 -0
+LTO_pn-python3 = ""
+LTO_pn-libproxy = ""
+LTO_pn-libbsd = ""
...

It would be better to have these in the individual recipes, it is much easier to understand what is going on when all recipe-specific information is in the recipe.

Quoted 7 lines

I disagree. These files do let someone working on specific enablement see the status collectively and allow people to opt in/out of a given development feature.

At some point in the future that can tip into making more sense in a recipe but its a staged process and things often make sense to start like this.

yeah. Maybe there should be a distro feature knob this inc file should add which can be used by recipes
for an exception like adding configure options

Quoted 5 lines

Cheers,

Richard

author
#7 lore raw
Quoted 7 lines · Adrian Bunk
Quoted 3 lines · Khem Raj

...
+LTO_pn-python3 = ""
...

Building Python with LTO works by passing --with-lto to configure.

I think per recipe knobs I did not work on yet but perhaps worth adding them in next release
or may be as packageconfig dependent on lto distro feature

Quoted 3 lines

cu
Adrian

#8 lore raw
In reply to Khem Raj
Quoted 4 lines · Khem Raj

Distros which want to enable LTO can utilize this file, it only covers packages from OE-Core, other layers should include there own exclusion list for recipe which dont work with LTO
...

More and more upstreams already default to LTO in their build system.

What is the recommended way to get the correct configure options to disable LTO in all such recipes?

The option is obviously recipe-specific, but there has to be some global define the recipe can check for disable/default/enable.

cu
Adrian