* ld-elf/data2.c: New file.
	* ld-elf/weakdef1.c: Likewise.
	* ld-elf/shared.exp: Add tests for libdata2 and weakdef1.
+2012-07-02  H.J. Lu  <hongjiu.lu@intel.com>
+
+       * ld-elf/data2.c: New file.
+       * ld-elf/weakdef1.c: Likewise.
+
+       * ld-elf/shared.exp: Add tests for libdata2 and weakdef1.
+
 2012-06-28  Roland McGrath  <mcgrathr@google.com>
 
        * ld-arm/arm-elf.exp (armelftests_common): Add a test that gets
 
--- /dev/null
+int foo = 0;
+extern int foo_alias __attribute__ ((weak, alias ("foo")));
+
+void
+bar (void)
+{
+  foo = -1;
+}
+
 
   {"Build libdata1.so"
    "-shared" "-fPIC"
    {data1.c} {} "libdata1.so"}
+  {"Build libdata2.so"
+   "-shared" "-fPIC"
+   {data2.c} {} "libdata2.so"}
   {"Build libcomm1.o"
    "-r -nostdlib" ""
    {comm1.c} {} "libcomm1.o"}
     {"Run with libdata1.so"
      "tmpdir/libdata1.so" ""
      {dynbss1.c} "dynbss1" "pass.out"}
+    {"Run with libdata2.so"
+     "tmpdir/libdata2.so" ""
+     {weakdef1.c} "weakdef1" "pass.out"}
     {"Run with libfunc1.so comm1.o"
      "tmpdir/libfunc1.so tmpdir/comm1.o" ""
      {dummy.c} "comm1" "pass.out"}
 
--- /dev/null
+#include <stdio.h>
+#include <stdlib.h>
+
+extern int foo_alias;
+extern void bar (void);
+
+int
+main (void)
+{
+  bar ();
+  if (foo_alias != -1)
+    abort ();
+  printf ("PASS\n");
+  return 0;
+}