All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/4] gcc-target: Create a LTO plugin symlink in bfd-plugins directory
@ 2021-04-25 19:08 Khem Raj
  2021-04-25 19:08 ` [PATCH 2/4] bitbake.conf: Use gcc-nm as default NM Khem Raj
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Khem Raj @ 2021-04-25 19:08 UTC (permalink / raw)
  To: openembedded-core; +Cc: Khem Raj

This directory is scanned by binutils provided ar,ranlib,nm for plugins
that it can load automatically, putting liblto_plugin.so in their means
we do not need gcc-ar, gcc-nm, gcc-ranlib particularly as normal
ar/ranlib/nm tools will work equally well as they can now use this
linker plugin by default

This also mean we can revert back to using ar/ranlib/nm as default
providers for AR/NM/RANLIB on target

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 meta/recipes-devtools/gcc/gcc-target.inc | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/meta/recipes-devtools/gcc/gcc-target.inc b/meta/recipes-devtools/gcc/gcc-target.inc
index 164a669aad..0ee3e83d42 100644
--- a/meta/recipes-devtools/gcc/gcc-target.inc
+++ b/meta/recipes-devtools/gcc/gcc-target.inc
@@ -54,6 +54,7 @@ FILES_${PN} = "\
     ${gcclibdir}/${TARGET_SYS}/${BINV}/lib*${SOLIBS} \
     ${gcclibdir}/${TARGET_SYS}/${BINV}/include \
     ${gcclibdir}/${TARGET_SYS}/${BINV}/include-fixed \
+    ${libdir}/bfd-plugins/*.so \
 "
 INSANE_SKIP_${PN} += "dev-so"
 RRECOMMENDS_${PN} += "\
@@ -215,7 +216,8 @@ do_install () {
 	ln -sf ${bindir}/${TARGET_PREFIX}cpp ${D}${base_libdir}/cpp
 	ln -sf g++ c++
 	ln -sf gcc cc
-
+	install -d ${D}${libdir}/bfd-plugins
+	ln -sf ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/liblto_plugin.so ${D}${libdir}/bfd-plugins/liblto_plugin.so
 	chown -R root:root ${D}
 }
 
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/4] bitbake.conf: Use gcc-nm as default NM
  2021-04-25 19:08 [PATCH 1/4] gcc-target: Create a LTO plugin symlink in bfd-plugins directory Khem Raj
@ 2021-04-25 19:08 ` Khem Raj
  2021-04-25 19:08 ` [PATCH 3/4] gcc-cross-canadian: Install LTO linker plugin to BFD searchable location Khem Raj
  2021-04-25 19:08 ` [PATCH 4/4] gcc-cross: Install linker LTO plugin for bintutils tools Khem Raj
  2 siblings, 0 replies; 4+ messages in thread
From: Khem Raj @ 2021-04-25 19:08 UTC (permalink / raw)
  To: openembedded-core; +Cc: Khem Raj

This ensures linker LTO plugin is loaded correctly

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 meta/conf/bitbake.conf | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
index 385fc7dd55..a0e0c77fe6 100644
--- a/meta/conf/bitbake.conf
+++ b/meta/conf/bitbake.conf
@@ -527,7 +527,7 @@ export STRIP = "${HOST_PREFIX}strip"
 export OBJCOPY = "${HOST_PREFIX}objcopy"
 export OBJDUMP = "${HOST_PREFIX}objdump"
 export STRINGS = "${HOST_PREFIX}strings"
-export NM = "${HOST_PREFIX}nm"
+export NM = "${HOST_PREFIX}gcc-nm"
 export READELF = "${HOST_PREFIX}readelf"
 PYTHON = "${@sys.executable}"
 
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 3/4] gcc-cross-canadian: Install LTO linker plugin to BFD searchable location
  2021-04-25 19:08 [PATCH 1/4] gcc-target: Create a LTO plugin symlink in bfd-plugins directory Khem Raj
  2021-04-25 19:08 ` [PATCH 2/4] bitbake.conf: Use gcc-nm as default NM Khem Raj
@ 2021-04-25 19:08 ` Khem Raj
  2021-04-25 19:08 ` [PATCH 4/4] gcc-cross: Install linker LTO plugin for bintutils tools Khem Raj
  2 siblings, 0 replies; 4+ messages in thread
From: Khem Raj @ 2021-04-25 19:08 UTC (permalink / raw)
  To: openembedded-core; +Cc: Khem Raj

This helps binutils provided tools ar/ranlib/nm to find the LTO linker
plugin automatically as well which makes it equivalent to gcc-ar/gcc-nm/gcc-ranlib

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 meta/recipes-devtools/gcc/gcc-cross-canadian.inc | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/meta/recipes-devtools/gcc/gcc-cross-canadian.inc b/meta/recipes-devtools/gcc/gcc-cross-canadian.inc
index d3875c94d3..878feaf810 100644
--- a/meta/recipes-devtools/gcc/gcc-cross-canadian.inc
+++ b/meta/recipes-devtools/gcc/gcc-cross-canadian.inc
@@ -75,6 +75,7 @@ FILES_${PN} = "\
     ${gcclibdir}/${TARGET_SYS}/${BINV}/include-fixed \
     ${gcclibdir}/${TARGET_SYS}/${BINV}/plugin/include/ \
     ${gcclibdir}/${TARGET_SYS}/${BINV}/plugin/gtype.* \
+    ${libdir}/bfd-plugins/*.so \
     ${includedir}/c++/${BINV} \
     ${prefix}/${TARGET_SYS}/bin/* \
     ${prefix}/${TARGET_SYS}/lib/* \
@@ -92,6 +93,8 @@ EXEEXT = ""
 
 # Compute how to get from libexecdir to bindir in python (easier than shell)
 BINRELPATH = "${@os.path.relpath(d.expand("${bindir}"), d.expand("${libexecdir}/gcc/${TARGET_SYS}/${BINV}"))}"
+# linker plugin path
+LIBRELPATH = "${@os.path.relpath(d.expand("${libexecdir}/gcc/${TARGET_SYS}/${BINV}"), d.expand("${libdir}/bfd-plugins"))}"
 
 do_install () {
 	( cd ${B}/${TARGET_SYS}/libgcc; oe_runmake 'DESTDIR=${D}' install-unwind_h-forbuild install-unwind_h )
@@ -136,8 +139,12 @@ do_install () {
 	cp ${S}/libquadmath/quadmath.h ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include/
 	cp ${S}/libquadmath/quadmath_weak.h ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include/
 
+	# install LTO linker plugins where binutils tools can find it
+	install -d ${D}${libdir}/bfd-plugins
+	ln -sf ${LIBRELPATH}/liblto_plugin.so ${D}${libdir}/bfd-plugins/liblto_plugin.so
+
 	chown -R root:root ${D}
-	
+
 	cross_canadian_bindirlinks
 
 	for i in linux ${CANADIANEXTRAOS}
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 4/4] gcc-cross: Install linker LTO plugin for bintutils tools
  2021-04-25 19:08 [PATCH 1/4] gcc-target: Create a LTO plugin symlink in bfd-plugins directory Khem Raj
  2021-04-25 19:08 ` [PATCH 2/4] bitbake.conf: Use gcc-nm as default NM Khem Raj
  2021-04-25 19:08 ` [PATCH 3/4] gcc-cross-canadian: Install LTO linker plugin to BFD searchable location Khem Raj
@ 2021-04-25 19:08 ` Khem Raj
  2 siblings, 0 replies; 4+ messages in thread
