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-08-17 19:57:32 +0100
commit794371ad2da471321bfde494523ee73a10380e0a (patch)
treeb6b5d09acad809e9d51b01940a8e69707ed3d5e9
parent1d6c7af0e35811e66a0b3cd3dcc7e3d15b54f99a (diff)
downloadpoky-794371ad2da471321bfde494523ee73a10380e0a.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. (From OE-Core rev: 309e5d8bb56eb8599d756831f0bd38e6a50cfb05) 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 b8bfdcedad..35a3077a4a 100644
--- a/meta/recipes-devtools/gcc/gcc-runtime.inc
+++ b/meta/recipes-devtools/gcc/gcc-runtime.inc
@@ -51,16 +51,15 @@ RUNTIMETARGET:libc-newlib = "libstdc++-v3"
51# libgfortran needs separate recipe due to libquadmath dependency 51# libgfortran needs separate recipe due to libquadmath dependency
52 52
53# Relative path to be repaced into debug info 53# Relative path to be repaced into debug info
54REL_S = "/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}" 54DEBUGSOURCE = "/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}"
55 55
56DEBUG_PREFIX_MAP:class-target = " \ 56DEBUG_PREFIX_MAP = " \
57 -fdebug-prefix-map=${WORKDIR}/${MLPREFIX}recipe-sysroot= \ 57 -ffile-prefix-map=${WORKDIR}/${MLPREFIX}recipe-sysroot= \
58 -fdebug-prefix-map=${WORKDIR}/recipe-sysroot-native= \ 58 -ffile-prefix-map=${WORKDIR}/recipe-sysroot-native= \
59 -fdebug-prefix-map=${S}=${REL_S} \ 59 -ffile-prefix-map=${B}=${DEBUGSOURCE} \
60 -fdebug-prefix-map=${S}/include=${REL_S}/libstdc++-v3/../include \ 60 -ffile-prefix-map=${S}=${DEBUGSOURCE} \
61 -fdebug-prefix-map=${S}/libiberty=${REL_S}/libstdc++-v3/../libiberty \ 61 -fdebug-prefix-map=${B}=${DEBUGSOURCE} \
62 -fdebug-prefix-map=${S}/libgcc=${REL_S}/libstdc++-v3/../libgcc \ 62 -fdebug-prefix-map=${S}=${DEBUGSOURCE} \
63 -fdebug-prefix-map=${B}=${REL_S} \
64 -ffile-prefix-map=${B}/${HOST_SYS}/libstdc++-v3/include=${includedir}/c++/${BINV} \ 63 -ffile-prefix-map=${B}/${HOST_SYS}/libstdc++-v3/include=${includedir}/c++/${BINV} \
65 " 64 "
66 65
@@ -77,8 +76,7 @@ do_configure () {
77 mkdir -p ${B}/${TARGET_SYS}/$d/ 76 mkdir -p ${B}/${TARGET_SYS}/$d/
78 cd ${B}/${TARGET_SYS}/$d/ 77 cd ${B}/${TARGET_SYS}/$d/
79 chmod a+x ${S}/$d/configure 78 chmod a+x ${S}/$d/configure
80 relpath=${@os.path.relpath("${S}/$d", "${B}/${TARGET_SYS}/$d")} 79 ${S}/$d/configure ${CONFIGUREOPTS} ${EXTRA_OECONF}
81 $relpath/configure ${CONFIGUREOPTS} ${EXTRA_OECONF}
82 if [ "$d" = "libgcc" ]; then 80 if [ "$d" = "libgcc" ]; then
83 (cd ${B}/${TARGET_SYS}/libgcc; oe_runmake enable-execute-stack.c unwind.h md-unwind-support.h sfp-machine.h gthr-default.h) 81 (cd ${B}/${TARGET_SYS}/libgcc; oe_runmake enable-execute-stack.c unwind.h md-unwind-support.h sfp-machine.h gthr-default.h)
84 fi 82 fi
diff --git a/meta/recipes-devtools/gcc/libgcc-common.inc b/meta/recipes-devtools/gcc/libgcc-common.inc
index cf8d6b7ed6..e813926313 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
4 4
5INHIBIT_DEFAULT_DEPS = "1" 5INHIBIT_DEFAULT_DEPS = "1"
6 6
7DEBUGSOURCE = "/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}"
8DEBUG_PREFIX_MAP = " \
9 -fdebug-prefix-map=${WORKDIR}/${MLPREFIX}recipe-sysroot= \
10 -fdebug-prefix-map=${WORKDIR}/recipe-sysroot-native= \
11 -fdebug-prefix-map=${B}=${DEBUGSOURCE} \
12 -fdebug-prefix-map=${S}=${DEBUGSOURCE} \
13 "
14
7do_configure () { 15do_configure () {
8 install -d ${D}${base_libdir} ${D}${libdir} 16 install -d ${D}${base_libdir} ${D}${libdir}
9 mkdir -p ${B}/${BPN} 17 mkdir -p ${B}/${BPN}
10 mkdir -p ${B}/${TARGET_SYS}/${BPN}/ 18 mkdir -p ${B}/${TARGET_SYS}/${BPN}/
11 cd ${B}/${BPN} 19 cd ${B}/${BPN}
12 chmod a+x ${S}/${BPN}/configure 20 chmod a+x ${S}/${BPN}/configure
13 relpath=${@os.path.relpath("${S}/${BPN}", "${B}/${BPN}")} 21 ${S}/${BPN}/configure ${CONFIGUREOPTS} ${EXTRA_OECONF}
14 $relpath/configure ${CONFIGUREOPTS} ${EXTRA_OECONF}
15} 22}
16EXTRACONFFUNCS += "extract_stashed_builddir" 23EXTRACONFFUNCS += "extract_stashed_builddir"
17do_configure[depends] += "${COMPILERDEP}" 24do_configure[depends] += "${COMPILERDEP}"