Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable full RELRO on linux #53528

Merged
merged 2 commits into from
Jun 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion Make.inc
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,17 @@ export MACOSX_DEPLOYMENT_TARGET=$(MACOSX_VERSION_MIN)
endif
endif

JLDFLAGS :=
# Conditional setting of RELRO flag for enhanced security on Linux builds.
# RELRO (Read-Only Relocations) is a security feature that marks certain sections
# of the binary as read-only to prevent exploitation techniques like
# GOT (Global Offset Table) overwriting attacks.
ifeq ($(OS),Linux)
RELRO_FLAG := -Wl,-z,relro
else
RELRO_FLAG :=
endif

JLDFLAGS := $(RELRO_FLAG)

ifeq ($(USECCACHE), 1)
# Expand CC, CXX and FC here already because we want the original definition and not the ccache version.
Expand Down