From a8317aa2e63fe821a1dd1ed829c4653369e3381d Mon Sep 17 00:00:00 2001 From: nobody <> Date: Sat, 8 Oct 2011 16:51:12 +0000 Subject: This commit was manufactured by cvs2svn to create branch 'binutils- 2_22-branch'. Cherrypick from master 2011-10-08 16:51:11 UTC H.J. Lu 'Preserve the maximum alignment/size for common symbols.': ld/testsuite/ld-elf/pr13250-1.c ld/testsuite/ld-elf/pr13250-2.c ld/testsuite/ld-elf/pr13250-3.c --- ld/testsuite/ld-elf/pr13250-1.c | 8 ++++++++ ld/testsuite/ld-elf/pr13250-2.c | 10 ++++++++++ ld/testsuite/ld-elf/pr13250-3.c | 22 ++++++++++++++++++++++ 3 files changed, 40 insertions(+) create mode 100644 ld/testsuite/ld-elf/pr13250-1.c create mode 100644 ld/testsuite/ld-elf/pr13250-2.c create mode 100644 ld/testsuite/ld-elf/pr13250-3.c (limited to 'ld') diff --git a/ld/testsuite/ld-elf/pr13250-1.c b/ld/testsuite/ld-elf/pr13250-1.c new file mode 100644 index 0000000..e43ebe0 --- /dev/null +++ b/ld/testsuite/ld-elf/pr13250-1.c @@ -0,0 +1,8 @@ +int common1[8]; +void +foo () +{ + int i; + for (i = 0; i < sizeof (common1)/ sizeof (common1[0]); i++) + common1[i] = -1; +} diff --git a/ld/testsuite/ld-elf/pr13250-2.c b/ld/testsuite/ld-elf/pr13250-2.c new file mode 100644 index 0000000..af8268b --- /dev/null +++ b/ld/testsuite/ld-elf/pr13250-2.c @@ -0,0 +1,10 @@ +extern int common1[8]; + +extern void foo (); + +int +bar () +{ + foo (); + return common1[4]; +} diff --git a/ld/testsuite/ld-elf/pr13250-3.c b/ld/testsuite/ld-elf/pr13250-3.c new file mode 100644 index 0000000..a227670 --- /dev/null +++ b/ld/testsuite/ld-elf/pr13250-3.c @@ -0,0 +1,22 @@ +#include +#include + +int common1[1]; +char common2[2]; + +extern int bar (); + +int +main () +{ + int i; + if (bar () != -1) + abort (); + if (common1[0] != -1) + abort (); + for (i = 0; i < sizeof (common2)/ sizeof (common2[0]); i++) + if (common2[i] != 0) + abort (); + printf ("PASS\n"); + return 0; +} -- cgit v1.1