diff options
author | Yury Gribov <y.gribov@samsung.com> | 2015-04-22 11:44:26 +0000 |
---|---|---|
committer | Yury Gribov <ygribov@gcc.gnu.org> | 2015-04-22 11:44:26 +0000 |
commit | 860503d8cc91ca9a5d8bf3db0b88281f31257603 (patch) | |
tree | 2fa8400720fb57497963cddeeb781ee766598e6f /gcc/testsuite/c-c++-common/asan | |
parent | 5cf3629251b7551a6082c1dca59675f042f986f4 (diff) | |
download | gcc-860503d8cc91ca9a5d8bf3db0b88281f31257603.zip gcc-860503d8cc91ca9a5d8bf3db0b88281f31257603.tar.gz gcc-860503d8cc91ca9a5d8bf3db0b88281f31257603.tar.bz2 |
Allow wildcards in -fsanitize-sections.
2015-04-22 Yury Gribov <y.gribov@samsung.com>
Allow wildcards in -fsanitize-sections.
gcc/
* asan.c (set_sanitized_sections): Parse incoming arg.
(section_sanitized_p): Support wildcards.
* doc/invoke.texi (-fsanitize-sections): Update description.
gcc/testsuite/
* c-c++-common/asan/user-section-1.c: New test.
* c-c++-common/asan/user-section-2.c: New test.
* c-c++-common/asan/user-section-3.c: New test.
From-SVN: r222322
Diffstat (limited to 'gcc/testsuite/c-c++-common/asan')
-rw-r--r-- | gcc/testsuite/c-c++-common/asan/user-section-1.c | 11 | ||||
-rw-r--r-- | gcc/testsuite/c-c++-common/asan/user-section-2.c | 11 | ||||
-rw-r--r-- | gcc/testsuite/c-c++-common/asan/user-section-3.c | 11 |
3 files changed, 33 insertions, 0 deletions
diff --git a/gcc/testsuite/c-c++-common/asan/user-section-1.c b/gcc/testsuite/c-c++-common/asan/user-section-1.c new file mode 100644 index 0000000..51e2b99 --- /dev/null +++ b/gcc/testsuite/c-c++-common/asan/user-section-1.c @@ -0,0 +1,11 @@ +/* { dg-do compile } */ +/* { dg-options "-fsanitize=address -fsanitize-sections=.xxx,.yyy -fdump-tree-sanopt" } */ +/* { dg-skip-if "" { *-*-* } { "-flto" } { "" } } */ + +int x __attribute__((section(".xxx"))) = 1; +int y __attribute__((section(".yyy"))) = 1; +int z __attribute__((section(".zzz"))) = 1; + +/* { dg-final { scan-tree-dump "__builtin___asan_unregister_globals \\(.*, 2\\);" "sanopt" } } */ +/* { dg-final { cleanup-tree-dump "sanopt" } } */ + diff --git a/gcc/testsuite/c-c++-common/asan/user-section-2.c b/gcc/testsuite/c-c++-common/asan/user-section-2.c new file mode 100644 index 0000000..f602116 --- /dev/null +++ b/gcc/testsuite/c-c++-common/asan/user-section-2.c @@ -0,0 +1,11 @@ +/* { dg-do compile } */ +/* { dg-options "-fsanitize=address -fsanitize-sections=.x* -fdump-tree-sanopt" } */ +/* { dg-skip-if "" { *-*-* } { "-flto" } { "" } } */ + +int x __attribute__((section(".x1"))) = 1; +int y __attribute__((section(".x2"))) = 1; +int z __attribute__((section(".x3"))) = 1; + +/* { dg-final { scan-tree-dump "__builtin___asan_unregister_globals \\(.*, 3\\);" "sanopt" } } */ +/* { dg-final { cleanup-tree-dump "sanopt" } } */ + diff --git a/gcc/testsuite/c-c++-common/asan/user-section-3.c b/gcc/testsuite/c-c++-common/asan/user-section-3.c new file mode 100644 index 0000000..66e5f9a --- /dev/null +++ b/gcc/testsuite/c-c++-common/asan/user-section-3.c @@ -0,0 +1,11 @@ +/* { dg-do compile } */ +/* { dg-options "-fsanitize=address -fsanitize-sections=.x* -fsanitize-sections=.y* -fdump-tree-sanopt" } */ +/* { dg-skip-if "" { *-*-* } { "-flto" } { "" } } */ + +int x __attribute__((section(".x1"))) = 1; +int y __attribute__((section(".x2"))) = 1; +int z __attribute__((section(".y1"))) = 1; + +/* { dg-final { scan-tree-dump "__builtin___asan_unregister_globals \\(.*, 1\\);" "sanopt" } } */ +/* { dg-final { cleanup-tree-dump "sanopt" } } */ + |