From patchwork Tue Aug 16 20:57:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Purdie X-Patchwork-Id: 11466 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9C270C3F6B0 for ; Tue, 16 Aug 2022 20:57:50 +0000 (UTC) Received: from mail-wr1-f50.google.com (mail-wr1-f50.google.com [209.85.221.50]) by mx.groups.io with SMTP id smtpd.web10.20998.1660683469463840658 for ; Tue, 16 Aug 2022 13:57:49 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@linuxfoundation.org header.s=google header.b=gbQCyQEl; spf=pass (domain: linuxfoundation.org, ip: 209.85.221.50, mailfrom: richard.purdie@linuxfoundation.org) Received: by mail-wr1-f50.google.com with SMTP id v3so14047533wrp.0 for ; Tue, 16 Aug 2022 13:57:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc; bh=QBT+jHDdtvtu22KpPbuQ1AGEVdBbC9mwR0GrFr1eTXo=; b=gbQCyQEl1TRE4y5Nq/uJnfhDJSuX2pQn0WDlXWR7z7szDrgNOuWy74o6+yHR5nJXQZ /EOIzaQVfNhJHsXws59OUBKwFF1Mgwudp1mY27DXYH2Dh3RuHju7s6mQ6PiRbTVi0an4 KcmuOA0AZHw/zh+6a4WvQs9cWKb3PGXdi2Who= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc; bh=QBT+jHDdtvtu22KpPbuQ1AGEVdBbC9mwR0GrFr1eTXo=; b=oHa+5TCVy1L4KUGKqgjgIYJcODC4hYBnto7H7SmJSs++syBs7iQSLHMfRXaVwpUnb+ qASP+JTMF4KQrfm5IrmgJlCBDh8A0T55ty5epyFN6a4Wf/fhrYSKXgUj6IEA0QmhzIJH cP1wHQaqlqWJ9cLnrYP6+7cNIy8X7lv5P+FlogM0jM9jzZTMrbJx2LzfGp0O6XW9/Gzl WfrgVp++BImrBuwfZDaDZwT2zf7D0/r4woBoBhGwEjSPlRikKZ1QS4p3OFEJexx386x2 mUK1bVWsc2AQa5q3r+GZ3qSzX9pdH1QmUp7Hev9nf/CTGiP0JqSbHhtw92DmCTXts7rG lbmA== X-Gm-Message-State: ACgBeo1BNcgm5H3US8yJRu9ymPa5Wo7mbmZyE2IgEf5szqcwMsLSexME fNVleRZxyQQDBGvtuXxgz3IU00GXb1RyEw== X-Google-Smtp-Source: AA6agR41S44yeMcqZ+CB5UOsdROYxRxb+PKL7+JmLhtugjYqqtLavIk+dm6vC7DvuzGyJeO5ghKl8A== X-Received: by 2002:a5d:64e9:0:b0:220:7dd7:63eb with SMTP id g9-20020a5d64e9000000b002207dd763ebmr12663588wri.590.1660683467206; Tue, 16 Aug 2022 13:57:47 -0700 (PDT) Received: from max.int.rpsys.net ([2001:8b0:aba:5f3c:3694:2ef4:2932:37d5]) by smtp.gmail.com with ESMTPSA id m18-20020adffa12000000b002250f9abdefsm5349460wrr.117.2022.08.16.13.57.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Aug 2022 13:57:46 -0700 (PDT) From: Richard Purdie To: openembedded-core@lists.openembedded.org Subject: [PATCH 1/8] package: Switch debug source handling to use prefix map Date: Tue, 16 Aug 2022 21:57:39 +0100 Message-Id: <20220816205746.1672987-1-richard.purdie@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Tue, 16 Aug 2022 20:57:50 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/169455 Reproducible builds are no longer a configuration option but are required. We also rely on the prefix mapping capability of the compilers now. As such, rewrite the source locating code to use the prefix maps instead of taking a guess about WORKDIR which isn't correct for kernels, gcc, externalsrc and probably more. Instead, iterate the maps to locate any matching source code, keeping in mind that multiple maps may map to one target location. Signed-off-by: Richard Purdie --- meta/classes-global/package.bbclass | 68 ++++++++++++----------------- 1 file changed, 28 insertions(+), 40 deletions(-) diff --git a/meta/classes-global/package.bbclass b/meta/classes-global/package.bbclass index 418400da8c9..2d985d8affd 100644 --- a/meta/classes-global/package.bbclass +++ b/meta/classes-global/package.bbclass @@ -565,26 +565,16 @@ def copydebugsources(debugsrcdir, sources, d): objcopy = d.getVar("OBJCOPY") workdir = d.getVar("WORKDIR") sdir = d.getVar("S") - sparentdir = os.path.dirname(os.path.dirname(sdir)) - sbasedir = os.path.basename(os.path.dirname(sdir)) + "/" + os.path.basename(sdir) - workparentdir = os.path.dirname(os.path.dirname(workdir)) - workbasedir = os.path.basename(os.path.dirname(workdir)) + "/" + os.path.basename(workdir) - - # If S isnt based on WORKDIR we can infer our sources are located elsewhere, - # e.g. using externalsrc; use S as base for our dirs - if workdir in sdir or 'work-shared' in sdir: - basedir = workbasedir - parentdir = workparentdir - else: - basedir = sbasedir - parentdir = sparentdir + cflags = d.expand("${CFLAGS}") - # If build path exists in sourcefile, it means toolchain did not use - # -fdebug-prefix-map to compile - if checkbuildpath(sourcefile, d): - localsrc_prefix = parentdir + "/" - else: - localsrc_prefix = "/usr/src/debug/" + prefixmap = {} + for flag in cflags.split(): + if not flag.startswith("-fdebug-prefix-map"): + continue + if "recipe-sysroot" in flag: + continue + flag = flag.split("=") + prefixmap[flag[1]] = flag[2] nosuchdir = [] basepath = dvar @@ -595,28 +585,26 @@ def copydebugsources(debugsrcdir, sources, d): bb.utils.mkdirhier(basepath) cpath.updatecache(basepath) - # Ignore files from the recipe sysroots (target and native) - processdebugsrc = "LC_ALL=C ; sort -z -u '%s' | egrep -v -z '((|)$|/.*recipe-sysroot.*/)' | " - # We need to ignore files that are not actually ours - # we do this by only paying attention to items from this package - processdebugsrc += "fgrep -zw '%s' | " - # Remove prefix in the source paths - processdebugsrc += "sed 's#%s##g' | " - processdebugsrc += "(cd '%s' ; cpio -pd0mlL --no-preserve-owner '%s%s' 2>/dev/null)" - - cmd = processdebugsrc % (sourcefile, basedir, localsrc_prefix, parentdir, dvar, debugsrcdir) - try: - subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT) - except subprocess.CalledProcessError: - # Can "fail" if internal headers/transient sources are attempted - pass - - # cpio seems to have a bug with -lL together and symbolic links are just copied, not dereferenced. - # Work around this by manually finding and copying any symbolic links that made it through. - cmd = "find %s%s -type l -print0 -delete | sed s#%s%s/##g | (cd '%s' ; cpio -pd0mL --no-preserve-owner '%s%s')" % \ - (dvar, debugsrcdir, dvar, debugsrcdir, parentdir, dvar, debugsrcdir) - subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT) + for pmap in prefixmap: + # Ignore files from the recipe sysroots (target and native) + cmd = "LC_ALL=C ; sort -z -u '%s' | egrep -v -z '((|)$|/.*recipe-sysroot.*/)' | " % sourcefile + # We need to ignore files that are not actually ours + # we do this by only paying attention to items from this package + cmd += "fgrep -zw '%s' | " % prefixmap[pmap] + # Remove prefix in the source paths + cmd += "sed 's#%s/##g' | " % (prefixmap[pmap]) + cmd += "(cd '%s' ; cpio -pd0mlL --no-preserve-owner '%s%s' 2>/dev/null)" % (pmap, dvar, prefixmap[pmap]) + try: + subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT) + except subprocess.CalledProcessError: + # Can "fail" if internal headers/transient sources are attempted + pass + # cpio seems to have a bug with -lL together and symbolic links are just copied, not dereferenced. + # Work around this by manually finding and copying any symbolic links that made it through. + cmd = "find %s%s -type l -print0 -delete | sed s#%s%s/##g | (cd '%s' ; cpio -pd0mL --no-preserve-owner '%s%s')" % \ + (dvar, prefixmap[pmap], dvar, prefixmap[pmap], pmap, dvar, prefixmap[pmap]) + subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT) # debugsources.list may be polluted from the host if we used externalsrc, # cpio uses copy-pass and may have just created a directory structure From patchwork Tue Aug 16 20:57:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Purdie X-Patchwork-Id: 11467 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9A0BCC32772 for ; Tue, 16 Aug 2022 20:57:50 +0000 (UTC) Received: from mail-wr1-f50.google.com (mail-wr1-f50.google.com [209.85.221.50]) by mx.groups.io with SMTP id smtpd.web09.21297.1660683469680583253 for ; Tue, 16 Aug 2022 13:57:50 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@linuxfoundation.org header.s=google header.b=WMSvyn7q; spf=pass (domain: linuxfoundation.org, ip: 209.85.221.50, mailfrom: richard.purdie@linuxfoundation.org) Received: by mail-wr1-f50.google.com with SMTP id z16so13974887wrh.12 for ; Tue, 16 Aug 2022 13:57:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc; bh=51CrrLWdwFrBSdjUad5sLuuahz7vZLsIyPTzQ+N5J7M=; b=WMSvyn7qYKsyJOwKUG78GK2rMJSRgaOOO52f65Sqh7rIyzjUZeiZS3UH6uvc91b99Q j+g/5jVkOvRNjMEsjb280IyiEo89iouEvEvRllb07Z04ymIcxNr+eAtZMN1czSDgd3F9 kviQ5Hjn0qjtfUfK+Ag+7XqF6NdS1U2Op+jdQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc; bh=51CrrLWdwFrBSdjUad5sLuuahz7vZLsIyPTzQ+N5J7M=; b=RCNxGyw7eg0QIgyvuvrOsurlFwwJjKn7CWaMOD1azCgvUpRa3x1rDZu+ohztYJq843 atmiPYSidxT0PnVXJW2ZgBURqHuPfRcFPZHmQkMb4kWq02WlpwkSeVJjd3b4ijVsKut1 6+1wbOl0rOnwfApuJB7NpVCGDNIcvIF80+wJmFVnHDn4sytn0gCVeS6NpOQUynOBfFsx mF/J6YmZszhYbJRIpt6igMqeA5JiRGhODWpPMA2B+EzeoPFXUFGqA+//YobQujdNMG09 3tr8zJiEv/MebxeoBvA1xQqtjYgwnC7oi6n/IfH8VtZN3HiUBfmvBAgpI6zI+jml/d+6 uuyA== X-Gm-Message-State: ACgBeo3UTFJ7DWKdmmRx6eTRzs3jf/5OS1EZX2Vzw2ILGWkiRUEDDYV4 ZdQrEpb+dZuJLLVEc8g66FP75duBzQhcpw== X-Google-Smtp-Source: AA6agR5EOg4nxczajyMJqdS99VVHwoer1ei4Fz6y7X+Pg/YAsL3Ud5I5NkGREwCxedCkhPWEGkKP5w== X-Received: by 2002:a05:6000:71e:b0:223:764f:b2a8 with SMTP id bs30-20020a056000071e00b00223764fb2a8mr12872714wrb.79.1660683467918; Tue, 16 Aug 2022 13:57:47 -0700 (PDT) Received: from max.int.rpsys.net ([2001:8b0:aba:5f3c:3694:2ef4:2932:37d5]) by smtp.gmail.com with ESMTPSA id m18-20020adffa12000000b002250f9abdefsm5349460wrr.117.2022.08.16.13.57.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Aug 2022 13:57:47 -0700 (PDT) From: Richard Purdie To: openembedded-core@lists.openembedded.org Subject: [PATCH 2/8] libgcc/gcc-runtime: Improve source reference handling Date: Tue, 16 Aug 2022 21:57:40 +0100 Message-Id: <20220816205746.1672987-2-richard.purdie@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220816205746.1672987-1-richard.purdie@linuxfoundation.org> References: <20220816205746.1672987-1-richard.purdie@linuxfoundation.org> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Tue, 16 Aug 2022 20:57:50 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/169456 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 --- meta/recipes-devtools/gcc/gcc-runtime.inc | 22 ++++++++++----------- meta/recipes-devtools/gcc/libgcc-common.inc | 11 +++++++++-- 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 b8bfdcedadf..35a3077a4a7 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" # 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} \ " @@ -77,8 +76,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 cf8d6b7ed6e..e8139263132 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}" From patchwork Tue Aug 16 20:57:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Purdie X-Patchwork-Id: 11469 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8039FC25B0E for ; Tue, 16 Aug 2022 20:58:00 +0000 (UTC) Received: from mail-wr1-f52.google.com (mail-wr1-f52.google.com [209.85.221.52]) by mx.groups.io with SMTP id smtpd.web11.20968.1660683470621077407 for ; Tue, 16 Aug 2022 13:57:51 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@linuxfoundation.org header.s=google header.b=R7BRHhmI; spf=pass (domain: linuxfoundation.org, ip: 209.85.221.52, mailfrom: richard.purdie@linuxfoundation.org) Received: by mail-wr1-f52.google.com with SMTP id j7so14019889wrh.3 for ; Tue, 16 Aug 2022 13:57:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc; bh=2nZBEjSLiiiqUvn5aUmkTeb1qxqzSzmPC21vyQyeQF4=; b=R7BRHhmI/WydiGkHPFxloi2hdO6VsVayGrW661rifdkUuMZTJ3NVlMOhFTWrWubl7j BmC+Rbl22hoGlunEXPBsuB7W23ANH2UqnNxD1fV6GtIvz2Dl2TKW4KsrhU7rjLkoWjmz nHVON9LWzNoRebTBHr75zMvdFLBUD6xc3i39g= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc; bh=2nZBEjSLiiiqUvn5aUmkTeb1qxqzSzmPC21vyQyeQF4=; b=FgcS0QxrjntrMWzxEchgZcEgxAQCji7o0kShmbrxdgQqckXFNAVi3DvdnkZ3edAEdx 4kHd6mYtobCWGH7EQGkh4qIj2KTMcKs9FfNfd1BpGAVkcCUQh23D2Z9VSxwDmCUsL0GJ nXNX7Oxf97SwjfVI2iNfbePwRmZmhJiJf3uGJBKvoBlbOKsPv1UyCHQ3w0+Uft+uwMfE PiMfzWqtIcn4Xw1QkVS7jWHrU2tvJXCKzAbaP6fQSgEXADB/1naatRWlvDf/YQo4E/uN Of29zE7mCvVCcGtetm5OrpccYd4Cs1N+vkgpQi2nYzWwh6UQL6Ta/akAqIpeeu/0Ox3B 4g3A== X-Gm-Message-State: ACgBeo2asmHzjqyAqDyXb68QqNUJ6Ochmn2a5MSZApO3gLxYzW4FN8Bl 1JSi7pbjOa/FY4jvLvV2hLkU+CdtHpiAiw== X-Google-Smtp-Source: AA6agR63uBckdUXTZ+qwsGV2p5Qfot/Cu1qlbqTDlhmaCxYEn2DMA4Xp28GJOPVEJgxZjlXtoI9zQQ== X-Received: by 2002:a5d:64eb:0:b0:220:6bf8:70b6 with SMTP id g11-20020a5d64eb000000b002206bf870b6mr12554655wri.235.1660683468803; Tue, 16 Aug 2022 13:57:48 -0700 (PDT) Received: from max.int.rpsys.net ([2001:8b0:aba:5f3c:3694:2ef4:2932:37d5]) by smtp.gmail.com with ESMTPSA id m18-20020adffa12000000b002250f9abdefsm5349460wrr.117.2022.08.16.13.57.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Aug 2022 13:57:48 -0700 (PDT) From: Richard Purdie To: openembedded-core@lists.openembedded.org Subject: [PATCH 3/8] bitbake.conf: Handle S and B separately for debug mapping Date: Tue, 16 Aug 2022 21:57:41 +0100 Message-Id: <20220816205746.1672987-3-richard.purdie@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220816205746.1672987-1-richard.purdie@linuxfoundation.org> References: <20220816205746.1672987-1-richard.purdie@linuxfoundation.org> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Tue, 16 Aug 2022 20:58:00 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/169457 We don't really need to keep S and B separate for debug source purposes and there shouldn't be source references in WORKDIR that isn't S and B either. Separating these out simplifies the shared-work directory handling for gcc and should also help fix external source usage. Therefore handle S and B in DEBUG_PREFIX_MAP separately and clean up other code. Indentation is reduced here as it is introduced on every compiler commandline so minimising it is helpful. Signed-off-by: Richard Purdie --- meta/conf/bitbake.conf | 11 +++++++---- meta/recipes-devtools/gcc/gcc-runtime.inc | 13 ------------- meta/recipes-devtools/gcc/libgcc-common.inc | 8 -------- 3 files changed, 7 insertions(+), 25 deletions(-) diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf index bdfb6784371..dd2df8a5520 100644 --- a/meta/conf/bitbake.conf +++ b/meta/conf/bitbake.conf @@ -645,10 +645,13 @@ EXTRA_OEMAKE:prepend:task-install = "${PARALLEL_MAKEINST} " # Optimization flags. ################################################################## # Beware: applied last to first -DEBUG_PREFIX_MAP ?= "-fmacro-prefix-map=${WORKDIR}=/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR} \ - -fdebug-prefix-map=${WORKDIR}=/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR} \ - -fdebug-prefix-map=${STAGING_DIR_HOST}= \ - -fdebug-prefix-map=${STAGING_DIR_NATIVE}= \ +DEBUG_PREFIX_MAP ?= "-fmacro-prefix-map=${S}=/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR} \ + -fdebug-prefix-map=${S}=/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR} \ + -fmacro-prefix-map=${B}=/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR} \ + -fdebug-prefix-map=${B}=/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR} \ + -fdebug-prefix-map=${STAGING_DIR_HOST}= \ + -fmacro-prefix-map=${STAGING_DIR_HOST}= \ + -fdebug-prefix-map=${STAGING_DIR_NATIVE}= \ " DEBUG_FLAGS ?= "-g -feliminate-unused-debug-types ${DEBUG_PREFIX_MAP}" diff --git a/meta/recipes-devtools/gcc/gcc-runtime.inc b/meta/recipes-devtools/gcc/gcc-runtime.inc index 35a3077a4a7..fa5b048dab7 100644 --- a/meta/recipes-devtools/gcc/gcc-runtime.inc +++ b/meta/recipes-devtools/gcc/gcc-runtime.inc @@ -50,19 +50,6 @@ RUNTIMETARGET:libc-newlib = "libstdc++-v3" # libiberty # libgfortran needs separate recipe due to libquadmath dependency -# Relative path to be repaced into debug info -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} \ - " - do_configure () { export CXX="${CXX} -nostdinc++ -L${WORKDIR}/dummylib" # libstdc++ isn't built yet so CXX would error not able to find it which breaks stdc++'s configure diff --git a/meta/recipes-devtools/gcc/libgcc-common.inc b/meta/recipes-devtools/gcc/libgcc-common.inc index e8139263132..d9084af51ad 100644 --- a/meta/recipes-devtools/gcc/libgcc-common.inc +++ b/meta/recipes-devtools/gcc/libgcc-common.inc @@ -4,14 +4,6 @@ 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} From patchwork Tue Aug 16 20:57:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Purdie X-Patchwork-Id: 11470 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9C98EC32792 for ; Tue, 16 Aug 2022 20:58:00 +0000 (UTC) Received: from mail-wr1-f53.google.com (mail-wr1-f53.google.com [209.85.221.53]) by mx.groups.io with SMTP id smtpd.web08.21184.1660683471657513325 for ; Tue, 16 Aug 2022 13:57:52 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@linuxfoundation.org header.s=google header.b=DVSuT/qz; spf=pass (domain: linuxfoundation.org, ip: 209.85.221.53, mailfrom: richard.purdie@linuxfoundation.org) Received: by mail-wr1-f53.google.com with SMTP id z12so13995082wrs.9 for ; Tue, 16 Aug 2022 13:57:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc; bh=62Biv7q/8xuopHUqthRHNrgDp0uX57HhkFHvz1b8HNI=; b=DVSuT/qzXZWJrrEnJNTmZR+/gFHPYwJulXtNMifsUY5O4YXwlUh5YnQ3TwAwkrcOyR oftAVL5BQuo7gwY8MSUwjLPyTX2m5wqIaKzYLAnGfonLnJSAAgo70XlFWBHYeHMPrTCN FIQoYXqN5GwE1ZY4IJjq9d1mCg8t0y9Gj8NEI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc; bh=62Biv7q/8xuopHUqthRHNrgDp0uX57HhkFHvz1b8HNI=; b=Vg7LqgHd+818yvnhU1769aX1NgCykqVKxDshnFfEcUPkIsMHQ2nuIBS1AMJ6KZjhHu TGnmh83BNh2WRHG2rVhe/JFjoOmhHQ0QlcV8Ddi5STv5gEMdCVjnAOUFUzq2ne0exNJk SixU09og7K9RzI9yZp3mnd6sZ0kfad5HJbZX19oZclUpCAhm+z3g4zgz1VJjXH/6kq6G fXjV+Qky/ThYIGWUd631d1jDhvH3v/+6u0ajZ15QULz4PGywA8j6FXUd25sCW7qL+HM+ ykua9AK3oBh6S/12LhFMzIlZMha2CI+AZ/kL3uyhPMhjD1HKzM1CD+DgjcZn9pBps1PZ ArXA== X-Gm-Message-State: ACgBeo1gJA4czyKOnW6pq8SfMt+U6r2Z8PQMhRNiRDvr1hSOIMzwcKdP 4BJWsTYEuclDm3BtJwcVHQIIwjhNBx7CTg== X-Google-Smtp-Source: AA6agR6wHBaEhnVJjoome6on+7AIfAPVTwwqCIowHchutLMmmbxbzx+NHN0XSateEvD0IMZRU7xVsw== X-Received: by 2002:a5d:6c65:0:b0:221:d33f:f1db with SMTP id r5-20020a5d6c65000000b00221d33ff1dbmr12657743wrz.553.1660683469704; Tue, 16 Aug 2022 13:57:49 -0700 (PDT) Received: from max.int.rpsys.net ([2001:8b0:aba:5f3c:3694:2ef4:2932:37d5]) by smtp.gmail.com with ESMTPSA id m18-20020adffa12000000b002250f9abdefsm5349460wrr.117.2022.08.16.13.57.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Aug 2022 13:57:49 -0700 (PDT) From: Richard Purdie To: openembedded-core@lists.openembedded.org Subject: [PATCH 4/8] python3-cython: Update code to match debug path changes Date: Tue, 16 Aug 2022 21:57:42 +0100 Message-Id: <20220816205746.1672987-4-richard.purdie@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220816205746.1672987-1-richard.purdie@linuxfoundation.org> References: <20220816205746.1672987-1-richard.purdie@linuxfoundation.org> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Tue, 16 Aug 2022 20:58:00 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/169458 Match the changes to debug prefixes in bitbake.conf. Signed-off-by: Richard Purdie --- .../python/python3-cython_0.29.32.bb | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/meta/recipes-devtools/python/python3-cython_0.29.32.bb b/meta/recipes-devtools/python/python3-cython_0.29.32.bb index 26333cb2718..28a1386310b 100644 --- a/meta/recipes-devtools/python/python3-cython_0.29.32.bb +++ b/meta/recipes-devtools/python/python3-cython_0.29.32.bb @@ -20,17 +20,19 @@ do_install:append() { PACKAGEBUILDPKGD += "cython_fix_sources" cython_fix_sources () { - for f in ${PKGD}/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}/Cython-${PV}/Cython/Compiler/FlowControl.c \ - ${PKGD}/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}/Cython-${PV}/Cython/Compiler/FusedNode.c \ - ${PKGD}/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}/Cython-${PV}/Cython/Compiler/Scanning.c \ - ${PKGD}/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}/Cython-${PV}/Cython/Compiler/Visitor.c \ - ${PKGD}/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}/Cython-${PV}/Cython/Plex/Actions.c \ - ${PKGD}/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}/Cython-${PV}/Cython/Plex/Scanners.c \ - ${PKGD}/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}/Cython-${PV}/Cython/Runtime/refnanny.c \ - ${PKGD}/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}/Cython-${PV}/Cython/Tempita/_tempita.c \ + for f in ${PKGD}/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}/Cython/Compiler/FlowControl.c \ + ${PKGD}/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}/Cython/Compiler/FusedNode.c \ + ${PKGD}/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}/Cython/Compiler/Scanning.c \ + ${PKGD}/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}/Cython/Compiler/Visitor.c \ + ${PKGD}/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}/Cython/Plex/Actions.c \ + ${PKGD}/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}/Cython/Plex/Scanners.c \ + ${PKGD}/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}/Cython/Runtime/refnanny.c \ + ${PKGD}/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}/Cython/Tempita/_tempita.c \ ${PKGD}${libdir}/${PYTHON_DIR}/site-packages/Cython*/SOURCES.txt; do + echo $f >> /tmp/rp5 if [ -e $f ]; then - sed -i -e 's#${WORKDIR}#/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}#g' $f + echo sed -i -e 's#${WORKDIR}/Cython-${PV}#/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}#g' >> /tmp/rp5 + sed -i -e 's#${WORKDIR}/Cython-${PV}#/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}#g' $f fi done } From patchwork Tue Aug 16 20:57:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Purdie X-Patchwork-Id: 11471 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8CF2DC32773 for ; Tue, 16 Aug 2022 20:58:00 +0000 (UTC) Received: from mail-wr1-f54.google.com (mail-wr1-f54.google.com [209.85.221.54]) by mx.groups.io with SMTP id smtpd.web10.20999.1660683472567690759 for ; Tue, 16 Aug 2022 13:57:52 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@linuxfoundation.org header.s=google header.b=JoryBqJC; spf=pass (domain: linuxfoundation.org, ip: 209.85.221.54, mailfrom: richard.purdie@linuxfoundation.org) Received: by mail-wr1-f54.google.com with SMTP id e27so9295010wra.11 for ; Tue, 16 Aug 2022 13:57:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc; bh=fiInH00GK9jkpm8Cx0VetHpuRkJgFr2ZgLQeb0pDF78=; b=JoryBqJCnvbbw4+yGyWb+AStskpEzxDNPZeXNjrat2tx5l/xCrSxiAjDD7UhAkSVXU rEBoHOGT6oakdo1S+5xNPrmdLo0UWoEcF0kP0GZwEGRw0B8aRWbW+JLYG++xjFijoqa8 FZoq3EFBkOtOPc4SkSZe7uX2lEz083o01IO6s= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc; bh=fiInH00GK9jkpm8Cx0VetHpuRkJgFr2ZgLQeb0pDF78=; b=vAq7dWZgzhPeGkuywIHlLSr0LlihZkf4GfiO9ijMORmEM+EwnpestKHUvBNlCvLYUr 8kcx1av0EOLCb75kG9IRyuSe5loZeGH0hQ/yCRPlF0NWPxFPzQ7+YwlTmGSouOaEI2pR ZLiI9RzjBvrv1A6ITtnESM4VNDG2gzZHvyPy+UfJA9V/YCee+fPHfSKSCncG/aEwRDKc B9c0FHnvMRu2NRHYcrrpVj4KZkXxslWW8/BkQzfWRqLykVzZXl5rSwgn99o9idvFLVi9 iOhiwSF2Up068dC+6hBPjgiv1PQ4sy4vPFyjSNNnSOP/0Ko5W1NQSrKBNx7C+ns9IOPx oNoA== X-Gm-Message-State: ACgBeo0lPJALBG7We/SNPQJuIcFMrjb6KHkgNKKSAPEkDaLYemg9g1th GV7GVf+JiSQIRmuJgQGBdhKVUGT+Ddm3sA== X-Google-Smtp-Source: AA6agR7x67cXZ9J67E4asUZmD7i6+17MgGd3i2FuVONAR/d9ao8tv9rAn2tCTNoJeonAQeX9JS3rWw== X-Received: by 2002:a05:6000:9:b0:225:17e1:788d with SMTP id h9-20020a056000000900b0022517e1788dmr2371292wrx.156.1660683470805; Tue, 16 Aug 2022 13:57:50 -0700 (PDT) Received: from max.int.rpsys.net ([2001:8b0:aba:5f3c:3694:2ef4:2932:37d5]) by smtp.gmail.com with ESMTPSA id m18-20020adffa12000000b002250f9abdefsm5349460wrr.117.2022.08.16.13.57.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Aug 2022 13:57:50 -0700 (PDT) From: Richard Purdie To: openembedded-core@lists.openembedded.org Subject: [PATCH 5/8] gcc-cross: Fix relative links Date: Tue, 16 Aug 2022 21:57:43 +0100 Message-Id: <20220816205746.1672987-5-richard.purdie@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220816205746.1672987-1-richard.purdie@linuxfoundation.org> References: <20220816205746.1672987-1-richard.purdie@linuxfoundation.org> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Tue, 16 Aug 2022 20:58:00 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/169459 Now that we're using absolute paths to run configure, there are absolute path symlinks within gcc's output. Use our script that fixes these so that the sstate objects work correctly. Signed-off-by: Richard Purdie --- meta/recipes-devtools/gcc/gcc-cross.inc | 1 + 1 file changed, 1 insertion(+) diff --git a/meta/recipes-devtools/gcc/gcc-cross.inc b/meta/recipes-devtools/gcc/gcc-cross.inc index 3ffa1f0c460..a540fb2434a 100644 --- a/meta/recipes-devtools/gcc/gcc-cross.inc +++ b/meta/recipes-devtools/gcc/gcc-cross.inc @@ -149,6 +149,7 @@ do_gcc_stash_builddir () { # Makefile does move-if-change which can end up with 'timestamp' as file contents so break links to those files rm $dest/gcc/include/*.h cp gcc/include/*.h $dest/gcc/include/ + sysroot-relativelinks.py $dest } addtask do_gcc_stash_builddir after do_compile before do_install SSTATETASKS += "do_gcc_stash_builddir" From patchwork Tue Aug 16 20:57:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Purdie X-Patchwork-Id: 11473 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 91484C32789 for ; Tue, 16 Aug 2022 20:58:00 +0000 (UTC) Received: from mail-wr1-f49.google.com (mail-wr1-f49.google.com [209.85.221.49]) by mx.groups.io with SMTP id smtpd.web12.21086.1660683473560717094 for ; Tue, 16 Aug 2022 13:57:53 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@linuxfoundation.org header.s=google header.b=MRVYDMrw; spf=pass (domain: linuxfoundation.org, ip: 209.85.221.49, mailfrom: richard.purdie@linuxfoundation.org) Received: by mail-wr1-f49.google.com with SMTP id ba1so3437110wrb.5 for ; Tue, 16 Aug 2022 13:57:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc; bh=yvlev//svyahMVmySplBImj64OBFTlWR6so0A/v7q6I=; b=MRVYDMrw6bPwq9KvoL3ibRmpepycvVYRQNgQZRnH3IPI8D7A4iJSNWJgeZrvEXXmlN hvcAd67kHQK9x1UIG7uz7/OCmSFznUf8D0JUXC0wZlEwuTa+qH5LbzHVS//Gl6sckVOL ZgAdX50Dv19G08Cgh/KviVcWK6cA40qwpJf9Q= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc; bh=yvlev//svyahMVmySplBImj64OBFTlWR6so0A/v7q6I=; b=ZBzwHTKmJ7zhEbHDUYPQcKKgONHmQ1o7U8TzCRB+MnQMasl2sXSscVNYCBiqxaLBG+ 749eIeKrnUPTHLZS6uak09YPAsF1htS+kGaYcm1cMQoxRZlxPT6N8NuTIcMZWwvWFrq/ 28d7s0O+Tm/+MJCwmQxzF2zVTriHjuPsvpb8ZGeWS/5zCezavw8CBZoLzNVAR87G1qyf OjeA9q5j4Xapw8FpuC5B5xoMPZUMXpYWpIZBIeCw7BVlmz5bLUZ5FLgbwpb0g+JUoqgP v0UGqPKMhu4HOV3OLW6KUPCxX1GJrQhHAudTBYp1cPfpEdpzNzyU6vH5wMWB5ONKsvKp GLRQ== X-Gm-Message-State: ACgBeo3CscKsGd9NQR074v5lFc/5GNnCuoHgBGw8PJLzjJgxkFuoRUPN r1aEE+iYLC9qlJ2W7jXqfgG52Oiyz+UHjg== X-Google-Smtp-Source: AA6agR4NMr5vqEFrPel7B45ZxFKnczZ8YPnezT02ZzelsA/s9iSm1eik3GGNU8ZiHzWLMcDbaE8MfQ== X-Received: by 2002:adf:fbc7:0:b0:220:6004:18ca with SMTP id d7-20020adffbc7000000b00220600418camr12301621wrs.632.1660683471643; Tue, 16 Aug 2022 13:57:51 -0700 (PDT) Received: from max.int.rpsys.net ([2001:8b0:aba:5f3c:3694:2ef4:2932:37d5]) by smtp.gmail.com with ESMTPSA id m18-20020adffa12000000b002250f9abdefsm5349460wrr.117.2022.08.16.13.57.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Aug 2022 13:57:51 -0700 (PDT) From: Richard Purdie To: openembedded-core@lists.openembedded.org Subject: [PATCH 6/8] gcc: Resolve relative prefix-map filenames Date: Tue, 16 Aug 2022 21:57:44 +0100 Message-Id: <20220816205746.1672987-6-richard.purdie@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220816205746.1672987-1-richard.purdie@linuxfoundation.org> References: <20220816205746.1672987-1-richard.purdie@linuxfoundation.org> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Tue, 16 Aug 2022 20:58:00 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/169460 Add a patch to gcc so that relative paths are handled by -fdebug-prefix-map and friends. In OE we use relative paths in autotools and removing that creates a lot of issues we'd have to fix. This alternative allows us to fix the paths within gcc and improve our debug file coverage (and SPDX manifests) accordingly. Signed-off-by: Richard Purdie --- meta/recipes-devtools/gcc/gcc-12.1.inc | 1 + .../gcc/gcc/prefix-map-realpath.patch | 62 +++++++++++++++++++ 2 files changed, 63 insertions(+) create mode 100644 meta/recipes-devtools/gcc/gcc/prefix-map-realpath.patch diff --git a/meta/recipes-devtools/gcc/gcc-12.1.inc b/meta/recipes-devtools/gcc/gcc-12.1.inc index 56678c78bef..c42fa3d72f0 100644 --- a/meta/recipes-devtools/gcc/gcc-12.1.inc +++ b/meta/recipes-devtools/gcc/gcc-12.1.inc @@ -65,6 +65,7 @@ SRC_URI = "${BASEURI} \ file://0025-Move-sched.h-include-ahead-of-user-headers.patch \ file://0026-rust-recursion-limit.patch \ file://0001-libsanitizer-cherry-pick-9cf13067cb5088626ba7-from-u.patch \ + file://prefix-map-realpath.patch \ " SRC_URI[sha256sum] = "62fd634889f31c02b64af2c468f064b47ad1ca78411c45abe6ac4b5f8dd19c7b" diff --git a/meta/recipes-devtools/gcc/gcc/prefix-map-realpath.patch b/meta/recipes-devtools/gcc/gcc/prefix-map-realpath.patch new file mode 100644 index 00000000000..3544f61a744 --- /dev/null +++ b/meta/recipes-devtools/gcc/gcc/prefix-map-realpath.patch @@ -0,0 +1,62 @@ +Relative paths don't work with -fdebug-prefix-map and friends. This +can lead to paths which the user wanted to be remapped being missed. +Setting -fdebug-prefix-map to work with a relative path isn't practical +either. + +Instead, call gcc's realpath function on the incomming path name before +comparing it with the remapping. This means other issues like symlinks +are also accounted for and leads to a more consistent remapping experience. + +Upstream-Status: Pending [need to see if gcc developers would accept this] +Signed-off-by: Richard Purdie + + +Index: gcc-12.1.0/gcc/file-prefix-map.cc +=================================================================== +--- gcc-12.1.0.orig/gcc/file-prefix-map.cc ++++ gcc-12.1.0/gcc/file-prefix-map.cc +@@ -70,19 +70,28 @@ remap_filename (file_prefix_map *maps, c + file_prefix_map *map; + char *s; + const char *name; ++ char *realname; + size_t name_len; + ++ if (lbasename (filename) == filename) ++ return filename; ++ ++ realname = lrealpath (filename); ++ + for (map = maps; map; map = map->next) +- if (filename_ncmp (filename, map->old_prefix, map->old_len) == 0) ++ if (filename_ncmp (realname, map->old_prefix, map->old_len) == 0) + break; +- if (!map) ++ if (!map) { ++ free (realname); + return filename; +- name = filename + map->old_len; ++ } ++ name = realname + map->old_len; + name_len = strlen (name) + 1; + + s = (char *) ggc_alloc_atomic (name_len + map->new_len); + memcpy (s, map->new_prefix, map->new_len); + memcpy (s + map->new_len, name, name_len); ++ free (realname); + return s; + } + +Index: gcc-12.1.0/libcpp/macro.cc +=================================================================== +--- gcc-12.1.0.orig/libcpp/macro.cc ++++ gcc-12.1.0/libcpp/macro.cc +@@ -563,7 +563,7 @@ _cpp_builtin_macro_text (cpp_reader *pfi + if (!name) + abort (); + } +- if (pfile->cb.remap_filename) ++ if (pfile->cb.remap_filename && !pfile->state.in_directive) + name = pfile->cb.remap_filename (name); + len = strlen (name); + buf = _cpp_unaligned_alloc (pfile, len * 2 + 3); From patchwork Tue Aug 16 20:57:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Purdie X-Patchwork-Id: 11468 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 833BDC32772 for ; Tue, 16 Aug 2022 20:58:00 +0000 (UTC) Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) by mx.groups.io with SMTP id smtpd.web10.21000.1660683474354520899 for ; Tue, 16 Aug 2022 13:57:54 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@linuxfoundation.org header.s=google header.b=iWJVjicA; spf=pass (domain: linuxfoundation.org, ip: 209.85.128.44, mailfrom: richard.purdie@linuxfoundation.org) Received: by mail-wm1-f44.google.com with SMTP id m17-20020a7bce11000000b003a5bedec07bso13514wmc.0 for ; Tue, 16 Aug 2022 13:57:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc; bh=rO49MPg+KGDXgc+oPFzuPt7aHnPYPXuQZ3mBbfNDZjU=; b=iWJVjicAm4FCceY1v1kZyuPFl7wvhI46PBUfq9ctXtzAkgXYl/Sx9uOHiWmKlHAUyD eGmo3nJgq6cdRU7yL7mdfGfFOHeG656OtdyLXSF4QmLTJKpqOMGT0QS36RrJy8he7DQb d82FzghtZuHywQ1E8E7Wpd8tfe2gxkUm+3EjE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc; bh=rO49MPg+KGDXgc+oPFzuPt7aHnPYPXuQZ3mBbfNDZjU=; b=JcnyXyW0vtXJB6RqNkqmXN3Izt1IQZEMdIU4dhHfZmM72urFEA22K+DbjE6mxu6qxa tujibc/AvAxqi8ybhz/UYMKXIEZdb8U5duzskugTBQADCEYgfDt/P9imRCgbdumvCqHg DKzCMkVgJJYWtHqZX+Toj60kN/DXyH9HsS3/3Ft/JmjD+sjpntTQl3qUwRcFSR0FdHpP auo5KZZpWGejq+PgOO6sjpALM4t3ItjtplMCf1rVosrCOBjohcpq+QmI8z8I3XuVZzGT AhYVSCt7aIFp3Wqz+S0iMsIGbVQtJE5WKFbZYtlZ/GAKBVQCUpl30DUBvsUjSQ7Z4fra qLZg== X-Gm-Message-State: ACgBeo0nBqgwc4QkTnUozWOUKHWwwrHhAyMjT+fS26r0KHo58G7+P6uy bM2af5YR7VgOr4sXzl5eDlxNiTzJmVV6HA== X-Google-Smtp-Source: AA6agR6k9oKMpcEemwH9s0oi7eY+ltMSXLoaSPjgwWUSmAi7raHIGl7EowrBJRSIBqPxyQPfPGw9xg== X-Received: by 2002:a05:600c:4e8a:b0:3a6:d89:aa24 with SMTP id f10-20020a05600c4e8a00b003a60d89aa24mr176235wmq.149.1660683472608; Tue, 16 Aug 2022 13:57:52 -0700 (PDT) Received: from max.int.rpsys.net ([2001:8b0:aba:5f3c:3694:2ef4:2932:37d5]) by smtp.gmail.com with ESMTPSA id m18-20020adffa12000000b002250f9abdefsm5349460wrr.117.2022.08.16.13.57.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Aug 2022 13:57:51 -0700 (PDT) From: Richard Purdie To: openembedded-core@lists.openembedded.org Subject: [PATCH 7/8] gcc: Add a patch to avoid hardcoded paths in libgcc on powerpc Date: Tue, 16 Aug 2022 21:57:45 +0100 Message-Id: <20220816205746.1672987-7-richard.purdie@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220816205746.1672987-1-richard.purdie@linuxfoundation.org> References: <20220816205746.1672987-1-richard.purdie@linuxfoundation.org> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Tue, 16 Aug 2022 20:58:00 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/169461 Tweak the powerpc code to just include filenames rather than full paths to avoid build reproducibility issues. Signed-off-by: Richard Purdie --- meta/recipes-devtools/gcc/gcc-12.1.inc | 1 + .../gcc/gcc/hardcoded-paths.patch | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 meta/recipes-devtools/gcc/gcc/hardcoded-paths.patch diff --git a/meta/recipes-devtools/gcc/gcc-12.1.inc b/meta/recipes-devtools/gcc/gcc-12.1.inc index c42fa3d72f0..488e0c95b18 100644 --- a/meta/recipes-devtools/gcc/gcc-12.1.inc +++ b/meta/recipes-devtools/gcc/gcc-12.1.inc @@ -66,6 +66,7 @@ SRC_URI = "${BASEURI} \ file://0026-rust-recursion-limit.patch \ file://0001-libsanitizer-cherry-pick-9cf13067cb5088626ba7-from-u.patch \ file://prefix-map-realpath.patch \ + file://hardcoded-paths.patch \ " SRC_URI[sha256sum] = "62fd634889f31c02b64af2c468f064b47ad1ca78411c45abe6ac4b5f8dd19c7b" diff --git a/meta/recipes-devtools/gcc/gcc/hardcoded-paths.patch b/meta/recipes-devtools/gcc/gcc/hardcoded-paths.patch new file mode 100644 index 00000000000..aa3d16f6000 --- /dev/null +++ b/meta/recipes-devtools/gcc/gcc/hardcoded-paths.patch @@ -0,0 +1,19 @@ +Avoid encoding build paths into sources used for floating point on powerpc. +(MACHINE=qemuppc bitbake libgcc). + +Upstream-Status: Pending +Signed-off-by: Richard Purdie + +Index: gcc-12.1.0/libgcc/config/rs6000/t-float128 +=================================================================== +--- gcc-12.1.0.orig/libgcc/config/rs6000/t-float128 ++++ gcc-12.1.0/libgcc/config/rs6000/t-float128 +@@ -103,7 +103,7 @@ $(ibm128_dec_objs) : INTERNAL_CFLAGS += + $(fp128_softfp_src) : $(srcdir)/soft-fp/$(subst -sw,,$(subst kf,tf,$@)) $(fp128_dep) + @src="$(srcdir)/soft-fp/$(subst -sw,,$(subst kf,tf,$@))"; \ + echo "Create $@"; \ +- (echo "/* file created from $$src */"; \ ++ (echo "/* file created from `basename $$src` */"; \ + echo; \ + sed -f $(fp128_sed) < $$src) > $@ + From patchwork Tue Aug 16 20:57:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Purdie X-Patchwork-Id: 11472 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 90932C2BB41 for ; Tue, 16 Aug 2022 20:58:00 +0000 (UTC) Received: from mail-wr1-f50.google.com (mail-wr1-f50.google.com [209.85.221.50]) by mx.groups.io with SMTP id smtpd.web08.21185.1660683475148208194 for ; Tue, 16 Aug 2022 13:57:55 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@linuxfoundation.org header.s=google header.b=fly3yhGR; spf=pass (domain: linuxfoundation.org, ip: 209.85.221.50, mailfrom: richard.purdie@linuxfoundation.org) Received: by mail-wr1-f50.google.com with SMTP id f8so314001wru.13 for ; Tue, 16 Aug 2022 13:57:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc; bh=qJiOnzf7X73bMCEUJrk5dBXahx7a7P17btU2xeyyMws=; b=fly3yhGRy+/ZX2FfUP2GKCYNP2NA/j4qyfR5MFcXmt6Xyv9csd8aMxujC67FcSaMXD QzZWtVTcXyvzKr9Da+YSSmc6oziNqSgEFHjJ6NCIvwHbWW29BSDByKSsipBDK9YNjkAZ NjD6aenAmakG3nYsNY7wwURLtdEf8cRJTCVeQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc; bh=qJiOnzf7X73bMCEUJrk5dBXahx7a7P17btU2xeyyMws=; b=uu56jxPVrTJxUJRD0wKtBkv3aD7oNMu9Dmc8B9tcEYaSInujAd+wGZnresQALJ9Dpj OAWaJSlwH+2OYHi4FtFHpuBvI/mAWtP0tkZthkfP5bJ8D57PYjLf/LBrk87WseeYRKHV VeA7TEmEgyE4iRz0gtJIK+G1aOxtMEz5FPpn2CupxzhUQGxuzM4gVQSkn82gC9Qhk/fW anywe+j/T7DOde+eJgO5txQG4anXozrai/iCooDB7+V7CmpVD7Z7eusZAhbKqfk7coiA KJ2Ic4EWQj8rC01Qt5p/R68XsZCLyBU1JDaGdPSimTsf7VaAMD25xDajkCQcfkjTN/KR b4fg== X-Gm-Message-State: ACgBeo1qHzhUKswnoKbOjPGggYmcFrTu3IGjrNNwHSjLX19Kva45RSLs i/7s3IifC/KxS6mm1sJr2wq+aUOdb67ntA== X-Google-Smtp-Source: AA6agR7S2OILZ8jIdICGyfo6BIBC4KBTilHjqNU2UsiGpBz/qxJ2dVfoWZnMO0GM3VgMsEfm/IghGQ== X-Received: by 2002:a5d:6348:0:b0:220:5edf:c3e8 with SMTP id b8-20020a5d6348000000b002205edfc3e8mr12507673wrw.255.1660683473455; Tue, 16 Aug 2022 13:57:53 -0700 (PDT) Received: from max.int.rpsys.net ([2001:8b0:aba:5f3c:3694:2ef4:2932:37d5]) by smtp.gmail.com with ESMTPSA id m18-20020adffa12000000b002250f9abdefsm5349460wrr.117.2022.08.16.13.57.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Aug 2022 13:57:52 -0700 (PDT) From: Richard Purdie To: openembedded-core@lists.openembedded.org Subject: [PATCH 8/8] skeleton/service: Ensure debug path handling works as intended Date: Tue, 16 Aug 2022 21:57:46 +0100 Message-Id: <20220816205746.1672987-8-richard.purdie@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220816205746.1672987-1-richard.purdie@linuxfoundation.org> References: <20220816205746.1672987-1-richard.purdie@linuxfoundation.org> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Tue, 16 Aug 2022 20:58:00 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/169462 DEBUG_PREFIX_MAP uses ${S} but that wasn't set correctly for this recipe meaning cwd during the build (WORKDIR) was encoded into the binary leading to buildpath warnings in debug symbols. Set S correctly to avoid this issue. Signed-off-by: Richard Purdie --- meta-skeleton/recipes-skeleton/service/service_0.1.bb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/meta-skeleton/recipes-skeleton/service/service_0.1.bb b/meta-skeleton/recipes-skeleton/service/service_0.1.bb index d1d8c5f3656..912f6b0f611 100644 --- a/meta-skeleton/recipes-skeleton/service/service_0.1.bb +++ b/meta-skeleton/recipes-skeleton/service/service_0.1.bb @@ -9,6 +9,8 @@ SRC_URI = "file://skeleton \ file://COPYRIGHT \ " +S = "${WORKDIR}" + do_compile () { ${CC} ${CFLAGS} ${LDFLAGS} ${WORKDIR}/skeleton_test.c -o ${WORKDIR}/skeleton-test }