From 40b36307e31ea3e3606a1698f35d0b9769405615 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Tue, 16 Jan 2007 14:56:32 +0000 Subject: bfd/ 2007-01-16 H.J. Lu 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 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 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 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. --- ld/testsuite/ld-elf/new.cc | 48 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 ld/testsuite/ld-elf/new.cc (limited to 'ld/testsuite/ld-elf/new.cc') 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 +#include + +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); +} -- cgit v1.1