Auto merge of #3371 - kozyilmaz:clang, r=str4d

Add -Wl,-pie linker option for macOS and use it instead of -pie

fixes linker error (see below) due to "-pie" usage, replaced it with "-Wl,-pie" for macOS platform
```
clang: error: argument unused during compilation: '-pie' [-Werror,-Wunused-command-line-argument]
```
This commit is contained in:
Homu 2018-07-17 21:41:36 -07:00
commit cc9cddbf49
1 changed files with 5 additions and 1 deletions

View File

@ -495,7 +495,11 @@ if test x$use_hardening != xno; then
if test x$TARGET_OS != xwindows; then
# All windows code is PIC, forcing it on just adds useless compile warnings
AX_CHECK_COMPILE_FLAG([-fPIE],[PIE_FLAGS="-fPIE"],[AC_MSG_ERROR(Cannot enable -fPIE)])
AX_CHECK_LINK_FLAG([[-pie]], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -pie"],[AC_MSG_ERROR(Cannot enable -pie)])
if test x$BUILD_OS = xdarwin; then
AX_CHECK_LINK_FLAG([[-Wl,-pie]], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,-pie"],[AC_MSG_ERROR(Cannot enable -Wl,-pie)])
else
AX_CHECK_LINK_FLAG([[-pie]], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -pie"],[AC_MSG_ERROR(Cannot enable -pie)])
fi
else
# These are only available on Windows.
AX_CHECK_LINK_FLAG([[-Wl,--dynamicbase]], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,--dynamicbase"],[AC_MSG_ERROR(Cannot enable --dynamicbase)])