Skip to content

Commit 75af1c4

Browse files
tkanteckpablodelara
authored andcommitted
build: detect availability of -z now, relro and noexecstack linker options
Signed-off-by: Tomasz Kantecki <[email protected]>
1 parent 71575ae commit 75af1c4

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

configure.ac

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,22 @@ AS_IF([test "x$intel_cet_enabled" = "xyes"], [
7979
AC_DEFINE(INTEL_CET_ENABLED, [1], [Intel CET enabled.])
8080
])
8181

82+
# check if LD -z options are supported
83+
LDFLAGS="\
84+
-Wl,-z,noexecstack \
85+
-Wl,-z,relro \
86+
-Wl,-z,now \
87+
"
88+
AC_MSG_CHECKING([if $LD supports $LDFLAGS])
89+
AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
90+
int main(int argc, char **argv)
91+
{
92+
return 0;
93+
}]])],
94+
[AC_MSG_RESULT([yes])],
95+
[AC_MSG_RESULT([no])
96+
LDFLAGS=""]
97+
)
8298

8399
# Pick an assembler yasm or nasm
84100
if test x"$AS" = x""; then
@@ -290,13 +306,6 @@ my_CFLAGS="\
290306
"
291307
AC_SUBST([my_CFLAGS])
292308

293-
AM_LDFLAGS="\
294-
-Wl,-z,noexecstack \
295-
-Wl,-z,relro \
296-
-Wl,-z,now \
297-
"
298-
AC_SUBST([AM_LDFLAGS])
299-
300309
AC_CONFIG_FILES([\
301310
Makefile\
302311
libisal.pc

0 commit comments

Comments
 (0)