From 9b4c1f15f55cad9118a5d56efe624c037243436e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miloslav=20Trma=C4=8D?= Date: Thu, 19 May 2022 21:54:07 +0200 Subject: [PATCH] Remove cgo_pthread_ordering_workaround.go MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Per https://bugzilla.redhat.com/show_bug.cgi?id=1326903 and https://sourceware.org/bugzilla/show_bug.cgi?id=19861#c9 , this was fixed in Glibc 2.24 . Removing this will also allow us not to worry about LDFLAGS necessary to make -lgpgme work. Signed-off-by: Miloslav Trmač --- cmd/skopeo/cgo_pthread_ordering_workaround.go | 35 ------------------- 1 file changed, 35 deletions(-) delete mode 100644 cmd/skopeo/cgo_pthread_ordering_workaround.go diff --git a/cmd/skopeo/cgo_pthread_ordering_workaround.go b/cmd/skopeo/cgo_pthread_ordering_workaround.go deleted file mode 100644 index c52aeb13..00000000 --- a/cmd/skopeo/cgo_pthread_ordering_workaround.go +++ /dev/null @@ -1,35 +0,0 @@ -//go:build !containers_image_openpgp -// +build !containers_image_openpgp - -package main - -/* -This is a pretty horrible workaround. Due to a glibc bug -https://bugzilla.redhat.com/show_bug.cgi?id=1326903 , we must ensure we link -with -lgpgme before -lpthread. Such arguments come from various packages -using cgo, and the ordering of these arguments is, with current (go tool link), -dependent on the order in which the cgo-using packages are found in a -breadth-first search following dependencies, starting from “main”. - -Thus, if - import "net" -is processed before - import "…/skopeo/signature" -it will, in the next level of the BFS, pull in "runtime/cgo" (a dependency of -"net") before "mtrmac/gpgme" (a dependency of "…/skopeo/signature"), causing --lpthread (used by "runtime/cgo") to be used before -lgpgme. - -This might be possible to work around by careful import ordering, or by removing -a direct dependency on "net", but that would be very fragile. - -So, until the above bug is fixed, add -lgpgme directly in the "main" package -to ensure the needed build order. - -Unfortunately, this workaround needs to be applied at the top level of any user -of "…/skopeo/signature"; it cannot be added to "…/skopeo/signature" itself, -by that time this package is first processed by the linker, a -lpthread may -already be queued and it would be too late. -*/ - -// #cgo LDFLAGS: -lgpgme -import "C"