+2016-07-01 Georg-Johann Lay <avr@gjlay.de>
+
+ 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 <jbeulich@suse.com>
* gcc.target/i386/pr65105-2.c: Add -msse2.
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"
/* { 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"
/* { 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"
/* { 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();
foo(7);
if (y != 98)
abort();
-#endif
}
/* { 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();
foo(7);
if (y != 98)
abort();
-#endif
}
/* { 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();
foo(7);
if (y != 98)
abort();
-#endif
}
/* { 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();
foo(7);
if (y != 98)
abort();
-#endif
}
volatile char y;
volatile char g;
-__attribute__((section(".foo")))
+__attribute__((section(SECTION_NAME)))
void foo(char x)
{
switch (x)