Required to fix build with -buildmode=pie.

See: https://gitlab.alpinelinux.org/alpine/aports/-/issues/15809

diff -upr loki-2.9.10.orig/Makefile loki-2.9.10/Makefile
--- loki-2.9.10.orig/Makefile
+++ loki-2.9.10/Makefile
@@ -143,10 +143,10 @@
 	$(SUDO) docker build -t $(IMAGE_PREFIX)/logcli:$(IMAGE_TAG) -f cmd/logcli/Dockerfile .
 
 cmd/logcli/logcli:
-	CGO_ENABLED=0 go build $(GO_FLAGS) -o $@ ./cmd/logcli
+	go build $(GO_FLAGS) -o $@ ./cmd/logcli
 
 cmd/logcli/logcli-debug:
-	CGO_ENABLED=0 go build $(DEBUG_GO_FLAGS) -o ./cmd/logcli/logcli-debug ./cmd/logcli
+	go build $(DEBUG_GO_FLAGS) -o ./cmd/logcli/logcli-debug ./cmd/logcli
 ########
 # Loki #
 ########
@@ -155,10 +155,10 @@
 loki-debug: cmd/loki/loki-debug ## build loki debug executable
 
 cmd/loki/loki:
-	CGO_ENABLED=0 go build $(GO_FLAGS) -o $@ ./$(@D)
+	go build $(GO_FLAGS) -o $@ ./$(@D)
 
 cmd/loki/loki-debug:
-	CGO_ENABLED=0 go build $(DEBUG_GO_FLAGS) -o $@ ./$(@D)
+	go build $(DEBUG_GO_FLAGS) -o $@ ./$(@D)
 
 ###############
 # Loki-Canary #
@@ -167,7 +167,7 @@
 loki-canary: cmd/loki-canary/loki-canary ## build loki-canary executable
 
 cmd/loki-canary/loki-canary:
-	CGO_ENABLED=0 go build $(GO_FLAGS) -o $@ ./$(@D)
+	go build $(GO_FLAGS) -o $@ ./$(@D)
 
 
 ###############
@@ -186,7 +186,7 @@
 
 # Package Helm tests but do not run them.
 production/helm/loki/src/helm-test/helm-test:
-	CGO_ENABLED=0 go test $(GO_FLAGS) --tags=helm_test -c -o $@ ./$(@D)
+	go test $(GO_FLAGS) --tags=helm_test -c -o $@ ./$(@D)
 
 helm-lint: ## run helm linter
 	$(MAKE) -BC production/helm/loki lint
@@ -198,7 +198,7 @@
 loki-querytee: cmd/querytee/querytee ## build loki-querytee executable
 
 cmd/querytee/querytee:
-	CGO_ENABLED=0 go build $(GO_FLAGS) -o $@ ./$(@D)
+	go build $(GO_FLAGS) -o $@ ./$(@D)
 
 ############
 # Promtail #
@@ -274,7 +274,7 @@
 migrate: cmd/migrate/migrate
 
 cmd/migrate/migrate:
-	CGO_ENABLED=0 go build $(GO_FLAGS) -o $@ ./$(@D)
+	go build $(GO_FLAGS) -o $@ ./$(@D)
 
 #############
 # Releasing #
@@ -285,16 +285,16 @@
 SKIP_ARM ?= false
 dist: clean
 ifeq ($(SKIP_ARM),true)
-	CGO_ENABLED=0 $(GOX) -osarch="linux/amd64 darwin/amd64 windows/amd64 freebsd/amd64" ./cmd/loki
-	CGO_ENABLED=0 $(GOX) -osarch="linux/amd64 darwin/amd64 windows/amd64 freebsd/amd64" ./cmd/logcli
-	CGO_ENABLED=0 $(GOX) -osarch="linux/amd64 darwin/amd64 windows/amd64 freebsd/amd64" ./cmd/loki-canary
-	CGO_ENABLED=0 $(GOX) -osarch="darwin/amd64 windows/amd64 windows/386 freebsd/amd64" ./clients/cmd/promtail
+	$(GOX) -osarch="linux/amd64 darwin/amd64 windows/amd64 freebsd/amd64" ./cmd/loki
+	$(GOX) -osarch="linux/amd64 darwin/amd64 windows/amd64 freebsd/amd64" ./cmd/logcli
+	$(GOX) -osarch="linux/amd64 darwin/amd64 windows/amd64 freebsd/amd64" ./cmd/loki-canary
+	$(GOX) -osarch="darwin/amd64 windows/amd64 windows/386 freebsd/amd64" ./clients/cmd/promtail
 	CGO_ENABLED=1 $(CGO_GOX)  -tags promtail_journal_enabled  -osarch="linux/amd64" ./clients/cmd/promtail
 else
-	CGO_ENABLED=0 $(GOX) -osarch="linux/amd64 linux/arm64 linux/arm darwin/amd64 darwin/arm64 windows/amd64 freebsd/amd64" ./cmd/loki
-	CGO_ENABLED=0 $(GOX) -osarch="linux/amd64 linux/arm64 linux/arm darwin/amd64 darwin/arm64 windows/amd64 freebsd/amd64" ./cmd/logcli
-	CGO_ENABLED=0 $(GOX) -osarch="linux/amd64 linux/arm64 linux/arm darwin/amd64 darwin/arm64 windows/amd64 freebsd/amd64" ./cmd/loki-canary
-	CGO_ENABLED=0 $(GOX) -osarch="darwin/amd64 darwin/arm64 windows/amd64 windows/386 freebsd/amd64" ./clients/cmd/promtail
+	$(GOX) -osarch="linux/amd64 linux/arm64 linux/arm darwin/amd64 darwin/arm64 windows/amd64 freebsd/amd64" ./cmd/loki
+	$(GOX) -osarch="linux/amd64 linux/arm64 linux/arm darwin/amd64 darwin/arm64 windows/amd64 freebsd/amd64" ./cmd/logcli
+	$(GOX) -osarch="linux/amd64 linux/arm64 linux/arm darwin/amd64 darwin/arm64 windows/amd64 freebsd/amd64" ./cmd/loki-canary
+	$(GOX) -osarch="darwin/amd64 darwin/arm64 windows/amd64 windows/386 freebsd/amd64" ./clients/cmd/promtail
 	PKG_CONFIG_PATH="/usr/lib/aarch64-linux-gnu/pkgconfig" CC="aarch64-linux-gnu-gcc" $(CGO_GOX)  -tags promtail_journal_enabled  -osarch="linux/arm64" ./clients/cmd/promtail
 	PKG_CONFIG_PATH="/usr/lib/arm-linux-gnueabihf/pkgconfig" CC="arm-linux-gnueabihf-gcc" $(CGO_GOX)  -tags promtail_journal_enabled  -osarch="linux/arm" ./clients/cmd/promtail
 	CGO_ENABLED=1 $(CGO_GOX)  -tags promtail_journal_enabled  -osarch="linux/amd64" ./clients/cmd/promtail
@@ -458,7 +458,7 @@
 	docker plugin create $(LOKI_DOCKER_DRIVER):main$(PLUGIN_ARCH) clients/cmd/docker-driver
 
 clients/cmd/docker-driver/docker-driver:
-	CGO_ENABLED=0 go build $(GO_FLAGS) -o $@ ./$(@D)
+	go build $(GO_FLAGS) -o $@ ./$(@D)
 
 docker-driver-push: docker-driver
 ifndef DOCKER_PASSWORD
