Commit 22e1cb39 by Georg-Johann Lay Committed by Georg-Johann Lay

re PR target/71151 ([avr] -fmerge-constants and…

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
parent 55dcc361
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.
......
......@@ -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"
......
/* { 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();
......@@ -26,5 +29,4 @@ int main()
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();
......@@ -26,5 +29,4 @@ int main()
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();
......@@ -24,5 +27,4 @@ int main()
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();
......@@ -24,5 +26,4 @@ int main()
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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment