gcc-target: Create a LTO plugin symlink in bfd-plugins directory
PATCH 1/4 gcc-target: Create a LTO plugin symlink in bfd-plugins directory
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
--- meta/recipes-devtools/gcc/gcc-target.inc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
meta/recipes-devtools/gcc/gcc-target.inc +3 -1
@@ -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} }
Signature · 1 line
2.31.1
PATCH 2/4 bitbake.conf: Use gcc-nm as default NM
This ensures linker LTO plugin is loaded correctly
--- meta/conf/bitbake.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
meta/conf/bitbake.conf +1 -1
@@ -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}"
Signature · 1 line
2.31.1
PATCH 3/4 gcc-cross-canadian: Install LTO linker plugin to BFD searchable location
In reply to Khem RajThis 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
--- meta/recipes-devtools/gcc/gcc-cross-canadian.inc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
meta/recipes-devtools/gcc/gcc-cross-canadian.inc +8 -1
@@ -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}
Signature · 1 line
2.31.1
PATCH 4/4 gcc-cross: Install linker LTO plugin for bintutils tools
In reply to Khem RajThis 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
--- meta/recipes-devtools/gcc/gcc-cross.inc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
meta/recipes-devtools/gcc/gcc-cross.inc +7 -1
@@ -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"
Signature · 1 line
2.31.1