!UNVBThoJtlIiVwiDjU:nixos.org

Staging

294 Members
Staging merges | Find currently open staging-next PRs: https://github.com/NixOS/nixpkgs/pulls?q=is%3Apr+sort%3Aupdated-desc+head%3Astaging-next+head%3Astaging-next-21.05+is%3Aopen102 Servers

Load older messages


SenderMessageTime
13 Sep 2025
@emilazy:matrix.orgemilywe now have like four PRs with toml11 4 in them so that's fun17:51:54
@emilazy:matrix.orgemilyI left a comment17:52:03
@aloisw:julia0815.dealoisw IIRC several packages tamper with their ldflags in various phases (yuck) so that breaks. Refactoring those could work but I don't know for sure. 17:52:26
@aloisw:julia0815.dealoisw Yeah sorry for that, that was my fault. I underestimated the urgency of toml11 4 and overestimated the difficutly of fixing nix and lix. 17:53:13
@emilazy:matrix.orgemilyit's understandable!17:54:11
@emilazy:matrix.orgemily I was thinking we could append ldflags to GOFLAGS in preBuild or something. 17:54:30
@aloisw:julia0815.dealoisw Most usages indeed seem to be in preBuild. I don't remember if these packages already ran Go code in configurePhase but probably not. 17:56:40
@emilazy:matrix.orgemily not sure what the point of a separate ldflags even is tbh 17:57:52
@aloisw:julia0815.dealoisw probably so that packages can do exactly that shit 17:59:13
@emilazy:matrix.orgemily they could do it with GOFLAGS! 18:00:46
@aloisw:julia0815.dealoisw Actually not quite: https://github.com/NixOS/nixpkgs/commit/155ae682a5122960aed61724b4ed8c9711b53e99 18:02:10
@aloisw:julia0815.dealoisw That also explains why GOFLAGS doesn't work (short version: you can't specify -ldflags twice). 18:02:37
@emilazy:matrix.orgemilyI see18:12:56
@emilazy:matrix.orgemily I guess it's also "wrong" to use the ldflags for sub-builds in some cases 18:13:57
@emilazy:matrix.orgemily because people do, like, "-X main.Version=${version}" 18:14:14
@emilazy:matrix.orgemily and that could be any main 18:14:17
@emilazy:matrix.orgemily🤔18:15:04
@emilazy:matrix.orgemily
	GO_EXTLINK_ENABLED
		Whether the linker should use external linking mode
		when using -linkmode=auto with code that uses cgo.
		Set to 0 to disable external linking mode, 1 to enable it.
18:15:10
@emilazy:matrix.orgemily does CGO_ENABLED count as "using cgo" even if the code itself doesn't "use cgo"? 18:15:23
@emilazy:matrix.orgemily😮18:15:58
@emilazy:matrix.orgemily
		// The environment variable GO_EXTLINK_ENABLED controls the
		// default value of -linkmode. If it is not set when the
		// linker is called we take the value it was set to when
		// cmd/link was compiled. (See make.bash.)
18:16:01
@emilazy:matrix.orgemilywe don't even need to inject a runtime environment variable18:16:05
@emilazy:matrix.orgemily
	iscgo = ctxt.LibraryByPkg["runtime/cgo"] != nil
18:17:09
@emilazy:matrix.orgemily I don't know Go well enough to determine whether this is going to be true always when CGO_ENABLED 18:17:19
@emilazy:matrix.orgemilyoh wait the docs lie!18:17:40
@emilazy:matrix.orgemily
	if ctxt.LinkMode == LinkExternal && !iscgo && !(buildcfg.GOOS == "darwin" && ctxt.BuildMode != BuildModePlugin && ctxt.Arch.Family == sys.AMD64) {
		// This indicates a user requested -linkmode=external.
		// The startup code uses an import of runtime/cgo to decide
		// whether to initialize the TLS.  So give it one. This could
		// be handled differently but it's an unusual case.
		if lib := loadinternal(ctxt, "runtime/cgo"); lib != nil && lib.Shlib == "" {
			if ctxt.BuildMode == BuildModeShared || ctxt.linkShared {
				Exitf("cannot implicitly include runtime/cgo in a shared library")
			}
			for ; i < len(ctxt.Library); i++ {
				lib := ctxt.Library[i]
				if lib.Shlib == "" {
					loadobjfile(ctxt, lib)
				}
			}
		}
	}
18:17:48
@emilazy:matrix.orgemily it applies even when !iscgo 18:17:52
@aloisw:julia0815.dealoisw Cool, so just setting GO_EXTLINK_ENABLED is enough and we don't need any of the other shit? 18:21:42
@emilazy:matrix.orgemily Lun: proposal: set GO_EXTLINK_ENABLED = true; for the build of Go itself when !ppc64. patch https://github.com/golang/go/blob/ac803b5949f6dbc5bfa559afe506d35f9e1b3195/src/cmd/link/internal/ld/config.go#L35-L41 to replace the conditional with "ppc64/linux" no, everything else yes (because https://github.com/golang/go/blob/master/src/cmd/link/internal/ld/config.go#L223C8-L223C62) 18:21:58
@emilazy:matrix.orgemilywe still need to ensure PIE is the default but they already have a conditional for that18:22:06

Show newer messages


Back to Room ListRoom Version: 6