From 22e1cb39f3a5f083f4c10852c602d65e10292d78 Mon Sep 17 00:00:00 2001 From: Georg-Johann Lay Date: Fri, 1 Jul 2016 12:09:53 +0000 Subject: [PATCH] re PR target/71151 ([avr] -fmerge-constants and -fdata-sections/-ffunction-sections results in string constants in .progmem.gcc_sw section) gcc/testsuite/ PR target/71151 * gcc.target/avr/pr71151-common.h (foo): Use macro SECTION_NAME instead of ".foo" for its section name. * gcc.target/avr/pr71151-2.c (SECTION_NAME): Define appropriately depending on MCU's flash size. * gcc.target/avr/pr71151-3.c (SECTION_NAME): Dito. * gcc.target/avr/pr71151-4.c (SECTION_NAME): Dito. * gcc.target/avr/pr71151-5.c (SECTION_NAME): Dito. * gcc.target/avr/pr71151-6.c (SECTION_NAME): Dito. * gcc.target/avr/pr71151-7.c (SECTION_NAME): Dito. * gcc.target/avr/pr71151-8.c (SECTION_NAME): Dito. From-SVN: r237910 --- gcc/testsuite/ChangeLog | 14 ++++++++++++++ gcc/testsuite/gcc.target/avr/pr71151-2.c | 2 ++ gcc/testsuite/gcc.target/avr/pr71151-3.c | 7 +++++++ gcc/testsuite/gcc.target/avr/pr71151-4.c | 7 +++++++ gcc/testsuite/gcc.target/avr/pr71151-5.c | 12 +++++++----- gcc/testsuite/gcc.target/avr/pr71151-6.c | 12 +++++++----- gcc/testsuite/gcc.target/avr/pr71151-7.c | 12 +++++++----- gcc/testsuite/gcc.target/avr/pr71151-8.c | 11 ++++++----- gcc/testsuite/gcc.target/avr/pr71151-common.h | 2 +- 9 files changed, 58 insertions(+), 21 deletions(-) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 86d596c..c23836c 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,17 @@ +2016-07-01 Georg-Johann Lay + + PR target/71151 + * gcc.target/avr/pr71151-common.h (foo): Use macro SECTION_NAME + instead of ".foo" for its section name. + * gcc.target/avr/pr71151-2.c (SECTION_NAME): Define appropriately + depending on MCU's flash size. + * gcc.target/avr/pr71151-3.c (SECTION_NAME): Dito. + * gcc.target/avr/pr71151-4.c (SECTION_NAME): Dito. + * gcc.target/avr/pr71151-5.c (SECTION_NAME): Dito. + * gcc.target/avr/pr71151-6.c (SECTION_NAME): Dito. + * gcc.target/avr/pr71151-7.c (SECTION_NAME): Dito. + * gcc.target/avr/pr71151-8.c (SECTION_NAME): Dito. + 2016-07-01 Jan Beulich * gcc.target/i386/pr65105-2.c: Add -msse2. diff --git a/gcc/testsuite/gcc.target/avr/pr71151-2.c b/gcc/testsuite/gcc.target/avr/pr71151-2.c index e523ce0..f745841 100644 --- a/gcc/testsuite/gcc.target/avr/pr71151-2.c +++ b/gcc/testsuite/gcc.target/avr/pr71151-2.c @@ -5,6 +5,8 @@ flash address for loading jump table entry, 2 byte entry, after removing the special section placement hook. */ +#define SECTION_NAME ".foo" + #include "exit-abort.h" #include "pr71151-common.h" diff --git a/gcc/testsuite/gcc.target/avr/pr71151-3.c b/gcc/testsuite/gcc.target/avr/pr71151-3.c index ce0ba59..a8fa6b6 100644 --- a/gcc/testsuite/gcc.target/avr/pr71151-3.c +++ b/gcc/testsuite/gcc.target/avr/pr71151-3.c @@ -1,10 +1,17 @@ /* { dg-do run } */ /* { dg-options "-Os -fno-tree-switch-conversion -ffunction-sections -mno-relax -fdata-sections -Wl,--section-start=.foo=0x10000" } */ +#ifdef __AVR_HAVE_ELPM__ /* Make sure jumptables work properly if placed above 64 KB and below 128 KB, i.e. 3 byte flash address for loading jump table entry and 2 byte jump table entry, with relaxation disabled, after removing the special section placement hook. */ +#define SECTION_NAME ".foo" +#else +/* No special jump table placement so that avrtest won't abort + for, e.g. ATmega64. */ +#define SECTION_NAME ".text.foo" +#endif #include "exit-abort.h" #include "pr71151-common.h" diff --git a/gcc/testsuite/gcc.target/avr/pr71151-4.c b/gcc/testsuite/gcc.target/avr/pr71151-4.c index 51250b0..659aff0 100644 --- a/gcc/testsuite/gcc.target/avr/pr71151-4.c +++ b/gcc/testsuite/gcc.target/avr/pr71151-4.c @@ -1,10 +1,17 @@ /* { dg-do run } */ /* { dg-options "-Os -fno-tree-switch-conversion -ffunction-sections -fdata-sections -mrelax -Wl,--section-start=.foo=0x10000" } */ +#ifdef __AVR_HAVE_ELPM__ /* Make sure jumptables work properly if placed above 64 KB and below 128 KB, i.e. 3 byte flash address for loading jump table entry and 2 byte jump table entry, with relaxation enabled, after removing the special section placement hook. */ +#define SECTION_NAME ".foo" +#else +/* No special jump table placement so that avrtest won't abort + for, e.g. ATmega64. */ +#define SECTION_NAME ".text.foo" +#endif #include "exit-abort.h" #include "pr71151-common.h" diff --git a/gcc/testsuite/gcc.target/avr/pr71151-5.c b/gcc/testsuite/gcc.target/avr/pr71151-5.c index 47030dc..f9b09e8 100644 --- a/gcc/testsuite/gcc.target/avr/pr71151-5.c +++ b/gcc/testsuite/gcc.target/avr/pr71151-5.c @@ -1,20 +1,23 @@ /* { dg-do run } */ /* { dg-options "-Os -fno-tree-switch-conversion -ffunction-sections -fdata-sections -mno-relax -Wl,--section-start=.foo=0x20000" } */ +#ifdef __AVR_3_BYTE_PC__ /* Make sure jumptables work properly if placed above 128 KB, i.e. 3 byte flash address for loading jump table entry and a jump table entry that is a stub, with relaxation disabled, after removing the special section placement hook. */ +#define SECTION_NAME ".foo" +#else +/* No special jump table placement so that avrtest won't abort + for, e.g. ATmega128. */ +#define SECTION_NAME ".text.foo" +#endif #include "exit-abort.h" #include "pr71151-common.h" int main() { - /* Not meant for devices with flash <= 128K */ -#if defined (__AVR_2_BYTE_PC__) - exit(0); -#else foo(5); if (y != 37) abort(); @@ -26,5 +29,4 @@ int main() foo(7); if (y != 98) abort(); -#endif } diff --git a/gcc/testsuite/gcc.target/avr/pr71151-6.c b/gcc/testsuite/gcc.target/avr/pr71151-6.c index 815aa13..dedeffa 100644 --- a/gcc/testsuite/gcc.target/avr/pr71151-6.c +++ b/gcc/testsuite/gcc.target/avr/pr71151-6.c @@ -1,20 +1,23 @@ /* { dg-do run } */ /* { dg-options "-Os -fno-tree-switch-conversion -ffunction-sections -fdata-sections -mrelax -Wl,--section-start=.foo=0x20000" } */ +#ifdef __AVR_3_BYTE_PC__ /* Make sure jumptables work properly if placed above 128 KB, i.e. 3 byte flash address for loading jump table entry and a jump table entry that is a stub, with relaxation enabled, after removing the special section placement hook. */ +#define SECTION_NAME ".foo" +#else +/* No special jump table placement so that avrtest won't abort + for, e.g. ATmega128. */ +#define SECTION_NAME ".text.foo" +#endif #include "exit-abort.h" #include "pr71151-common.h" int main() { - /* Not meant for devices with flash <= 128K */ -#if defined (__AVR_2_BYTE_PC__) - exit(0); -#else foo(5); if (y != 37) abort(); @@ -26,5 +29,4 @@ int main() foo(7); if (y != 98) abort(); -#endif } diff --git a/gcc/testsuite/gcc.target/avr/pr71151-7.c b/gcc/testsuite/gcc.target/avr/pr71151-7.c index cdc7ea9..2a44096 100644 --- a/gcc/testsuite/gcc.target/avr/pr71151-7.c +++ b/gcc/testsuite/gcc.target/avr/pr71151-7.c @@ -1,18 +1,21 @@ /* { dg-do run } */ /* { dg-options "-Os -fno-tree-switch-conversion -ffunction-sections -fdata-sections -mno-relax -Wl,--section-start=.foo=0x1fffa" } */ +#ifdef __AVR_3_BYTE_PC__ /* Make sure jumptables work properly if placed straddling 128 KB i.e some entries below 128 KB and some above it, with relaxation disabled. */ +#define SECTION_NAME ".foo" +#else +/* No special jump table placement so that avrtest won't abort + for, e.g. ATmega128. */ +#define SECTION_NAME ".text.foo" +#endif #include "exit-abort.h" #include "pr71151-common.h" int main() { - /* Not meant for devices with flash <= 128K */ -#if defined (__AVR_2_BYTE_PC__) - exit(0); -#else foo(5); if (y != 37) abort(); @@ -24,5 +27,4 @@ int main() foo(7); if (y != 98) abort(); -#endif } diff --git a/gcc/testsuite/gcc.target/avr/pr71151-8.c b/gcc/testsuite/gcc.target/avr/pr71151-8.c index 0b7bf6a..aa3015b 100644 --- a/gcc/testsuite/gcc.target/avr/pr71151-8.c +++ b/gcc/testsuite/gcc.target/avr/pr71151-8.c @@ -1,18 +1,20 @@ /* { dg-do run } */ /* { dg-options "-Os -fno-tree-switch-conversion -ffunction-sections -fdata-sections -mrelax -Wl,--section-start=.foo=0x1fffa" } */ +#ifdef __AVR_3_BYTE_PC__ /* Make sure jumptables work properly if placed straddling 128 KB i.e some entries below 128 KB and some above it, with relaxation disabled. */ +#define SECTION_NAME ".foo" +#else +/* No special jump table placement so that avrtest won't abort. */ +#define SECTION_NAME ".text.foo" +#endif #include "exit-abort.h" #include "pr71151-common.h" int main() { - /* Not meant for devices with flash <= 128K */ -#if defined (__AVR_2_BYTE_PC__) - exit(0); -#else foo(5); if (y != 37) abort(); @@ -24,5 +26,4 @@ int main() foo(7); if (y != 98) abort(); -#endif } diff --git a/gcc/testsuite/gcc.target/avr/pr71151-common.h b/gcc/testsuite/gcc.target/avr/pr71151-common.h index 0df1783..43379be 100644 --- a/gcc/testsuite/gcc.target/avr/pr71151-common.h +++ b/gcc/testsuite/gcc.target/avr/pr71151-common.h @@ -1,7 +1,7 @@ volatile char y; volatile char g; -__attribute__((section(".foo"))) +__attribute__((section(SECTION_NAME))) void foo(char x) { switch (x) -- 2.7.4