public inbox for openembedded-core@lists.openembedded.org
 help / color / mirror / Atom feed
From: <rs@ti.com>
To: <raj.khem@gmail.com>, <changqing.li@windriver.com>,
	<richard.purdie@linuxfoundation.org>
Cc: <openembedded-core@lists.openembedded.org>,
	<bruce.ashfield@gmail.com>, <mathieu.dubois-briand@bootlin.com>
Subject: [oe-core][PATCH] go.bbclass: remove macro prefix maps on CGO_LDFLAGS
Date: Tue, 27 Jan 2026 11:03:45 -0600	[thread overview]
Message-ID: <20260127170344.2960247-2-rs@ti.com> (raw)

From: Randolph Sapp <rs@ti.com>

Due to GCC behavior with LTO, prefix maps must be passed as part of
LDFLAGS for binary reproducibility for some packages [1]. Unfortunately
passing build paths as arguments to CGO_LDFLAGS changes intermediary
output hashes (content IDs) during Go builds [2].

CGO binaries do not currently support LTO, so right now we can safely
remove these prefixes for anything using the go.bbclass. This will need
to be reevaluated when LTO is enabled for CGO [3].

[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101473
[2] https://github.com/golang/go/issues/77086
[3] https://github.com/golang/go/issues/43505

Signed-off-by: Randolph Sapp <rs@ti.com>
---

This also unblocks the previously posted emptty series.

 meta/classes-recipe/go.bbclass | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/meta/classes-recipe/go.bbclass b/meta/classes-recipe/go.bbclass
index b540471ba2..7dbd66c5ce 100644
--- a/meta/classes-recipe/go.bbclass
+++ b/meta/classes-recipe/go.bbclass
@@ -71,7 +71,11 @@ export CGO_ENABLED ?= "1"
 export CGO_CFLAGS ?= "${CFLAGS}"
 export CGO_CPPFLAGS ?= "${CPPFLAGS}"
 export CGO_CXXFLAGS ?= "${CXXFLAGS}"
-export CGO_LDFLAGS ?= "${LDFLAGS}"
+
+# remove build paths from LDFLAGS since this will change the content ID
+CGO_LDFLAGS ?= "${LDFLAGS}"
+CGO_LDFLAGS:remove = "${DEBUG_PREFIX_MAP}"
+export CGO_LDFLAGS
 
 GO_INSTALL ?= "${GO_IMPORT}/..."
 GO_INSTALL_FILTEROUT ?= "${GO_IMPORT}/vendor/"
-- 
2.52.0



                 reply	other threads:[~2026-01-27 17:04 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260127170344.2960247-2-rs@ti.com \
    --to=rs@ti.com \
    --cc=bruce.ashfield@gmail.com \
    --cc=changqing.li@windriver.com \
    --cc=mathieu.dubois-briand@bootlin.com \
    --cc=openembedded-core@lists.openembedded.org \
    --cc=raj.khem@gmail.com \
    --cc=richard.purdie@linuxfoundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox