From 43edfb7fac67118fa7ed41310dc73241f238decd Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Tue, 15 May 2007 13:57:03 +0000 Subject: [PATCH] 2007-05-15 H.J. Lu 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". --- ld/testsuite/ChangeLog | 11 +++++++++++ ld/testsuite/ld-elf/data1.c | 6 ++++++ ld/testsuite/ld-elf/data1.h | 9 +++++++++ ld/testsuite/ld-elf/dynbss1.c | 20 ++++++++++++++++++++ ld/testsuite/ld-elf/pass.out | 1 + ld/testsuite/ld-elf/shared.exp | 6 ++++++ 6 files changed, 53 insertions(+) create mode 100644 ld/testsuite/ld-elf/data1.c create mode 100644 ld/testsuite/ld-elf/data1.h create mode 100644 ld/testsuite/ld-elf/dynbss1.c create mode 100644 ld/testsuite/ld-elf/pass.out diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog index 57a5d05..37379b0 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,3 +1,14 @@ +2007-05-15 H.J. Lu + + 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 * ld-arm/vxworks1.ld: Swap .bss and .data. diff --git a/ld/testsuite/ld-elf/data1.c b/ld/testsuite/ld-elf/data1.c new file mode 100644 index 0000000..c205f82 --- /dev/null +++ b/ld/testsuite/ld-elf/data1.c @@ -0,0 +1,6 @@ +#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))); diff --git a/ld/testsuite/ld-elf/data1.h b/ld/testsuite/ld-elf/data1.h new file mode 100644 index 0000000..529ee4b --- /dev/null +++ b/ld/testsuite/ld-elf/data1.h @@ -0,0 +1,9 @@ +#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]; diff --git a/ld/testsuite/ld-elf/dynbss1.c b/ld/testsuite/ld-elf/dynbss1.c new file mode 100644 index 0000000..eb5f067 --- /dev/null +++ b/ld/testsuite/ld-elf/dynbss1.c @@ -0,0 +1,20 @@ +#include +#include +#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) ; +} diff --git a/ld/testsuite/ld-elf/pass.out b/ld/testsuite/ld-elf/pass.out new file mode 100644 index 0000000..7ef22e9 --- /dev/null +++ b/ld/testsuite/ld-elf/pass.out @@ -0,0 +1 @@ +PASS diff --git a/ld/testsuite/ld-elf/shared.exp b/ld/testsuite/ld-elf/shared.exp index 0a9a4ff..c8e0a18 100644 --- a/ld/testsuite/ld-elf/shared.exp +++ b/ld/testsuite/ld-elf/shared.exp @@ -117,6 +117,9 @@ set build_tests { {"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 { @@ -226,6 +229,9 @@ 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 -- 2.7.4