public inbox for openembedded-core@lists.openembedded.org
 help / color / mirror / Atom feed
* [oe-core][PATCH] go.bbclass: remove macro prefix maps on CGO_LDFLAGS
@ 2026-01-27 17:03 rs
  0 siblings, 0 replies; only message in thread
From: rs @ 2026-01-27 17:03 UTC (permalink / raw)
  To: raj.khem, changqing.li, richard.purdie
  Cc: openembedded-core, bruce.ashfield, mathieu.dubois-briand

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



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-01-27 17:04 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-27 17:03 [oe-core][PATCH] go.bbclass: remove macro prefix maps on CGO_LDFLAGS rs

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox