Skip to content

Commit

Permalink
Better compilation for MacOS
Browse files Browse the repository at this point in the history
  • Loading branch information
sadko4u committed Nov 30, 2024
1 parent 156be4d commit ee99fe8
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions make/tools.mk
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ INSTALL ?= $(X_INSTALL_TOOL)
# Patch flags and tools for (cross) build
FLAG_RELRO := -Wl,-z,relro,-z,now
FLAG_STDLIB :=
FLAG_GC_SECTIONS := -Wl,--gc-sections
NOARCH_CFLAGS :=
NOARCH_CXXFLAGS :=
NOARCH_EXE_FLAGS :=
Expand All @@ -105,6 +106,9 @@ else ifeq ($(PLATFORM),Windows)
NOARCH_EXE_FLAGS += -static-libgcc -static-libstdc++
NOARCH_SO_FLAGS += -static-libgcc -static-libstdc++
NOARCH_LDFLAGS += -T $(CURDIR)/make/ld-windows.script
else ifeq ($(PLATFORM),MacOS)
FLAG_RELRO =
FLAG_GC_SECTIONS =
else ifeq ($(PLATFORM),BSD)
NOARCH_EXE_FLAGS += -L/usr/local/lib
NOARCH_SO_FLAGS += -L/usr/local/lib
Expand Down Expand Up @@ -194,11 +198,11 @@ NOARCH_LDFLAGS += -r
LDFLAGS := $(ARCHITECTURE_LDFLAGS) $(NOARCH_LDFLAGS)
HOST_LDFLAGS := $(HOST_ARCHITECTURE_LDFLAGS) $(NOARCH_LDFLAGS)

NOARCH_EXE_FLAGS += $(FLAG_RELRO) -Wl,--gc-sections
NOARCH_EXE_FLAGS += $(FLAG_RELRO) $(FLAG_GC_SECTIONS)
EXE_FLAGS := $(ARCHITECTURE_CFLAGS) $(NOARCH_EXE_FLAGS)
HOST_EXE_FLAGS := $(HOST_ARCHITECTURE_CFLAGS) $(NOARCH_EXE_FLAGS)

NOARCH_SO_FLAGS += $(FLAG_RELRO) -Wl,--gc-sections -shared $(FLAG_STDLIB) -fPIC
NOARCH_SO_FLAGS += $(FLAG_RELRO) $(FLAG_GC_SECTIONS) -shared $(FLAG_STDLIB) -fPIC
SO_FLAGS := $(ARCHITECTURE_CFLAGS) $(NOARCH_SO_FLAGS)
HOST_SO_FLAGS := $(HOST_ARCHITECTURE_CFLAGS) $(NOARCH_SO_FLAGS)

Expand Down

0 comments on commit ee99fe8

Please sign in to comment.