]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
This commit was manufactured by cvs2svn to create branch 'binutils-
authornobody <>
Sat, 8 Oct 2011 16:51:12 +0000 (16:51 +0000)
committernobody <>
Sat, 8 Oct 2011 16:51:12 +0000 (16:51 +0000)
2_22-branch'.

Cherrypick from master 2011-10-08 16:51:11 UTC H.J. Lu <hjl.tools@gmail.com> '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 [new file with mode: 0644]
ld/testsuite/ld-elf/pr13250-2.c [new file with mode: 0644]
ld/testsuite/ld-elf/pr13250-3.c [new file with mode: 0644]

diff --git a/ld/testsuite/ld-elf/pr13250-1.c b/ld/testsuite/ld-elf/pr13250-1.c
new file mode 100644 (file)
index 0000000..e43ebe0
--- /dev/null
@@ -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 (file)
index 0000000..af8268b
--- /dev/null
@@ -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 (file)
index 0000000..a227670
--- /dev/null
@@ -0,0 +1,22 @@
+#include <stdio.h>
+#include <stdlib.h>
+
+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;
+}