From d625eb9a178d7fc8cab34a0d6838fb80f203adf3 Mon Sep 17 00:00:00 2001 From: Ajay Gupta Date: Mon, 19 Aug 2024 12:34:59 -0400 Subject: [PATCH] Add linker flags for text section creation conditionally, based on the OS --- Makefile | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index e65cbb5..53eb67b 100644 --- a/Makefile +++ b/Makefile @@ -4,9 +4,15 @@ VERSION=1.2.0 release: build/bin/aws_signing_helper curdir=$(shell pwd) +uname=$(shell uname -s) +ifeq ($(uname),Darwin) + extra_ld_flags=-extldflags '-sectcreate __TEXT __info_plist $(curdir)/Info.plist' +else + extra_ld_flags= +endif build/bin/aws_signing_helper: - go build -buildmode=pie -ldflags "-X 'github.com/aws/rolesanywhere-credential-helper/cmd.Version=${VERSION}' -extldflags '-sectcreate __TEXT __info_plist $(curdir)/Info.plist' -linkmode=external -w -s" -trimpath -o build/bin/aws_signing_helper main.go + go build -buildmode=pie -ldflags "-X 'github.com/aws/rolesanywhere-credential-helper/cmd.Version=${VERSION}' $(extra_ld_flags) -linkmode=external -w -s" -trimpath -o build/bin/aws_signing_helper main.go .PHONY: clean clean: