summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2022-07-20 12:29:39 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-07-23 12:10:32 +0100
commitbdccd18d1f8b7810934d700dfbb184729665d712 (patch)
treecf98426456f0fd3fffc407541e21281b8b98f134
parent5d599c685dfb94e56b06d4270c02602e7c1b0fd4 (diff)
downloadopenembedded-core-contrib-bdccd18d1f8b7810934d700dfbb184729665d712.tar.gz
libgcc/gcc-runtime: Improve source reference handling
This code was some of the earliest reproducible build work we did. To correctly handle the encoding of file paths, we used relative build paths to run configure which resulted in relative build paths in the binaries. We now have more modern approaches used elsewhere with the prefix remapping options. These work best with absolute paths, not relative ones. As such, drop the relative path mangling and switch to using prefix mapping exclusively on absolute paths. This makes the code matc the rest of the system and triggers the correct code to be added in /usr/src/debug. We have to include both file-prefix and debug-prefix since the assembler only looks at debug-prefix. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/recipes-devtools/gcc/gcc-runtime.inc22
-rw-r--r--meta/recipes-devtools/gcc/libgcc-common.inc11
2 files changed, 19 insertions, 14 deletions
diff --git a/meta/recipes-devtools/gcc/gcc-runtime.inc b/meta/recipes-devtools/gcc/gcc-runtime.inc
index 3e1c799ba1..ad04b77c04 100644
--- a/meta/recipes-devtools/gcc/gcc-runtime.inc
+++ b/meta/recipes-devtools/gcc/gcc-runtime.inc
@@ -50,16 +50,15 @@ RUNTIMETARGET:libc-newlib = "libstdc++-v3"
# libgfortran needs separate recipe due to libquadmath dependency
# Relative path to be repaced into debug info
-REL_S = "/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}"
-
-DEBUG_PREFIX_MAP:class-target = " \
- -fdebug-prefix-map=${WORKDIR}/${MLPREFIX}recipe-sysroot= \
- -fdebug-prefix-map=${WORKDIR}/recipe-sysroot-native= \
- -fdebug-prefix-map=${S}=${REL_S} \
- -fdebug-prefix-map=${S}/include=${REL_S}/libstdc++-v3/../include \
- -fdebug-prefix-map=${S}/libiberty=${REL_S}/libstdc++-v3/../libiberty \
- -fdebug-prefix-map=${S}/libgcc=${REL_S}/libstdc++-v3/../libgcc \
- -fdebug-prefix-map=${B}=${REL_S} \
+DEBUGSOURCE = "/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}"
+
+DEBUG_PREFIX_MAP = " \
+ -ffile-prefix-map=${WORKDIR}/${MLPREFIX}recipe-sysroot= \
+ -ffile-prefix-map=${WORKDIR}/recipe-sysroot-native= \
+ -ffile-prefix-map=${B}=${DEBUGSOURCE} \
+ -ffile-prefix-map=${S}=${DEBUGSOURCE} \
+ -fdebug-prefix-map=${B}=${DEBUGSOURCE} \
+ -fdebug-prefix-map=${S}=${DEBUGSOURCE} \
-ffile-prefix-map=${B}/${HOST_SYS}/libstdc++-v3/include=${includedir}/c++/${BINV} \
"
@@ -75,8 +74,7 @@ do_configure () {
mkdir -p ${B}/${TARGET_SYS}/$d/
cd ${B}/${TARGET_SYS}/$d/
chmod a+x ${S}/$d/configure
- relpath=${@os.path.relpath("${S}/$d", "${B}/${TARGET_SYS}/$d")}
- $relpath/configure ${CONFIGUREOPTS} ${EXTRA_OECONF}
+ ${S}/$d/configure ${CONFIGUREOPTS} ${EXTRA_OECONF}
if [ "$d" = "libgcc" ]; then
(cd ${B}/${TARGET_SYS}/libgcc; oe_runmake enable-execute-stack.c unwind.h md-unwind-support.h sfp-machine.h gthr-default.h)
fi
diff --git a/meta/recipes-devtools/gcc/libgcc-common.inc b/meta/recipes-devtools/gcc/libgcc-common.inc
index fbeb43d718..d0138017e1 100644
--- a/meta/recipes-devtools/gcc/libgcc-common.inc
+++ b/meta/recipes-devtools/gcc/libgcc-common.inc
@@ -4,14 +4,21 @@ require gcc-configure-common.inc
INHIBIT_DEFAULT_DEPS = "1"
+DEBUGSOURCE = "/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}"
+DEBUG_PREFIX_MAP = " \
+ -fdebug-prefix-map=${WORKDIR}/${MLPREFIX}recipe-sysroot= \
+ -fdebug-prefix-map=${WORKDIR}/recipe-sysroot-native= \
+ -fdebug-prefix-map=${B}=${DEBUGSOURCE} \
+ -fdebug-prefix-map=${S}=${DEBUGSOURCE} \
+ "
+
do_configure () {
install -d ${D}${base_libdir} ${D}${libdir}
mkdir -p ${B}/${BPN}
mkdir -p ${B}/${TARGET_SYS}/${BPN}/
cd ${B}/${BPN}
chmod a+x ${S}/${BPN}/configure
- relpath=${@os.path.relpath("${S}/${BPN}", "${B}/${BPN}")}
- $relpath/configure ${CONFIGUREOPTS} ${EXTRA_OECONF}
+ ${S}/${BPN}/configure ${CONFIGUREOPTS} ${EXTRA_OECONF}
}
EXTRACONFFUNCS += "extract_stashed_builddir"
do_configure[depends] += "${COMPILERDEP}"