go.bbclass: remove macro prefix maps on CGO_LDFLAGS
PATCH 1/1 go.bbclass: remove macro prefix maps on CGO_LDFLAGS
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
---
This also unblocks the previously posted emptty series.
meta/classes-recipe/go.bbclass | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
meta/classes-recipe/go.bbclass +5 -1
@@ -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/"
Signature · 1 line
2.52.0