From: Randolph Sapp <[email protected]>

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 <[email protected]>
---

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

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#230059): 
https://lists.openembedded.org/g/openembedded-core/message/230059
Mute This Topic: https://lists.openembedded.org/mt/117492160/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to