aboutsummaryrefslogtreecommitdiff
path: root/ld/testsuite
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2007-01-16 14:56:32 +0000
committerH.J. Lu <hjl.tools@gmail.com>2007-01-16 14:56:32 +0000
commit40b36307e31ea3e3606a1698f35d0b9769405615 (patch)
tree2cb0fb15024ffb5549aaaf04d9cf2ada1d738d3a /ld/testsuite
parentb20d8971adc2a4b07c6d777716948da8e902c379 (diff)
downloadgdb-40b36307e31ea3e3606a1698f35d0b9769405615.zip
gdb-40b36307e31ea3e3606a1698f35d0b9769405615.tar.gz
gdb-40b36307e31ea3e3606a1698f35d0b9769405615.tar.bz2
bfd/
2007-01-16 H.J. Lu <hongjiu.lu@intel.com> PR ld/3831 * elf-bfd.h (bfd_elf_link_mark_dynamic_symbol): Add an argument, Elf_Internal_Sym *. * elflink.c (bfd_elf_link_mark_dynamic_symbol): Mark a data symbol dynamic if info->dynamic_data is TRUE. (bfd_elf_record_link_assignment): Updated call to bfd_elf_record_link_assignment. (_bfd_elf_merge_symbol): Likewise. Always call bfd_elf_link_mark_dynamic_symbol. include/ 2007-01-16 H.J. Lu <hongjiu.lu@intel.com> PR ld/3831 * bfdlink.h (bfd_link_info): Rename dynamic to dynamic_list. Add dynamic and dynamic_data. ld/ 2007-01-16 H.J. Lu <hongjiu.lu@intel.com> PR ld/3831 * NEWS: Mention -Bsymbolic-functions, --dynamic-list-data and --dynamic-list-cpp-new. * ld.texinfo: Document -Bsymbolic-functions, --dynamic-list-data and --dynamic-list-cpp-new. * ldlang.c (lang_append_dynamic_list_cpp_new): New. (lang_process): Change link_info.dynamic to link_info.dynamic_list. (lang_append_dynamic_list): Likewise. * ldmain.c (main): Likewise. Initialize link_info.dynamic and link_info.dynamic_data to FALSE. * ldlang.h (lang_append_dynamic_list_cpp_new): New. * lexsup.c (option_values): Add OPTION_DYNAMIC_LIST_DATA and OPTION_DYNAMIC_LIST_CPP_NEW. (ld_options): Add entries for -Bsymbolic-functions, --dynamic-list-data and --dynamic-list-cpp-new. Make -Bsymbolic-functions an alias of --dynamic-list-data. (parse_args): Change link_info.dynamic to link_info.dynamic_list. Set link_info.dynamic to TRUE for --dynamic-list and --dynamic-list-cpp-typeinfo. Handle --dynamic-list-data and --dynamic-list-cpp-new. ld/testsuite/ 2007-01-16 H.J. Lu <hongjiu.lu@intel.com> PR ld/3831 * ld-elf/del.cc: New. * ld-elf/dl5.cc: Likewise. * ld-elf/dl5.out: Likewise. * ld-elf/new.cc: Likewise. * ld-elf/shared.exp: Add tests for --dynamic-list-data and --dynamic-list-cpp-new.
Diffstat (limited to 'ld/testsuite')
-rw-r--r--ld/testsuite/ChangeLog11
-rw-r--r--ld/testsuite/ld-elf/del.cc29
-rw-r--r--ld/testsuite/ld-elf/dl5.cc61
-rw-r--r--ld/testsuite/ld-elf/dl5.out1
-rw-r--r--ld/testsuite/ld-elf/new.cc48
-rw-r--r--ld/testsuite/ld-elf/shared.exp23
6 files changed, 172 insertions, 1 deletions
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog
index 1525b57..e8e31d4 100644
--- a/ld/testsuite/ChangeLog
+++ b/ld/testsuite/ChangeLog
@@ -1,3 +1,14 @@
+2007-01-16 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR ld/3831
+ * ld-elf/del.cc: New.
+ * ld-elf/dl5.cc: Likewise.
+ * ld-elf/dl5.out: Likewise.
+ * ld-elf/new.cc: Likewise.
+
+ * ld-elf/shared.exp: Add tests for --dynamic-list-data and
+ --dynamic-list-cpp-new.
+
2007-01-12 Hans-Peter Nilsson <hp@axis.com>
* ld-elf/header.d: Allow arbitrary lines between "Program Header"
diff --git a/ld/testsuite/ld-elf/del.cc b/ld/testsuite/ld-elf/del.cc
new file mode 100644
index 0000000..4e2cc60
--- /dev/null
+++ b/ld/testsuite/ld-elf/del.cc
@@ -0,0 +1,29 @@
+#include <new>
+
+extern "C" void free (void *);
+
+void
+operator delete (void *ptr, const std::nothrow_t&) throw ()
+{
+ if (ptr)
+ free (ptr);
+}
+
+void
+operator delete (void *ptr) throw ()
+{
+ if (ptr)
+ free (ptr);
+}
+
+void
+operator delete[] (void *ptr) throw ()
+{
+ ::operator delete (ptr);
+}
+
+void
+operator delete[] (void *ptr, const std::nothrow_t&) throw ()
+{
+ ::operator delete (ptr);
+}
diff --git a/ld/testsuite/ld-elf/dl5.cc b/ld/testsuite/ld-elf/dl5.cc
new file mode 100644
index 0000000..cc40455
--- /dev/null
+++ b/ld/testsuite/ld-elf/dl5.cc
@@ -0,0 +1,61 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <new>
+
+int pass = 0;
+
+void *
+operator new (size_t sz, const std::nothrow_t&) throw ()
+{
+ void *p;
+ pass++;
+ p = malloc(sz);
+ return p;
+}
+
+void *
+operator new (size_t sz) throw (std::bad_alloc)
+{
+ void *p;
+ pass++;
+ p = malloc(sz);
+ return p;
+}
+
+void
+operator delete (void *ptr) throw ()
+{
+ pass++;
+ if (ptr)
+ free (ptr);
+}
+
+class A
+{
+public:
+ A() {}
+ ~A() { }
+ int a;
+ int b;
+};
+
+
+int
+main (void)
+{
+ A *bb = new A[10];
+ delete [] bb;
+ bb = new (std::nothrow) A [10];
+ delete [] bb;
+
+ if (pass == 4)
+ {
+ printf ("PASS\n");
+ return 0;
+ }
+ else
+ {
+ printf ("FAIL\n");
+ return 1;
+ }
+}
diff --git a/ld/testsuite/ld-elf/dl5.out b/ld/testsuite/ld-elf/dl5.out
new file mode 100644
index 0000000..7ef22e9
--- /dev/null
+++ b/ld/testsuite/ld-elf/dl5.out
@@ -0,0 +1 @@
+PASS
diff --git a/ld/testsuite/ld-elf/new.cc b/ld/testsuite/ld-elf/new.cc
new file mode 100644
index 0000000..b4c8882
--- /dev/null
+++ b/ld/testsuite/ld-elf/new.cc
@@ -0,0 +1,48 @@
+#include <new>
+#include <exception_defines.h>
+
+using std::bad_alloc;
+
+extern "C" void *malloc (std::size_t);
+extern "C" void abort (void);
+
+void *
+operator new (std::size_t sz, const std::nothrow_t&) throw()
+{
+ void *p;
+
+ /* malloc (0) is unpredictable; avoid it. */
+ if (sz == 0)
+ sz = 1;
+ p = (void *) malloc (sz);
+ return p;
+}
+
+void *
+operator new (std::size_t sz) throw (std::bad_alloc)
+{
+ void *p;
+
+ /* malloc (0) is unpredictable; avoid it. */
+ if (sz == 0)
+ sz = 1;
+ p = (void *) malloc (sz);
+ while (p == 0)
+ {
+ ::abort();
+ }
+
+ return p;
+}
+
+void*
+operator new[] (std::size_t sz) throw (std::bad_alloc)
+{
+ return ::operator new(sz);
+}
+
+void *
+operator new[] (std::size_t sz, const std::nothrow_t& nothrow) throw()
+{
+ return ::operator new(sz, nothrow);
+}
diff --git a/ld/testsuite/ld-elf/shared.exp b/ld/testsuite/ld-elf/shared.exp
index ff330a4..a6f9709 100644
--- a/ld/testsuite/ld-elf/shared.exp
+++ b/ld/testsuite/ld-elf/shared.exp
@@ -72,15 +72,27 @@ set build_tests {
{"Build libdl2a.so with --dynamic-list=dl2.list"
"-shared -Wl,--dynamic-list=dl2.list" "-fPIC"
{dl2.c dl2xxx.c} {} "libdl2a.so"}
+ {"Build libdl2a.so with --dynamic-list-data"
+ "-shared -Wl,--dynamic-list-data" "-fPIC"
+ {dl2.c dl2xxx.c} {} "libdl2a.so"}
{"Build libdl2b.so with --dynamic-list=dl2.list and dl2xxx.list"
"-shared -Wl,--dynamic-list=dl2.list,--dynamic-list=dl2xxx.list" "-fPIC"
{dl2.c dl2xxx.c} {} "libdl2b.so"}
+ {"Build libdl2b.so with --dynamic-list-data and dl2xxx.list"
+ "-shared -Wl,--dynamic-list-data,--dynamic-list=dl2xxx.list" "-fPIC"
+ {dl2.c dl2xxx.c} {} "libdl2b.so"}
{"Build libdl4a.so with --dynamic-list=dl4.list"
"-shared -Wl,--dynamic-list=dl4.list" "-fPIC"
{dl4.c dl4xxx.c} {} "libdl4a.so"}
+ {"Build libdl4a.so with --dynamic-list-data"
+ "-shared -Wl,--dynamic-list-data" "-fPIC"
+ {dl4.c dl4xxx.c} {} "libdl4a.so"}
{"Build libdl4b.so with --dynamic-list=dl4.list and dl4xxx.list"
"-shared -Wl,--dynamic-list=dl4.list,--dynamic-list=dl4xxx.list" "-fPIC"
{dl4.c dl4xxx.c} {} "libdl4b.so"}
+ {"Build libdl4b.so with --dynamic-list-data and dl4xxx.list"
+ "-shared -Wl,--dynamic-list-data,--dynamic-list=dl4xxx.list" "-fPIC"
+ {dl4.c dl4xxx.c} {} "libdl4b.so"}
}
set run_tests {
@@ -120,9 +132,12 @@ set run_tests {
{"Run hidden libbar.so with versioned libfoo.so"
"tmpdir/libbarhfoov.so tmpdir/libfoov.so" ""
{main.c} "hidden" "hidden.out"}
- {"Run with dlopen on libdl1.so"
+ {"Run dl1 with --dynamic-list=dl1.list and dlopen on libdl1.so"
"--dynamic-list=dl1.list -ldl" ""
{dl1main.c} "dl1" "dl1.out"}
+ {"Run dl1 with --dynamic-list-data and dlopen on libdl1.so"
+ "--dynamic-list-data -ldl" ""
+ {dl1main.c} "dl1" "dl1.out"}
{"Run with libdl2a.so"
"tmpdir/libdl2a.so" ""
{dl2main.c} "dl2a" "dl2a.out"}
@@ -156,6 +171,9 @@ set build_cxx_tests {
{"Build libdl3a.so with --dynamic-list-cpp-typeinfo"
"-shared -Wl,--dynamic-list-cpp-typeinfo" "-fPIC"
{dl3.cc} {} "libdl3c.so" "c++"}
+ {"Build libdnew.so with -Bsymbolic-functions -dynamic-list-cpp-new"
+ "-shared -Wl,-Bsymbolic-functions,--dynamic-list-cpp-new" "-fPIC"
+ {del.cc new.cc} {} "libnew.so" "c++"}
}
set run_cxx_tests {
@@ -168,6 +186,9 @@ set run_cxx_tests {
{"Run with libdl3c.so"
"tmpdir/libdl3c.so" ""
{dl3main.cc} "dl3c" "dl3a.out" "" "c++"}
+ {"Run with libnew.so"
+ "tmpdir/libnew.so" ""
+ {dl5.cc} "dl5" "dl5.out" "" "c++"}
}
run_cc_link_tests $build_cxx_tests