Skip to content

Commit

Permalink
build: detect availability of -z now, relro and noexecstack linker op…
Browse files Browse the repository at this point in the history
…tions

Signed-off-by: Tomasz Kantecki <[email protected]>
  • Loading branch information
tkanteck committed Jan 3, 2024
1 parent 29d99fc commit 46e654d
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,21 @@ AS_IF([test "x$intel_cet_enabled" = "xyes"], [
AC_DEFINE(INTEL_CET_ENABLED, [1], [Intel CET enabled.])
])

# check if LD -z options are supported
LDFLAGS="\
-Wl,-z,noexecstack \
-Wl,-z,relro \
-Wl,-z,now \
"
AC_MSG_CHECKING([if $LD supports $LDFLAGS])
AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
int main(int argc, char **argv)
{
return 0;
}]])],
[AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no]) LDFLAGS=""]
)

# Pick an assembler yasm or nasm
if test x"$AS" = x""; then
Expand Down Expand Up @@ -290,13 +305,6 @@ my_CFLAGS="\
"
AC_SUBST([my_CFLAGS])

AM_LDFLAGS="\
-Wl,-z,noexecstack \
-Wl,-z,relro \
-Wl,-z,now \
"
AC_SUBST([AM_LDFLAGS])

AC_CONFIG_FILES([\
Makefile\
libisal.pc
Expand Down

0 comments on commit 46e654d

Please sign in to comment.