From: nobody <> Date: Sat, 8 Oct 2011 16:51:12 +0000 (+0000) Subject: This commit was manufactured by cvs2svn to create branch 'binutils- X-Git-Tag: binutils-2_22~88 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a8317aa2e63fe821a1dd1ed829c4653369e3381d;p=thirdparty%2Fbinutils-gdb.git 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 --- diff --git a/ld/testsuite/ld-elf/pr13250-1.c b/ld/testsuite/ld-elf/pr13250-1.c new file mode 100644 index 00000000000..e43ebe09153 --- /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 00000000000..af8268bda9c --- /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 00000000000..a22767094b0 --- /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; +}