Skip to content

Commit

Permalink
[v16] build: Build mac arm64 binaries with -extldflags=-ld_classic (#…
Browse files Browse the repository at this point in the history
…42738)

Add the flag `-extldflags=-ld_classic` to the Go build command line when
building the teleport binaries. This is needed to get around a new issue
with the xcode linker on macOS when building enterprise `build/teleport`
emitting the error:

    ld: B/BL out of range -153903124 (max +/-128MB) to '_runtime.memequal'

This change has not been added to the enterprise makefile as the vars
are propagated when we build enterprise from the OSS makefile.
  • Loading branch information
camscale authored Jun 11, 2024
1 parent 5913249 commit db10e0d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -246,10 +246,16 @@ endif

# Add -debugtramp=2 to work around 24 bit CALL/JMP instruction offset.
# Add "-extldflags -Wl,--long-plt" to avoid ld assertion failure on large binaries
GO_LDFLAGS += -extldflags -Wl,--long-plt -debugtramp=2
GO_LDFLAGS += -extldflags=-Wl,--long-plt -debugtramp=2
endif
endif # OS == linux

ifeq ("$(OS)-$(ARCH)","darwin-arm64")
# Temporary link flags due to changes in Apple's linker
# https://github.com/golang/go/issues/67854
GO_LDFLAGS += -extldflags=-ld_classic
endif

# Windows requires extra parameters to cross-compile with CGO.
ifeq ("$(OS)","windows")
ARCH ?= amd64
Expand Down

0 comments on commit db10e0d

Please sign in to comment.