aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYabin Cui2014-12-11 16:35:05 -0600
committerYabin Cui2014-12-11 19:24:55 -0600
commit562ae1e6e42e83f674507d2b915deb503200befe (patch)
tree9e78f9012fa38c997bd2ac39c81bfa2cb7b5a0f1
parentfec605294e894fae1f1d5b59afe78af8fa84e4fa (diff)
downloadplatform-bionic-562ae1e6e42e83f674507d2b915deb503200befe.tar.gz
platform-bionic-562ae1e6e42e83f674507d2b915deb503200befe.tar.xz
platform-bionic-562ae1e6e42e83f674507d2b915deb503200befe.zip
make stack_protector_DeathTest work for gcc4.9
Bug: 18721888 Change-Id: I5f0b5c84319f56dbc4efb88e9d828138944667ae
-rw-r--r--tests/stack_protector_test.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/stack_protector_test.cpp b/tests/stack_protector_test.cpp
index aad51ecf..80077113 100644
--- a/tests/stack_protector_test.cpp
+++ b/tests/stack_protector_test.cpp
@@ -106,10 +106,16 @@ extern "C" uintptr_t __stack_chk_guard;
106 * This must be marked with "__attribute__ ((noinline))", to ensure the 106 * This must be marked with "__attribute__ ((noinline))", to ensure the
107 * compiler generates the proper stack guards around this function. 107 * compiler generates the proper stack guards around this function.
108 */ 108 */
109static char* dummy_buf;
110
109__attribute__ ((noinline)) 111__attribute__ ((noinline))
110static void do_modify_stack_chk_guard() { 112static void do_modify_stack_chk_guard() {
113 char buf[128];
114 // Store local array's address to global variable to force compiler to generate stack guards.
115 dummy_buf = buf;
111 __stack_chk_guard = 0x12345678; 116 __stack_chk_guard = 0x12345678;
112} 117}
118
113#endif 119#endif
114 120
115TEST(stack_protector, global_guard) { 121TEST(stack_protector, global_guard) {