summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Khalikov <d.khalikov@partner.samsung.com>2018-07-05 13:04:58 +0300
committerDenis Khalikov <d.khalikov@partner.samsung.com>2018-07-06 12:40:41 +0300
commit2a2c39cdfa172cbac364069947a3b9e4fe84e8e7 (patch)
tree3b785364bca04b9205f3a4fb19e7e949cb22b3c9
parentf4955bb607f6b1b73f7957e83388375064737359 (diff)
downloadlinaro-gcc-2a2c39cdfa172cbac364069947a3b9e4fe84e8e7.tar.gz
linaro-gcc-2a2c39cdfa172cbac364069947a3b9e4fe84e8e7.tar.bz2
linaro-gcc-2a2c39cdfa172cbac364069947a3b9e4fe84e8e7.zip
packaging: Add -marm and -fno-omit-frame-pointer
To enable "fastunwinder" work on armv7l we should explicitly build libasan with -marm and -fno-omit-frame-pointer. Change-Id: I28e763fa7b088aa26a81e7bb6d3a7fa9ba7a714b
-rw-r--r--gcc/testsuite/c-c++-common/asan/fast-unwind.c49
-rw-r--r--packaging/gcc-aarch64.spec7
-rw-r--r--packaging/gcc-armv7hl.spec7
-rw-r--r--packaging/gcc-armv7l.spec7
-rw-r--r--packaging/linaro-gcc.spec7
5 files changed, 73 insertions, 4 deletions
diff --git a/gcc/testsuite/c-c++-common/asan/fast-unwind.c b/gcc/testsuite/c-c++-common/asan/fast-unwind.c
new file mode 100644
index 00000000000..f411a551c14
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/asan/fast-unwind.c
@@ -0,0 +1,49 @@
+/* { dg-do compile { target arm*-*-*} } */
+/* { dg-options "-fno-builtin-malloc -fno-builtin-free -fno-builtin-memset
+ * -fno-omit-frame-pointer -marm -Wa,-mimplicit-it=arm" } */
+/* { dg-skip-if "" { *-*-* } { "*" } { "-O0" } } */
+/* { dg-shouldfail "asan" } */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void *memset (void *, int, __SIZE_TYPE__);
+void *malloc (__SIZE_TYPE__);
+void free (void *);
+
+const char *
+__asan_default_options () {
+ return "fast_unwind_on_fatal=true";
+}
+
+#ifdef __cplusplus
+}
+#endif
+volatile int ten = 10;
+__attribute__ ((noinline)) int
+foo ()
+{
+ char *x = (char *) malloc (10);
+ memset(x, 0, 10);
+ int res = x[ten]; /* BOOOM */
+ free(x);
+ return res;
+}
+
+__attribute__ ((noinline)) int
+bar ()
+{
+ return foo ();
+}
+
+int
+main (int argc, char **argv)
+{
+ return bar ();
+}
+
+/* { dg-output "READ of size 1 at 0x\[0-9a-f\]+ thread T0.*(\n|\r\n|\r)" } */
+/* { dg-output " #0 0x\[0-9a-f\]+ +(in \[^\n\r]*foo\[^\n\r]*fast-unwind.c:29|\[(\]).*(\n|\r\n|\r)" } */
+/* { dg-output " #1 0x\[0-9a-f\]+ +(in \[^\n\r]*bar\[^\n\r]*fast-unwind.c:37|\[(\]).*(\n|\r\n|\r)" } */
+/* { dg-output " #2 0x\[0-9a-f\]+ +(in _*main (\[^\n\r]*fast-unwind.c:43|\[^\n\r]*:0)|\[(\]).*(\n|\r\n|\r)" } */
diff --git a/packaging/gcc-aarch64.spec b/packaging/gcc-aarch64.spec
index 7a34932bc3f..965c0e84e88 100644
--- a/packaging/gcc-aarch64.spec
+++ b/packaging/gcc-aarch64.spec
@@ -667,7 +667,12 @@ echo "" > gcc/DEV-PHASE
%global gcc_release `sed -e 's/^.*-//g' %{_builddir}/gcc-%{version}/gcc/LINARO-VERSION`
%build
-%{?asan:%gcc_unforce_options}
+%{?asan:
+%gcc_unforce_options
+%ifarch armv7l
+RPM_OPT_FLAGS="$RPM_OPT_FLAGS -marm -Wa,-mimplicit-it=arm -fno-omit-frame-pointer"
+%endif
+}
rm -rf obj
mkdir obj
cd obj
diff --git a/packaging/gcc-armv7hl.spec b/packaging/gcc-armv7hl.spec
index a5aef378785..2c05eed1361 100644
--- a/packaging/gcc-armv7hl.spec
+++ b/packaging/gcc-armv7hl.spec
@@ -667,7 +667,12 @@ echo "" > gcc/DEV-PHASE
%global gcc_release `sed -e 's/^.*-//g' %{_builddir}/gcc-%{version}/gcc/LINARO-VERSION`
%build
-%{?asan:%gcc_unforce_options}
+%{?asan:
+%gcc_unforce_options
+%ifarch armv7l
+RPM_OPT_FLAGS="$RPM_OPT_FLAGS -marm -Wa,-mimplicit-it=arm -fno-omit-frame-pointer"
+%endif
+}
rm -rf obj
mkdir obj
cd obj
diff --git a/packaging/gcc-armv7l.spec b/packaging/gcc-armv7l.spec
index 74b06d2ee0e..638e853ab4c 100644
--- a/packaging/gcc-armv7l.spec
+++ b/packaging/gcc-armv7l.spec
@@ -667,7 +667,12 @@ echo "" > gcc/DEV-PHASE
%global gcc_release `sed -e 's/^.*-//g' %{_builddir}/gcc-%{version}/gcc/LINARO-VERSION`
%build
-%{?asan:%gcc_unforce_options}
+%{?asan:
+%gcc_unforce_options
+%ifarch armv7l
+RPM_OPT_FLAGS="$RPM_OPT_FLAGS -marm -Wa,-mimplicit-it=arm -fno-omit-frame-pointer"
+%endif
+}
rm -rf obj
mkdir obj
cd obj
diff --git a/packaging/linaro-gcc.spec b/packaging/linaro-gcc.spec
index 9de25fc8347..038f8e2124f 100644
--- a/packaging/linaro-gcc.spec
+++ b/packaging/linaro-gcc.spec
@@ -664,7 +664,12 @@ echo "" > gcc/DEV-PHASE
%global gcc_release `sed -e 's/^.*-//g' %{_builddir}/gcc-%{version}/gcc/LINARO-VERSION`
%build
-%{?asan:%gcc_unforce_options}
+%{?asan:
+%gcc_unforce_options
+%ifarch armv7l
+RPM_OPT_FLAGS="$RPM_OPT_FLAGS -marm -Wa,-mimplicit-it=arm -fno-omit-frame-pointer"
+%endif
+}
rm -rf obj
mkdir obj
cd obj