Skip to content

Commit bb26c96

Browse files
fix: Add extldflags to linux builds (backport #3666) (#3667)
* fix: Add extldflags to linux builds (#3666) * Add extldflags to linux builds (cherry picked from commit b53ebdf) * Fix changelog --------- Co-authored-by: Eric Warehime <[email protected]>
1 parent 6de4714 commit bb26c96

File tree

3 files changed

+22
-2
lines changed

3 files changed

+22
-2
lines changed

.goreleaser.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ builds:
104104
ldflags:
105105
- -s -w
106106
- -linkmode=external
107-
- -extldflags "-Wl,-z,muldefs -static"
107+
- -extldflags "-Wl,-z,muldefs -static -z noexecstack"
108108
- -X main.commit={{.Commit}}
109109
- -X main.date={{ .CommitDate }}
110110
- -X github.com/cosmos/cosmos-sdk/version.Name=gaia

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,18 @@
22

33
## UNRELEASED
44

5+
## v23.0.1
6+
7+
*March 25, 2025*
8+
9+
### BUG FIXES
10+
- Add linker flags for noexec linux builds
11+
([\#3666](https://github.com/cosmos/gaia/pull/3666))
12+
13+
## v23.0.0
14+
15+
*March 14, 2025*
16+
517
### DEPENDENCIES
618

719
- Bump Go to 1.23 [\#3556](https://github.com/cosmos/gaia/pull/3556)

Makefile

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,15 +71,23 @@ ldflags = -X github.com/cosmos/cosmos-sdk/version.Name=gaia \
7171
-X "github.com/cosmos/cosmos-sdk/version.BuildTags=$(build_tags_comma_sep)" \
7272
-X github.com/cometbft/cometbft/version.TMCoreSemVer=$(TM_VERSION)
7373

74+
UNAME_S = $(shell uname -s)
75+
ifeq ($(UNAME_S),Linux)
76+
extldflags += -z noexecstack
77+
endif
7478
ifeq (cleveldb,$(findstring cleveldb,$(GAIA_BUILD_OPTIONS)))
7579
ldflags += -X github.com/cosmos/cosmos-sdk/types.DBBackend=cleveldb
7680
endif
7781
ifeq ($(LINK_STATICALLY),true)
78-
ldflags += -linkmode=external -extldflags "-Wl,-z,muldefs -static"
82+
extldflags += -Wl,-z,muldefs -static -z noexecstack
83+
ldflags += -linkmode=external
7984
endif
8085
ifeq (,$(findstring nostrip,$(GAIA_BUILD_OPTIONS)))
8186
ldflags += -w -s
8287
endif
88+
extldflags += $(EXTLDFLAGS)
89+
extldflags := $(strip $(extldflags))
90+
ldflags += -extldflags "$(extldflags)"
8391
ldflags += $(LDFLAGS)
8492
ldflags := $(strip $(ldflags))
8593

0 commit comments

Comments
 (0)