* [PATCH v5 01/11] lto: Add global LTO distro policy file
@ 2020-11-09 0:02 Khem Raj
2020-11-09 0:02 ` [PATCH v5 02/11] python3: Enable lto if its in DISTRO_FEATURES Khem Raj
` (10 more replies)
0 siblings, 11 replies; 14+ messages in thread
From: Khem Raj @ 2020-11-09 0:02 UTC (permalink / raw)
To: openembedded-core; +Cc: 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
Document the needed changes in local.conf.extended
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
meta/conf/distro/include/lto.inc | 28 ++++++++++++++++++++++++++++
meta/conf/local.conf.sample.extended | 4 ++++
2 files changed, 32 insertions(+)
create mode 100644 meta/conf/distro/include/lto.inc
diff --git a/meta/conf/distro/include/lto.inc b/meta/conf/distro/include/lto.inc
new file mode 100644
index 0000000000..fe0f6c9f44
--- /dev/null
+++ b/meta/conf/distro/include/lto.inc
@@ -0,0 +1,28 @@
+# To enable LTO, add following in local.conf
+# require conf/distro/include/lto.inc
+# DISTRO_FEATURES_append = " lto"
+#
+
+# Disable LTO for following packages
+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-libproxy = ""
+LTO_pn-libbsd = ""
+
+# Override it for additional or different options if needed e.g.
+# with clang thin-lto might be better for compile speed
+LTO ?= "-flto"
+
+SELECTED_OPTIMIZATION_append = "${@bb.utils.contains('DISTRO_FEATURES', 'lto', ' ${LTO}', '', d)}"
+TARGET_LDFLAGS_append_class-target = "${@bb.utils.contains('DISTRO_FEATURES', 'lto', ' ${LTO}', '', d)}"
+
+SELECTED_OPTIMIZATION[vardeps] += "LTO"
diff --git a/meta/conf/local.conf.sample.extended b/meta/conf/local.conf.sample.extended
index 9aa226a2d0..2c4b8ad8cb 100644
--- a/meta/conf/local.conf.sample.extended
+++ b/meta/conf/local.conf.sample.extended
@@ -417,3 +417,7 @@
# ERR_REPORT_UPLOAD_ALL = "1"
#
# INHERIT += "report-error"
+
+# Enable LTO Distro-wide
+# require conf/distro/include/lto.inc
+# DISTRO_FEATURES_append = " lto"
--
2.29.2
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v5 02/11] python3: Enable lto if its in DISTRO_FEATURES
2020-11-09 0:02 [PATCH v5 01/11] lto: Add global LTO distro policy file Khem Raj
@ 2020-11-09 0:02 ` Khem Raj
2020-11-09 0:02 ` [PATCH v5 03/11] lto.inc: Add -ffat-lto-objects and -fuse-linker-plugin Khem Raj
` (9 subsequent siblings)
10 siblings, 0 replies; 14+ messages in thread
From: Khem Raj @ 2020-11-09 0:02 UTC (permalink / raw)
To: openembedded-core; +Cc: Khem Raj
python3 configure compiles on object file and then greps for strings in
it for endianness for target ,when using LTO the .o files are not nomal
ELF onjects so this test fails, since we are using --enable-lto to
enable this here we dont need to inject extra paths via bitbake anyway
therefore reset LTO variable for target
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
meta/recipes-devtools/python/python3_3.9.0.bb | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/meta/recipes-devtools/python/python3_3.9.0.bb b/meta/recipes-devtools/python/python3_3.9.0.bb
index 6402760a1b..8fe60ea016 100644
--- a/meta/recipes-devtools/python/python3_3.9.0.bb
+++ b/meta/recipes-devtools/python/python3_3.9.0.bb
@@ -74,6 +74,9 @@ export CROSSPYTHONPATH="${STAGING_LIBDIR_NATIVE}/python${PYTHON_MAJMIN}/lib-dynl
EXTRANATIVEPATH += "python3-native"
+# LTO will be enabled via packageconfig depending upong distro features
+LTO_class-target = ""
+
CACHED_CONFIGUREVARS = " \
ac_cv_file__dev_ptmx=yes \
ac_cv_file__dev_ptc=no \
@@ -88,7 +91,7 @@ def possibly_include_pgo(d):
return ''
-PACKAGECONFIG_class-target ??= "readline ${@possibly_include_pgo(d)} gdbm"
+PACKAGECONFIG_class-target ??= "readline ${@possibly_include_pgo(d)} gdbm ${@bb.utils.filter('DISTRO_FEATURES', 'lto', d)}"
PACKAGECONFIG_class-native ??= "readline gdbm"
PACKAGECONFIG_class-nativesdk ??= "readline gdbm"
PACKAGECONFIG[readline] = ",,readline"
@@ -96,6 +99,7 @@ PACKAGECONFIG[readline] = ",,readline"
PACKAGECONFIG[pgo] = "--enable-optimizations,,qemu-native"
PACKAGECONFIG[tk] = ",,tk"
PACKAGECONFIG[gdbm] = ",,gdbm"
+PACKAGECONFIG[lto] = "--with-lto,,"
do_configure_prepend () {
mkdir -p ${B}/Modules
--
2.29.2
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v5 03/11] lto.inc: Add -ffat-lto-objects and -fuse-linker-plugin
2020-11-09 0:02 [PATCH v5 01/11] lto: Add global LTO distro policy file Khem Raj
2020-11-09 0:02 ` [PATCH v5 02/11] python3: Enable lto if its in DISTRO_FEATURES Khem Raj
@ 2020-11-09 0:02 ` Khem Raj
2020-11-09 0:02 ` [PATCH v5 04/11] lto: Introduce LTOEXTRA variable Khem Raj
` (8 subsequent siblings)
10 siblings, 0 replies; 14+ messages in thread
From: Khem Raj @ 2020-11-09 0:02 UTC (permalink / raw)
To: openembedded-core; +Cc: Khem Raj
This helps to improve LTO and ensure the libs can be linked with non-LTO
objects too
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
meta/conf/distro/include/lto.inc | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/meta/conf/distro/include/lto.inc b/meta/conf/distro/include/lto.inc
index fe0f6c9f44..d7fea26c64 100644
--- a/meta/conf/distro/include/lto.inc
+++ b/meta/conf/distro/include/lto.inc
@@ -20,7 +20,16 @@ LTO_pn-libbsd = ""
# Override it for additional or different options if needed e.g.
# with clang thin-lto might be better for compile speed
-LTO ?= "-flto"
+#
+# ffat-lto-objects
+# object files that contain both the intermediate
+# language and the object code. This makes them
+# usable for both LTO linking and normal linking
+#
+# -fuse-linker-plugin
+# ensures that libraries participate in LTO by supplying intermediate
+# code from .a files to linker
+LTO ?= "-flto -ffat-lto-objects -fuse-linker-plugin "
SELECTED_OPTIMIZATION_append = "${@bb.utils.contains('DISTRO_FEATURES', 'lto', ' ${LTO}', '', d)}"
TARGET_LDFLAGS_append_class-target = "${@bb.utils.contains('DISTRO_FEATURES', 'lto', ' ${LTO}', '', d)}"
--
2.29.2
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v5 04/11] lto: Introduce LTOEXTRA variable
2020-11-09 0:02 [PATCH v5 01/11] lto: Add global LTO distro policy file Khem Raj
2020-11-09 0:02 ` [PATCH v5 02/11] python3: Enable lto if its in DISTRO_FEATURES Khem Raj
2020-11-09 0:02 ` [PATCH v5 03/11] lto.inc: Add -ffat-lto-objects and -fuse-linker-plugin Khem Raj
@ 2020-11-09 0:02 ` Khem Raj
2020-11-09 0:02 ` [PATCH v5 05/11] libaio: Disable LTO Khem Raj
` (7 subsequent siblings)
10 siblings, 0 replies; 14+ messages in thread
From: Khem Raj @ 2020-11-09 0:02 UTC (permalink / raw)
To: openembedded-core; +Cc: Khem Raj
Certain packages may need additional flags to enable LTO, therefore
LTOEXTRA can be used to pass those flags
Add -flto-partition=none for alsa-lib
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
meta/conf/distro/include/lto.inc | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/meta/conf/distro/include/lto.inc b/meta/conf/distro/include/lto.inc
index d7fea26c64..eb36b892ca 100644
--- a/meta/conf/distro/include/lto.inc
+++ b/meta/conf/distro/include/lto.inc
@@ -18,6 +18,13 @@ LTO_pn-libcap = ""
LTO_pn-libproxy = ""
LTO_pn-libbsd = ""
+# Custom LTO flags
+# disable partitioning/streaming algorithm since its uses ASM
+# constructs not compatible with lto
+LTOEXTRA_pn-alsa-lib = "-flto-partition=none"
+
+LTOEXTRA ?= ""
+
# Override it for additional or different options if needed e.g.
# with clang thin-lto might be better for compile speed
#
@@ -29,9 +36,9 @@ LTO_pn-libbsd = ""
# -fuse-linker-plugin
# ensures that libraries participate in LTO by supplying intermediate
# code from .a files to linker
-LTO ?= "-flto -ffat-lto-objects -fuse-linker-plugin "
+LTO ?= "-flto -ffat-lto-objects -fuse-linker-plugin ${LTOEXTRA}"
SELECTED_OPTIMIZATION_append = "${@bb.utils.contains('DISTRO_FEATURES', 'lto', ' ${LTO}', '', d)}"
TARGET_LDFLAGS_append_class-target = "${@bb.utils.contains('DISTRO_FEATURES', 'lto', ' ${LTO}', '', d)}"
-SELECTED_OPTIMIZATION[vardeps] += "LTO"
+SELECTED_OPTIMIZATION[vardeps] += "LTO LTOEXTRA"
--
2.29.2
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v5 05/11] libaio: Disable LTO
2020-11-09 0:02 [PATCH v5 01/11] lto: Add global LTO distro policy file Khem Raj
` (2 preceding siblings ...)
2020-11-09 0:02 ` [PATCH v5 04/11] lto: Introduce LTOEXTRA variable Khem Raj
@ 2020-11-09 0:02 ` Khem Raj
2020-11-09 0:02 ` [PATCH v5 06/11] weston: Fix linking with LTO Khem Raj
` (6 subsequent siblings)
10 siblings, 0 replies; 14+ messages in thread
From: Khem Raj @ 2020-11-09 0:02 UTC (permalink / raw)
To: openembedded-core; +Cc: Khem Raj
Libaio uses ASMs to implement symbol versioning which does not work with LTO
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
meta/conf/distro/include/lto.inc | 1 +
1 file changed, 1 insertion(+)
diff --git a/meta/conf/distro/include/lto.inc b/meta/conf/distro/include/lto.inc
index eb36b892ca..9c4e0ef507 100644
--- a/meta/conf/distro/include/lto.inc
+++ b/meta/conf/distro/include/lto.inc
@@ -8,6 +8,7 @@ LTO_pn-glibc = ""
LTO_pn-gcc-runtime = ""
LTO_pn-libgcc-initial = ""
LTO_pn-libgcc = ""
+LTO_pn-libaio = ""
LTO_pn-libpam = ""
LTO_pn-elfutils = ""
LTO_pn-perl = ""
--
2.29.2
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v5 06/11] weston: Fix linking with LTO
2020-11-09 0:02 [PATCH v5 01/11] lto: Add global LTO distro policy file Khem Raj
` (3 preceding siblings ...)
2020-11-09 0:02 ` [PATCH v5 05/11] libaio: Disable LTO Khem Raj
@ 2020-11-09 0:02 ` Khem Raj
2020-11-09 0:02 ` [PATCH v5 07/11] lto.inc: Disable LTO for xserver-xorg Khem Raj
` (5 subsequent siblings)
10 siblings, 0 replies; 14+ messages in thread
From: Khem Raj @ 2020-11-09 0:02 UTC (permalink / raw)
To: openembedded-core; +Cc: Khem Raj
weston uses --no-undefined option during linking which does not work
with LTO therefore override it with -z undefs when lto is enabled in
distro
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
meta/recipes-graphics/wayland/weston_9.0.0.bb | 2 ++
1 file changed, 2 insertions(+)
diff --git a/meta/recipes-graphics/wayland/weston_9.0.0.bb b/meta/recipes-graphics/wayland/weston_9.0.0.bb
index 75f9fb05fd..051fd85941 100644
--- a/meta/recipes-graphics/wayland/weston_9.0.0.bb
+++ b/meta/recipes-graphics/wayland/weston_9.0.0.bb
@@ -26,6 +26,8 @@ REQUIRED_DISTRO_FEATURES = "opengl"
DEPENDS = "libxkbcommon gdk-pixbuf pixman cairo glib-2.0"
DEPENDS += "wayland wayland-protocols libinput virtual/egl pango wayland-native"
+LDFLAGS += "${@bb.utils.contains('DISTRO_FEATURES', 'lto', '-Wl,-z,undefs', '', d)}"
+
WESTON_MAJOR_VERSION = "${@'.'.join(d.getVar('PV').split('.')[0:1])}"
EXTRA_OEMESON += "-Dbackend-default=auto -Dbackend-rdp=false -Dpipewire=false"
--
2.29.2
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v5 07/11] lto.inc: Disable LTO for xserver-xorg
2020-11-09 0:02 [PATCH v5 01/11] lto: Add global LTO distro policy file Khem Raj
` (4 preceding siblings ...)
2020-11-09 0:02 ` [PATCH v5 06/11] weston: Fix linking with LTO Khem Raj
@ 2020-11-09 0:02 ` Khem Raj
2020-11-09 0:02 ` [PATCH v5 08/11] gcc: Do no parameterize LTO configuration flags Khem Raj
` (4 subsequent siblings)
10 siblings, 0 replies; 14+ messages in thread
From: Khem Raj @ 2020-11-09 0:02 UTC (permalink / raw)
To: openembedded-core; +Cc: Khem Raj
It ends up with undefined symbol when LTO is enabled
Fixes
test/xi2/protocol-xiquerydevice.c:345: undefined reference to `GrabButton'
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
meta/conf/distro/include/lto.inc | 1 +
1 file changed, 1 insertion(+)
diff --git a/meta/conf/distro/include/lto.inc b/meta/conf/distro/include/lto.inc
index 9c4e0ef507..bd433aa418 100644
--- a/meta/conf/distro/include/lto.inc
+++ b/meta/conf/distro/include/lto.inc
@@ -18,6 +18,7 @@ LTO_pn-curl = ""
LTO_pn-libcap = ""
LTO_pn-libproxy = ""
LTO_pn-libbsd = ""
+LTO_pn-xserver-xorg = ""
# Custom LTO flags
# disable partitioning/streaming algorithm since its uses ASM
--
2.29.2
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v5 08/11] gcc: Do no parameterize LTO configuration flags
2020-11-09 0:02 [PATCH v5 01/11] lto: Add global LTO distro policy file Khem Raj
` (5 preceding siblings ...)
2020-11-09 0:02 ` [PATCH v5 07/11] lto.inc: Disable LTO for xserver-xorg Khem Raj
@ 2020-11-09 0:02 ` Khem Raj
2020-11-09 0:02 ` [PATCH v5 09/11] puzzles: Check for excessive constant arguments Khem Raj
` (3 subsequent siblings)
10 siblings, 0 replies; 14+ messages in thread
From: Khem Raj @ 2020-11-09 0:02 UTC (permalink / raw)
To: openembedded-core; +Cc: Khem Raj
These flags are redundant as LTO now enabled in GCC by default for
sometime, Moreover, dropping LTO variable here avoids a conflict with
global LTO variable being added for distrowide LTO support
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
meta/recipes-devtools/gcc/gcc-10.2.inc | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/meta/recipes-devtools/gcc/gcc-10.2.inc b/meta/recipes-devtools/gcc/gcc-10.2.inc
index 7625af5110..e88f2ade6d 100644
--- a/meta/recipes-devtools/gcc/gcc-10.2.inc
+++ b/meta/recipes-devtools/gcc/gcc-10.2.inc
@@ -81,14 +81,13 @@ S = "${TMPDIR}/work-shared/gcc-${PV}-${PR}/gcc-${PV}"
FORTRAN = ""
JAVA = ""
-LTO = "--enable-lto"
SSP ?= "--disable-libssp"
SSP_mingw32 = "--enable-libssp"
EXTRA_OECONF_BASE = "\
- ${LTO} \
${SSP} \
--enable-libitm \
+ --enable-lto \
--disable-bootstrap \
--with-system-zlib \
${@'--with-linker-hash-style=${LINKER_HASH_STYLE}' if '${LINKER_HASH_STYLE}' else ''} \
--
2.29.2
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v5 09/11] puzzles: Check for excessive constant arguments
2020-11-09 0:02 [PATCH v5 01/11] lto: Add global LTO distro policy file Khem Raj
` (6 preceding siblings ...)
2020-11-09 0:02 ` [PATCH v5 08/11] gcc: Do no parameterize LTO configuration flags Khem Raj
@ 2020-11-09 0:02 ` Khem Raj
2020-11-09 0:02 ` [PATCH v5 10/11] lto.inc: Disable LTO for perf Khem Raj
` (2 subsequent siblings)
10 siblings, 0 replies; 14+ messages in thread
From: Khem Raj @ 2020-11-09 0:02 UTC (permalink / raw)
To: openembedded-core; +Cc: Khem Raj
Fixes an issue found with LTO builds
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
...Check-for-excessive-values-to-malloc.patch | 49 +++++++++++++++++++
meta/recipes-sato/puzzles/puzzles_git.bb | 1 +
2 files changed, 50 insertions(+)
create mode 100644 meta/recipes-sato/puzzles/files/0001-malloc-Check-for-excessive-values-to-malloc.patch
diff --git a/meta/recipes-sato/puzzles/files/0001-malloc-Check-for-excessive-values-to-malloc.patch b/meta/recipes-sato/puzzles/files/0001-malloc-Check-for-excessive-values-to-malloc.patch
new file mode 100644
index 0000000000..66af6afa2f
--- /dev/null
+++ b/meta/recipes-sato/puzzles/files/0001-malloc-Check-for-excessive-values-to-malloc.patch
@@ -0,0 +1,49 @@
+From 1c01a5bc9ac7f8aaa484b1a8e0e74aa5f8899d0e Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Sun, 8 Nov 2020 11:17:59 -0800
+Subject: [PATCH] malloc: Check for excessive values to malloc
+
+with whole program optimizers like lto smalloc()
+is inlined the excessive constant argument is propagated to
+malloc() and ultimately triggers the warning.
+
+malloc.c:15:9: error: argument 1 range [18446744065119617024, 18446744073709551580] exceeds maximum object size 9223372036854775807 [-Werror=alloc-size-larger-than=]
+
+therefore add a check before excessive constant argument before calling
+malloc
+
+Note that this will not happen with normal compile since they happen to
+be in different translation units and compiler can not semantically
+analyze as much
+
+Upstream-Status: Pending
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ malloc.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/malloc.c b/malloc.c
+index a7fa7c5..520377c 100644
+--- a/malloc.c
++++ b/malloc.c
+@@ -2,6 +2,7 @@
+ * malloc.c: safe wrappers around malloc, realloc, free, strdup
+ */
+
++#include <stdint.h>
+ #include <stdlib.h>
+ #include <string.h>
+ #include "puzzles.h"
+@@ -12,6 +13,8 @@
+ */
+ void *smalloc(size_t size) {
+ void *p;
++ if (size > PTRDIFF_MAX)
++ fatal("exceeds maximum object size");
+ p = malloc(size);
+ if (!p)
+ fatal("out of memory");
+--
+2.29.2
+
diff --git a/meta/recipes-sato/puzzles/puzzles_git.bb b/meta/recipes-sato/puzzles/puzzles_git.bb
index a0f3b5d9cd..8e4d5b3349 100644
--- a/meta/recipes-sato/puzzles/puzzles_git.bb
+++ b/meta/recipes-sato/puzzles/puzzles_git.bb
@@ -14,6 +14,7 @@ SRC_URI = "git://git.tartarus.org/simon/puzzles.git \
file://0001-Use-Wno-error-format-overflow-if-the-compiler-suppor.patch \
file://0001-pattern.c-Change-string-lenght-parameter-to-be-size_.patch \
file://fix-ki-uninitialized.patch \
+ file://0001-malloc-Check-for-excessive-values-to-malloc.patch \
"
UPSTREAM_CHECK_COMMITS = "1"
--
2.29.2
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v5 10/11] lto.inc: Disable LTO for perf
2020-11-09 0:02 [PATCH v5 01/11] lto: Add global LTO distro policy file Khem Raj
` (7 preceding siblings ...)
2020-11-09 0:02 ` [PATCH v5 09/11] puzzles: Check for excessive constant arguments Khem Raj
@ 2020-11-09 0:02 ` Khem Raj
2020-11-09 0:02 ` [PATCH v5 11/11] gcc: Handle duplicate names for variables Khem Raj
2020-11-09 8:30 ` [OE-core] [PATCH v5 01/11] lto: Add global LTO distro policy file Andreas Müller
10 siblings, 0 replies; 14+ messages in thread
From: Khem Raj @ 2020-11-09 0:02 UTC (permalink / raw)
To: openembedded-core; +Cc: Khem Raj
perf invokes kernel sources, and currently fails in multiple places for
now therefore disable LTO for perf
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
meta/conf/distro/include/lto.inc | 1 +
1 file changed, 1 insertion(+)
diff --git a/meta/conf/distro/include/lto.inc b/meta/conf/distro/include/lto.inc
index bd433aa418..bb957084b5 100644
--- a/meta/conf/distro/include/lto.inc
+++ b/meta/conf/distro/include/lto.inc
@@ -18,6 +18,7 @@ LTO_pn-curl = ""
LTO_pn-libcap = ""
LTO_pn-libproxy = ""
LTO_pn-libbsd = ""
+LTO_pn-perf = ""
LTO_pn-xserver-xorg = ""
# Custom LTO flags
--
2.29.2
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v5 11/11] gcc: Handle duplicate names for variables
2020-11-09 0:02 [PATCH v5 01/11] lto: Add global LTO distro policy file Khem Raj
` (8 preceding siblings ...)
2020-11-09 0:02 ` [PATCH v5 10/11] lto.inc: Disable LTO for perf Khem Raj
@ 2020-11-09 0:02 ` Khem Raj
2020-11-09 8:30 ` [OE-core] [PATCH v5 01/11] lto: Add global LTO distro policy file Andreas Müller
10 siblings, 0 replies; 14+ messages in thread
From: Khem Raj @ 2020-11-09 0:02 UTC (permalink / raw)
To: openembedded-core; +Cc: Khem Raj
PREFIXVAR is defined in cppdefaults.c as well which shows up as error
when LTO is enabled to build gcc, therefore rename the one instance to PREFIXVAR1
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
...4-handle-sysroot-support-for-nativesdk-gcc.patch | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/meta/recipes-devtools/gcc/gcc/0024-handle-sysroot-support-for-nativesdk-gcc.patch b/meta/recipes-devtools/gcc/gcc/0024-handle-sysroot-support-for-nativesdk-gcc.patch
index 1a65ece7bf..dc3e6da65a 100644
--- a/meta/recipes-devtools/gcc/gcc/0024-handle-sysroot-support-for-nativesdk-gcc.patch
+++ b/meta/recipes-devtools/gcc/gcc/0024-handle-sysroot-support-for-nativesdk-gcc.patch
@@ -1,4 +1,4 @@
-From bb1f359e34649516e61305e9748534cce7e0ee70 Mon Sep 17 00:00:00 2001
+From 702daf2e9cb97337e0e594fcd435b1b61a917d14 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Mon, 7 Dec 2015 23:39:54 +0000
Subject: [PATCH] handle sysroot support for nativesdk-gcc
@@ -321,7 +321,7 @@ index 9098ab044ab..bfad4ebe382 100644
str = update_path (ostr, p->component);
free (ostr);
diff --git a/gcc/prefix.c b/gcc/prefix.c
-index 1a403e535bd..3257ed3cd3e 100644
+index 1a403e535bd..c26d07bde12 100644
--- a/gcc/prefix.c
+++ b/gcc/prefix.c
@@ -72,7 +72,9 @@ License along with GCC; see the file COPYING3. If not see
@@ -329,9 +329,9 @@ index 1a403e535bd..3257ed3cd3e 100644
#include "common/common-target.h"
-static const char *std_prefix = PREFIX;
-+static const char PREFIXVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = PREFIX;
++char PREFIXVAR1[4096] __attribute__ ((section (".gccrelocprefix"))) = PREFIX;
+
-+static const char *std_prefix = PREFIXVAR;
++static const char *std_prefix = PREFIXVAR1;
static const char *get_key_value (char *);
static char *translate_name (char *);
@@ -340,7 +340,10 @@ index 1a403e535bd..3257ed3cd3e 100644
if (prefix == 0)
- prefix = PREFIX;
-+ prefix = PREFIXVAR;
++ prefix = PREFIXVAR1;
/* We used to strip trailing DIR_SEPARATORs here, but that can
sometimes yield a result with no separator when one was coded
+--
+2.29.2
+
--
2.29.2
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [OE-core] [PATCH v5 01/11] lto: Add global LTO distro policy file
2020-11-09 0:02 [PATCH v5 01/11] lto: Add global LTO distro policy file Khem Raj
` (9 preceding siblings ...)
2020-11-09 0:02 ` [PATCH v5 11/11] gcc: Handle duplicate names for variables Khem Raj
@ 2020-11-09 8:30 ` Andreas Müller
2020-11-09 19:14 ` Khem Raj
10 siblings, 1 reply; 14+ messages in thread
From: Andreas Müller @ 2020-11-09 8:30 UTC (permalink / raw)
To: Khem Raj; +Cc: Patches and discussions about the oe-core layer
On Mon, Nov 9, 2020 at 1:02 AM Khem Raj <raj.khem@gmail.com> wrote:
>
> 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
>
> Document the needed changes in local.conf.extended
>
Maybe I missed something but I haven't seen a word why I should want
link time optimization. And from the patches I see here it seems we
are about to create another contributor's burden.
Andreas
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [OE-core] [PATCH v5 01/11] lto: Add global LTO distro policy file
2020-11-09 8:30 ` [OE-core] [PATCH v5 01/11] lto: Add global LTO distro policy file Andreas Müller
@ 2020-11-09 19:14 ` Khem Raj
2020-11-09 20:18 ` Andreas Müller
0 siblings, 1 reply; 14+ messages in thread
From: Khem Raj @ 2020-11-09 19:14 UTC (permalink / raw)
To: Andreas Müller; +Cc: Patches and discussions about the oe-core layer
On Mon, Nov 9, 2020 at 12:30 AM Andreas Müller <schnitzeltony@gmail.com> wrote:
>
> On Mon, Nov 9, 2020 at 1:02 AM Khem Raj <raj.khem@gmail.com> wrote:
> >
> > 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
> >
> > Document the needed changes in local.conf.extended
> >
> Maybe I missed something but I haven't seen a word why I should want
> link time optimization. And from the patches I see here it seems we
> are about to create another contributor's burden.
>
Thanks for your feedback. LTO is quite beneficial for the kind of
images OE is targeting,
It results in smaller binaries and better optimizations as well. LTO
has been around for a while
in GCC but it is becoming useful with gcc10+ and more distros e.g.
Fedora/SuSE are also starting
to use LTO distro wide which means we will be able to reuse the
upstream work that's ongoing in
different packages. You can see there are patches already floating to
enable it for poky-tiny already
so OE userbase is already starting to use it. Moreover, its already
default for many packages themselves
so you might already be using it at package level e.g. systemd
This is similar to what we did for enabling security flags. As you
can see, these changes are currently optional. This means they won't
go into effect for
distros without them choosing to use it via DISTRO_FEATURES. Since it
takes a bit to get
such changes stable, we might keep it disabled by default for the next
release depending upon
how it pans out. Eventually, the plan is to enable it for poky/yocto distro.
As far as the contribution burden, I think it won't be a blocker until
it becomes one of the tested configurations
on yocto auto-builder.
Feel free to express if you have more concerns.
> Andreas
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [OE-core] [PATCH v5 01/11] lto: Add global LTO distro policy file
2020-11-09 19:14 ` Khem Raj
@ 2020-11-09 20:18 ` Andreas Müller
0 siblings, 0 replies; 14+ messages in thread
From: Andreas Müller @ 2020-11-09 20:18 UTC (permalink / raw)
To: Khem Raj; +Cc: Patches and discussions about the oe-core layer
On Mon, Nov 9, 2020 at 8:15 PM Khem Raj <raj.khem@gmail.com> wrote:
>
> On Mon, Nov 9, 2020 at 12:30 AM Andreas Müller <schnitzeltony@gmail.com> wrote:
> >
> > On Mon, Nov 9, 2020 at 1:02 AM Khem Raj <raj.khem@gmail.com> wrote:
> > >
> > > 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
> > >
> > > Document the needed changes in local.conf.extended
> > >
> > Maybe I missed something but I haven't seen a word why I should want
> > link time optimization. And from the patches I see here it seems we
> > are about to create another contributor's burden.
> >
>
> Thanks for your feedback. LTO is quite beneficial for the kind of
> images OE is targeting,
> It results in smaller binaries and better optimizations as well. LTO
> has been around for a while
> in GCC but it is becoming useful with gcc10+ and more distros e.g.
> Fedora/SuSE are also starting
> to use LTO distro wide which means we will be able to reuse the
> upstream work that's ongoing in
> different packages. You can see there are patches already floating to
> enable it for poky-tiny already
> so OE userbase is already starting to use it. Moreover, its already
> default for many packages themselves
> so you might already be using it at package level e.g. systemd
>
> This is similar to what we did for enabling security flags. As you
> can see, these changes are currently optional. This means they won't
> go into effect for
> distros without them choosing to use it via DISTRO_FEATURES. Since it
> takes a bit to get
> such changes stable, we might keep it disabled by default for the next
> release depending upon
> how it pans out. Eventually, the plan is to enable it for poky/yocto distro.
>
> As far as the contribution burden, I think it won't be a blocker until
> it becomes one of the tested configurations
> on yocto auto-builder.
>
> Feel free to express if you have more concerns.
>
Thanks for explanation. At least I understand better now why you (and
others?) are taking efforts on LTO support.
Andreas
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2020-11-09 20:18 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-11-09 0:02 [PATCH v5 01/11] lto: Add global LTO distro policy file Khem Raj
2020-11-09 0:02 ` [PATCH v5 02/11] python3: Enable lto if its in DISTRO_FEATURES Khem Raj
2020-11-09 0:02 ` [PATCH v5 03/11] lto.inc: Add -ffat-lto-objects and -fuse-linker-plugin Khem Raj
2020-11-09 0:02 ` [PATCH v5 04/11] lto: Introduce LTOEXTRA variable Khem Raj
2020-11-09 0:02 ` [PATCH v5 05/11] libaio: Disable LTO Khem Raj
2020-11-09 0:02 ` [PATCH v5 06/11] weston: Fix linking with LTO Khem Raj
2020-11-09 0:02 ` [PATCH v5 07/11] lto.inc: Disable LTO for xserver-xorg Khem Raj
2020-11-09 0:02 ` [PATCH v5 08/11] gcc: Do no parameterize LTO configuration flags Khem Raj
2020-11-09 0:02 ` [PATCH v5 09/11] puzzles: Check for excessive constant arguments Khem Raj
2020-11-09 0:02 ` [PATCH v5 10/11] lto.inc: Disable LTO for perf Khem Raj
2020-11-09 0:02 ` [PATCH v5 11/11] gcc: Handle duplicate names for variables Khem Raj
2020-11-09 8:30 ` [OE-core] [PATCH v5 01/11] lto: Add global LTO distro policy file Andreas Müller
2020-11-09 19:14 ` Khem Raj
2020-11-09 20:18 ` Andreas Müller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox