Skip to content

Commit

Permalink
gcc: disable dynamicbase for compiler binaries.
Browse files Browse the repository at this point in the history
GCC's precompiled header mechanism is not compatible with ASLR, so GCC
itself needs dynamicbase to be disabled, but the runtime libraries would
still benefit from having it set, so only disable dynamicbase for GCC
itself.
  • Loading branch information
jeremyd2019 committed Sep 8, 2020
1 parent 8bbe8a8 commit 61713ee
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion mingw-w64-gcc/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,9 @@ build() {
_languages+=",objc,obj-c++"
fi

local _LDFLAGS_FOR_TARGET="$LDFLAGS"
LDFLAGS+=" -Wl,--disable-dynamicbase"

../${_sourcedir}/configure \
--prefix=${MINGW_PREFIX} \
--with-local-prefix=${MINGW_PREFIX}/local \
Expand Down Expand Up @@ -225,7 +228,7 @@ build() {
--with-bugurl="https://github.com/msys2/MINGW-packages/issues" \
--with-gnu-as --with-gnu-ld \
--with-boot-ldflags="${LDFLAGS} -static-libstdc++ -static-libgcc" \
LDFLAGS_FOR_TARGET="${LDFLAGS}" \
LDFLAGS_FOR_TARGET="${_LDFLAGS_FOR_TARGET}" \
${_conf}

# While we're debugging -fopenmp problems at least.
Expand Down

0 comments on commit 61713ee

Please sign in to comment.