+2007-05-15  H.J. Lu  <hongjiu.lu@intel.com>
+
+       PR ld/4504
+       * ld-elf/data1.c: New file.
+       * ld-elf/data1.h: Likewise.
+       * ld-elf/dynbss1.c: Likewise.
+       * ld-elf/pass.out: Likewise.
+
+       * ld-elf/shared.exp (build_tests): Add "Build libdata1.so".
+       (run_tests): Add "Run with libdata1.so".
+
 2007-05-15  Richard Sandiford  <richard@codesourcery.com>
 
        * ld-arm/vxworks1.ld: Swap .bss and .data.
 
--- /dev/null
+#include "data1.h"
+
+char a1[1] __attribute__ ((aligned (ALIGNMENT1))) = { 10 };
+char a2[2] __attribute__ ((aligned (ALIGNMENT2)));
+char a3[3] __attribute__ ((aligned (ALIGNMENT3)));
+char a4[4] __attribute__ ((aligned (ALIGNMENT4)));
 
--- /dev/null
+#define ALIGNMENT1 0x800
+#define ALIGNMENT2 0x400
+#define ALIGNMENT3 0x200
+#define ALIGNMENT4 0x100
+
+extern char a1[1];
+extern char a2[2];
+extern char a3[3];
+extern char a4[4];
 
--- /dev/null
+#include <stdio.h>
+#include <stdlib.h>
+#include "data1.h"
+
+int
+main (void)
+{
+  if ((((long) (&a1)) & (ALIGNMENT1 - 1)))
+    abort ();
+  if ((((long) (&a2)) & (ALIGNMENT2 - 1)))
+    abort ();
+  if ((((long) (&a2)) & (ALIGNMENT3 - 1)))
+    abort ();
+  if ((((long) (&a3)) & (ALIGNMENT4 - 1)))
+    abort ();
+
+  printf ("PASS\n");
+
+  return(0) ;
+}
 
   {"Build libdl6d.so with --dynamic-list-data -Bsymbolic"
    "-shared -Wl,--dynamic-list-data,-Bsymbolic" "-fPIC"
    {dl6.c} {} "libdl6d.so"}
+  {"Build libdata1.so"
+   "-shared" "-fPIC"
+   {data1.c} {} "libdata1.so"}
 }
 
 set run_tests {
     {"Run dl6d1 with --dynamic-list-data and dlopen on libdl6d.so"
      "--dynamic-list-data -ldl" ""
      {dl6dmain.c} "dl6d1" "dl6b.out"}
+    {"Run with libdata1.so"
+     "tmpdir/libdata1.so" ""
+     {dynbss1.c} "dynbss1" "pass.out"}
 }
 
 run_cc_link_tests $build_tests