From: Khem Raj @ 2021-04-25 19:08 UTC (permalink / raw)
  To: openembedded-core; +Cc: Khem Raj

This will ensure that ar/ranlib/nm can load the lto linker plugin like
gcc-ar, gcc-nm, gcc-ranlib does, this will let the behaviour match
between gcc wrappers for these tools, this should help LTO builds for
packages

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 meta/recipes-devtools/gcc/gcc-cross.inc | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/meta/recipes-devtools/gcc/gcc-cross.inc b/meta/recipes-devtools/gcc/gcc-cross.inc
index e08807afad..dca4036ab5 100644
--- a/meta/recipes-devtools/gcc/gcc-cross.inc
+++ b/meta/recipes-devtools/gcc/gcc-cross.inc
@@ -83,6 +83,8 @@ INHIBIT_PACKAGE_STRIP = "1"
 
 # Compute how to get from libexecdir to bindir in python (easier than shell)
 BINRELPATH = "${@os.path.relpath(d.expand("${STAGING_DIR_NATIVE}${prefix_native}/bin/${TARGET_SYS}"), d.expand("${libexecdir}/gcc/${TARGET_SYS}/${BINV}"))}"
+# linker plugin path
+LIBRELPATH = "${@os.path.relpath(d.expand("${libexecdir}/gcc/${TARGET_SYS}/${BINV}"), d.expand("${STAGING_LIBDIR_NATIVE}/${TARGET_SYS}/bfd-plugins"))}"
 
 do_install () {
 	( cd ${B}/${TARGET_SYS}/libgcc; oe_runmake 'DESTDIR=${D}' install-unwind_h-forbuild install-unwind_h )
@@ -92,7 +94,7 @@ do_install () {
 	install -d ${D}${target_libdir}
 
 	# Link gfortran to g77 to satisfy not-so-smart configure or hard coded g77
-	# gfortran is fully backwards compatible. This is a safe and practical solution. 
+	# gfortran is fully backwards compatible. This is a safe and practical solution.
 	if [ -n "${@d.getVar('FORTRAN')}" ]; then
 		ln -sf ${STAGING_DIR_NATIVE}${prefix_native}/bin/${TARGET_PREFIX}gfortran ${STAGING_DIR_NATIVE}${prefix_native}/bin/${TARGET_PREFIX}g77 || true
 		fortsymlinks="g77 gfortran"
@@ -118,6 +120,10 @@ do_install () {
 	cp ${S}/libquadmath/quadmath_weak.h ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include/
 
 	find ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include-fixed -type f -not -name "README" -not -name limits.h -not -name syslimits.h | xargs rm -f
+
+	# install LTO linker plugins where binutils tools can find it
+	install -d ${D}${libdir}/bfd-plugins
+	ln -sf ${LIBRELPATH}/liblto_plugin.so ${D}${libdir}/bfd-plugins/liblto_plugin.so
 }
 
 do_package[noexec] = "1"
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-04-25 19:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-25 19:08 [PATCH 1/4] gcc-target: Create a LTO plugin symlink in bfd-plugins directory Khem Raj
2021-04-25 19:08 ` [PATCH 2/4] bitbake.conf: Use gcc-nm as default NM Khem Raj
2021-04-25 19:08 ` [PATCH 3/4] gcc-cross-canadian: Install LTO linker plugin to BFD searchable location Khem Raj
2021-04-25 19:08 ` [PATCH 4/4] gcc-cross: Install linker LTO plugin for bintutils tools Khem Raj

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.