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

Introduce NOTSHLIBLDFLAGS, used to link executables only #224

Merged
merged 1 commit into from Sep 27, 2016

Conversation

smcv
Copy link

@smcv smcv commented Sep 22, 2016

This can be used for LDFLAGS that would be inappropriate for shared
libraries, such as the "-fPIE -pie" used to link position-independent
executables. PIEs make it more difficult to exploit various classes
of security vulnerability.


We use this in Debian, where the dpkg build system defines some standard distribution-wide CPPFLAGS (including -D_FORTIFY_SOURCE), CFLAGS (including -fPIE -O2) and LDFLAGS (including -pie), by running make with these definitions:

CFLAGS='$(filter-out -fPIE -pie,$(CFLAGS)) $(CPPFLAGS)'
NOTSHLIBCFLAGS='$(filter -fPIE -pie,$(CFLAGS))'
LDFLAGS='$(filter-out -fPIE -pie,$(LDFLAGS))'
NOTSHLIBLDFLAGS='$(filter -fPIE -pie,$(LDFLAGS))'

This results in executables being compiled with -fPIE and linked with -pie, while shared libraries (loadable modules) are still compiled with -fPIC and linked with -shared as intended.

This can be used for LDFLAGS that would be inappropriate for shared
libraries, such as the "-fPIE -pie" used to link position-independent
executables. PIEs make it more difficult to exploit various classes
of security vulnerability.
@timangus timangus merged commit 5a33abe into ioquake:master Sep 27, 2016
@smcv smcv deleted the notshlib branch September 27, 2016 21:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants