summaryrefslogtreecommitdiff
path: root/package/sudo/0003-Preserve-LDFLAGS-when-checking-for-stack-protector.patch
blob: 6ba3bb37c4e17d7491c05d19cd57c996b0c96629 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
Preserve LDFLAGS when checking for stack protector as they may include
rpath settings to allow the stack protector lib to be found. Avoidusing
existing CFLAGS since we don't want the compiler to optimize away the
stack variable.

Backported from upstream:
  http://www.sudo.ws/repos/sudo/rev/e6bc59225c06

Signed-off-by: Vicente Olivert Riera <Vincent.Riera@imgtec.com>

# HG changeset patch
# User Todd C. Miller <Todd.Miller@courtesan.com>
# Date 1446149181 21600
# Node ID e6bc59225c06c5d45580197519a73e3feea14cbd
# Parent  4ade5d1249f483c4dd6c579c70b327791094afe8
Preserve LDFLAGS when checking for stack protector as they may include
rpath settings to allow the stack protector lib to be found.  Avoid
using existing CFLAGS since we don't want the compiler to optimize
away the stack variable.

diff -r 4ade5d1249f4 -r e6bc59225c06 configure
--- a/configure	Thu Oct 29 10:51:09 2015 -0600
+++ b/configure	Thu Oct 29 14:06:21 2015 -0600
@@ -23926,7 +23926,7 @@
 	    _CFLAGS="$CFLAGS"
 	    _LDFLAGS="$LDFLAGS"
 	    CFLAGS="-fstack-protector-strong"
-	    LDFLAGS="-fstack-protector-strong"
+	    LDFLAGS="$_LDFLAGS -fstack-protector-strong"
 	    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -23947,7 +23947,7 @@
 else
 
 		CFLAGS="-fstack-protector-all"
-		LDFLAGS="-fstack-protector-all"
+		LDFLAGS="$_LDFLAGS -fstack-protector-all"
 		cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -23968,7 +23968,7 @@
 else
 
 		    CFLAGS="-fstack-protector"
-		    LDFLAGS="-fstack-protector"
+		    LDFLAGS="$_LDFLAGS -fstack-protector"
 		    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
diff -r 4ade5d1249f4 -r e6bc59225c06 configure.ac
--- a/configure.ac	Thu Oct 29 10:51:09 2015 -0600
+++ b/configure.ac	Thu Oct 29 14:06:21 2015 -0600
@@ -3985,7 +3985,7 @@
 	    _CFLAGS="$CFLAGS"
 	    _LDFLAGS="$LDFLAGS"
 	    CFLAGS="-fstack-protector-strong"
-	    LDFLAGS="-fstack-protector-strong"
+	    LDFLAGS="$_LDFLAGS -fstack-protector-strong"
 	    AC_COMPILE_IFELSE([
 		AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT],
 		[[char buf[1024]; buf[1023] = '\0';]])
@@ -3993,7 +3993,7 @@
 		sudo_cv_var_stack_protector="-fstack-protector-strong"
 	    ], [
 		CFLAGS="-fstack-protector-all"
-		LDFLAGS="-fstack-protector-all"
+		LDFLAGS="$_LDFLAGS -fstack-protector-all"
 		AC_COMPILE_IFELSE([
 		    AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT],
 		    [[char buf[1024]; buf[1023] = '\0';]])
@@ -4001,7 +4001,7 @@
 		    sudo_cv_var_stack_protector="-fstack-protector-all"
 		], [
 		    CFLAGS="-fstack-protector"
-		    LDFLAGS="-fstack-protector"
+		    LDFLAGS="$_LDFLAGS -fstack-protector"
 		    AC_COMPILE_IFELSE([
 			AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT],
 			[[char buf[1024]; buf[1023] = '\0';]])