mirror of
https://github.com/sudo-project/sudo.git
synced 2025-08-22 09:57:41 +00:00
Solaris: use lt_prog_compiler_pic instead of assuming -KPIC
This commit is contained in:
parent
e72d75d38e
commit
544c978217
54
configure
vendored
54
configure
vendored
@ -31718,49 +31718,16 @@ fi
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if test X"$enable_pie" != X"yes" -a X"$with_gnu_ld" = X"no"; then
|
if test X"$enable_pie" != X"no" -a X"$with_gnu_ld" = X"no"; then
|
||||||
# Solaris 11.1 and higher ld supports PIE executables, ASLR,
|
# Solaris 11.1 and higher ld supports PIE executables, ASLR,
|
||||||
# non-executable stack and non-executable heap.
|
# non-executable stack and non-executable heap.
|
||||||
case "$host_os" in
|
case "$host_os" in
|
||||||
solaris2.1[1-9]|solaris2.[2-9][0-9])
|
solaris2.1[1-9]|solaris2.[2-9][0-9])
|
||||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -KPIC" >&5
|
# This assumes lt_prog_compiler_pic is a single flag,
|
||||||
printf %s "checking whether C compiler accepts -KPIC... " >&6; }
|
# which is the case on Solaris.
|
||||||
if test ${ax_cv_check_cflags___KPIC+y}
|
if test -n "$lt_prog_compiler_pic"; then
|
||||||
then :
|
|
||||||
printf %s "(cached) " >&6
|
|
||||||
else case e in #(
|
|
||||||
e)
|
|
||||||
ax_check_save_flags=$CFLAGS
|
|
||||||
CFLAGS="$CFLAGS -KPIC"
|
|
||||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
|
||||||
/* end confdefs.h. */
|
|
||||||
|
|
||||||
int
|
|
||||||
main (void)
|
|
||||||
{
|
|
||||||
|
|
||||||
;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
_ACEOF
|
|
||||||
if ac_fn_c_try_compile "$LINENO"
|
|
||||||
then :
|
|
||||||
ax_cv_check_cflags___KPIC=yes
|
|
||||||
else case e in #(
|
|
||||||
e) ax_cv_check_cflags___KPIC=no ;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
|
|
||||||
CFLAGS=$ax_check_save_flags ;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags___KPIC" >&5
|
|
||||||
printf "%s\n" "$ax_cv_check_cflags___KPIC" >&6; }
|
|
||||||
if test "x$ax_cv_check_cflags___KPIC" = xyes
|
|
||||||
then :
|
|
||||||
|
|
||||||
_CFLAGS="$CFLAGS"
|
_CFLAGS="$CFLAGS"
|
||||||
CFLAGS="$CFLAGS -KPIC"
|
CFLAGS="$CFLAGS $lt_prog_compiler_pic"
|
||||||
_LDFLAGS="$LDFLAGS"
|
_LDFLAGS="$LDFLAGS"
|
||||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the linker accepts -Wl,-ztype=pie" >&5
|
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the linker accepts -Wl,-ztype=pie" >&5
|
||||||
printf %s "checking whether the linker accepts -Wl,-ztype=pie... " >&6; }
|
printf %s "checking whether the linker accepts -Wl,-ztype=pie... " >&6; }
|
||||||
@ -31843,8 +31810,8 @@ fi
|
|||||||
|
|
||||||
fi
|
fi
|
||||||
if test "$enable_pie" = "yes"; then
|
if test "$enable_pie" = "yes"; then
|
||||||
PIE_CFLAGS="-KPIC"
|
PIE_CFLAGS="$lt_prog_compiler_pic"
|
||||||
PIE_LDFLAGS="-Wc,-KPIC -Wl,-ztype=pie"
|
PIE_LDFLAGS="-Wc,$lt_prog_compiler_pic -Wl,-ztype=pie"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
else case e in #(
|
else case e in #(
|
||||||
@ -31854,12 +31821,7 @@ fi
|
|||||||
|
|
||||||
CFLAGS="$_CFLAGS"
|
CFLAGS="$_CFLAGS"
|
||||||
LDFLAGS="$_LDFLAGS"
|
LDFLAGS="$_LDFLAGS"
|
||||||
|
fi
|
||||||
else case e in #(
|
|
||||||
e) : ;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
|
|
||||||
# These flags are only valid when linking an executable
|
# These flags are only valid when linking an executable
|
||||||
# so we cannot add them to HARDENING_LDFLAGS.
|
# so we cannot add them to HARDENING_LDFLAGS.
|
||||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the linker accepts -Wl,-zaslr" >&5
|
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the linker accepts -Wl,-zaslr" >&5
|
||||||
|
14
m4/pie.m4
14
m4/pie.m4
@ -44,14 +44,16 @@ AC_DEFUN([SUDO_CHECK_PIE_SUPPORT], [
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if test X"$enable_pie" != X"yes" -a X"$with_gnu_ld" = X"no"; then
|
if test X"$enable_pie" != X"no" -a X"$with_gnu_ld" = X"no"; then
|
||||||
# Solaris 11.1 and higher ld supports PIE executables, ASLR,
|
# Solaris 11.1 and higher ld supports PIE executables, ASLR,
|
||||||
# non-executable stack and non-executable heap.
|
# non-executable stack and non-executable heap.
|
||||||
case "$host_os" in
|
case "$host_os" in
|
||||||
solaris2.1[[1-9]]|solaris2.[[2-9]][[0-9]])
|
solaris2.1[[1-9]]|solaris2.[[2-9]][[0-9]])
|
||||||
AX_CHECK_COMPILE_FLAG([-KPIC], [
|
# This assumes lt_prog_compiler_pic is a single flag,
|
||||||
|
# which is the case on Solaris.
|
||||||
|
if test -n "$lt_prog_compiler_pic"; then
|
||||||
_CFLAGS="$CFLAGS"
|
_CFLAGS="$CFLAGS"
|
||||||
CFLAGS="$CFLAGS -KPIC"
|
CFLAGS="$CFLAGS $lt_prog_compiler_pic"
|
||||||
_LDFLAGS="$LDFLAGS"
|
_LDFLAGS="$LDFLAGS"
|
||||||
AX_CHECK_LINK_FLAG([-Wl,-ztype=pie], [
|
AX_CHECK_LINK_FLAG([-Wl,-ztype=pie], [
|
||||||
# Try building PIE if not disabled.
|
# Try building PIE if not disabled.
|
||||||
@ -60,13 +62,13 @@ AC_DEFUN([SUDO_CHECK_PIE_SUPPORT], [
|
|||||||
SUDO_WORKING_PIE([enable_pie=yes], [])
|
SUDO_WORKING_PIE([enable_pie=yes], [])
|
||||||
fi
|
fi
|
||||||
if test "$enable_pie" = "yes"; then
|
if test "$enable_pie" = "yes"; then
|
||||||
PIE_CFLAGS="-KPIC"
|
PIE_CFLAGS="$lt_prog_compiler_pic"
|
||||||
PIE_LDFLAGS="-Wc,-KPIC -Wl,-ztype=pie"
|
PIE_LDFLAGS="-Wc,$lt_prog_compiler_pic -Wl,-ztype=pie"
|
||||||
fi
|
fi
|
||||||
])
|
])
|
||||||
CFLAGS="$_CFLAGS"
|
CFLAGS="$_CFLAGS"
|
||||||
LDFLAGS="$_LDFLAGS"
|
LDFLAGS="$_LDFLAGS"
|
||||||
])
|
fi
|
||||||
# These flags are only valid when linking an executable
|
# These flags are only valid when linking an executable
|
||||||
# so we cannot add them to HARDENING_LDFLAGS.
|
# so we cannot add them to HARDENING_LDFLAGS.
|
||||||
AX_CHECK_LINK_FLAG([-Wl,-zaslr], [
|
AX_CHECK_LINK_FLAG([-Wl,-zaslr], [
|
||||||
|
Loading…
x
Reference in New Issue
Block a user