From: Georg-Johann Lay Date: Fri, 1 Jul 2016 12:09:53 +0000 (+0000) Subject: re PR target/71151 ([avr] -fmerge-constants and -fdata-sections/-ffunction-sections... X-Git-Tag: basepoints/gcc-8~5935 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=22e1cb39f3a5f083f4c10852c602d65e10292d78;p=thirdparty%2Fgcc.git 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 --- diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 86d596cad266..c23836cd8a2a 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 e523ce09c7a5..f745841df8a6 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 ce0ba5972e40..a8fa6b63e0b2 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 51250b06133a..659aff075104 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 47030dca5ee6..f9b09e820830 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 815aa13425c6..dedeffaa425b 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 cdc7ea9f65c0..2a440960301c 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 0b7bf6a0e739..aa3015b0455b 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 0df17836b99c..43379be5d2c6 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)