From 40b36307e31ea3e3606a1698f35d0b9769405615 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Tue, 16 Jan 2007 14:56:32 +0000 Subject: [PATCH] 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. --- bfd/ChangeLog | 13 ++++++++ bfd/elf-bfd.h | 3 +- bfd/elflink.c | 24 +++++++++---- include/ChangeLog | 8 ++++- include/bfdlink.h | 9 ++++- ld/ChangeLog | 28 ++++++++++++++++ ld/NEWS | 5 +++ ld/ld.texinfo | 17 ++++++++++ ld/ldlang.c | 33 ++++++++++++++---- ld/ldlang.h | 1 + ld/ldmain.c | 4 ++- ld/lexsup.c | 18 ++++++++++ ld/testsuite/ChangeLog | 11 ++++++ ld/testsuite/ld-elf/del.cc | 29 ++++++++++++++++ ld/testsuite/ld-elf/dl5.cc | 61 ++++++++++++++++++++++++++++++++++ ld/testsuite/ld-elf/dl5.out | 1 + ld/testsuite/ld-elf/new.cc | 48 ++++++++++++++++++++++++++ ld/testsuite/ld-elf/shared.exp | 23 ++++++++++++- 18 files changed, 319 insertions(+), 17 deletions(-) create mode 100644 ld/testsuite/ld-elf/del.cc create mode 100644 ld/testsuite/ld-elf/dl5.cc create mode 100644 ld/testsuite/ld-elf/dl5.out create mode 100644 ld/testsuite/ld-elf/new.cc diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 3d1e0c1f88b..6b2a418ff5c 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,16 @@ +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. + 2076-01-12 H.J. Lu * Makefile.am (BFD_LIBS): Removed. diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h index e7d84e6a947..b0e902896ca 100644 --- a/bfd/elf-bfd.h +++ b/bfd/elf-bfd.h @@ -1832,7 +1832,8 @@ extern int bfd_elf_link_record_local_dynamic_symbol (struct bfd_link_info *, bfd *, long); extern void bfd_elf_link_mark_dynamic_symbol - (struct bfd_link_info *, struct elf_link_hash_entry *); + (struct bfd_link_info *, struct elf_link_hash_entry *, + Elf_Internal_Sym *); extern bfd_boolean _bfd_elf_close_and_cleanup (bfd *); diff --git a/bfd/elflink.c b/bfd/elflink.c index 10b9bcd0b13..9630709758b 100644 --- a/bfd/elflink.c +++ b/bfd/elflink.c @@ -438,14 +438,22 @@ bfd_elf_link_record_dynamic_symbol (struct bfd_link_info *info, void bfd_elf_link_mark_dynamic_symbol (struct bfd_link_info *info, - struct elf_link_hash_entry *h) + struct elf_link_hash_entry *h, + Elf_Internal_Sym *sym) { - struct bfd_elf_dynamic_list *d = info->dynamic; + struct bfd_elf_dynamic_list *d = info->dynamic_list; - if (d == NULL || info->relocatable) + /* It may be called more than once on the same H. */ + if(h->dynamic || info->relocatable) return; - if ((*d->match) (&d->head, NULL, h->root.root.string)) + if ((info->dynamic_data + && (h->type == STT_OBJECT + || (sym != NULL + && ELF_ST_TYPE (sym->st_info) == STT_OBJECT))) + || (d != NULL + && h->root.type == bfd_link_hash_new + && (*d->match) (&d->head, NULL, h->root.root.string))) h->dynamic = 1; } @@ -483,7 +491,7 @@ bfd_elf_record_link_assignment (bfd *output_bfd, if (h->root.type == bfd_link_hash_new) { - bfd_elf_link_mark_dynamic_symbol (info, h); + bfd_elf_link_mark_dynamic_symbol (info, h, NULL); h->non_elf = 0; } @@ -861,13 +869,17 @@ _bfd_elf_merge_symbol (bfd *abfd, || h->root.type == bfd_link_hash_warning) h = (struct elf_link_hash_entry *) h->root.u.i.link; + /* We have to check it for every instance since the first few may be + refereences and not all compilers emit symbol type for undefined + symbols. */ + bfd_elf_link_mark_dynamic_symbol (info, h, sym); + /* If we just created the symbol, mark it as being an ELF symbol. Other than that, there is nothing to do--there is no merge issue with a newly defined symbol--so we just return. */ if (h->root.type == bfd_link_hash_new) { - bfd_elf_link_mark_dynamic_symbol (info, h); h->non_elf = 0; return TRUE; } diff --git a/include/ChangeLog b/include/ChangeLog index 7f3966ca1f6..8a3fbb131aa 100644 --- a/include/ChangeLog +++ b/include/ChangeLog @@ -1,10 +1,16 @@ +2007-01-16 H.J. Lu + + PR ld/3831 + * bfdlink.h (bfd_link_info): Rename dynamic to dynamic_list. + Add dynamic and dynamic_data. + 2006-12-05 Michael Tautschnig Nick Clifton * ansidecl.h (ATTRIBUTE_PACKED): Define. 2006-11-30 Andrew Stubbs - J"orn Rennecke + J"orn Rennecke PR driver/29931 * libiberty.h (make_relative_prefix_ignore_links): Declare. diff --git a/include/bfdlink.h b/include/bfdlink.h index 228cab8fd97..6842243d094 100644 --- a/include/bfdlink.h +++ b/include/bfdlink.h @@ -340,6 +340,13 @@ struct bfd_link_info caching ELF symbol buffer. */ unsigned int reduce_memory_overheads: 1; + /* TRUE if all data symbols should be dynamic. */ + unsigned int dynamic_data: 1; + + /* TRUE if some symbols have to be dynamic, controlled by + --dynamic-list command line options. */ + unsigned int dynamic: 1; + /* What to do with unresolved symbols in an object file. When producing executables the default is GENERATE_ERROR. When producing shared libraries the default is IGNORE. The @@ -440,7 +447,7 @@ struct bfd_link_info bfd_vma relro_start, relro_end; /* List of symbols should be dynamic. */ - struct bfd_elf_dynamic_list *dynamic; + struct bfd_elf_dynamic_list *dynamic_list; }; /* This structures holds a set of callback functions. These are diff --git a/ld/ChangeLog b/ld/ChangeLog index d5366ec50eb..939087f5f5b 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,31 @@ +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. + 2007-01-11 Nathan Sidwell * emultempl/elf-generic.em (gdl_map_segments): Only allow header diff --git a/ld/NEWS b/ld/NEWS index 93fe589e3ca..27ce242752e 100644 --- a/ld/NEWS +++ b/ld/NEWS @@ -1,4 +1,9 @@ -*- text -*- +* ELF: Add -Bsymbolic-functions, --dynamic-list-cpp-new, which puts C++ + operator new and delete on the dynamic list, and --dynamic-list-data, + builtin list for --dynamic-list, which puts global data symbols on the + dynamic list. + * Add support for x86_64 PE+ target. * Add support for Score target. diff --git a/ld/ld.texinfo b/ld/ld.texinfo index 9e34c46999a..51d7323b6f7 100644 --- a/ld/ld.texinfo +++ b/ld/ld.texinfo @@ -1130,6 +1130,14 @@ for a program linked against a shared library to override the definition within the shared library. This option is only meaningful on ELF platforms which support shared libraries. +@kindex -Bsymbolic-functions +@item -Bsymbolic-functions +When creating a shared library, bind references to global function +symbols to the definition within the shared library, if any. +@option{-Bsymbolic-functions} is an alias for @option{--dynamic-list-data}. +This option is only meaningful on ELF platforms which support shared +libraries. + @kindex --dynamic-list=@var{dynamic-list-file} @item --dynamic-list=@var{dynamic-list-file} Specify the name of a dynamic list file to the linker. This is @@ -1143,6 +1151,15 @@ which support shared libraries. The format of the dynamic list is the same as the version node without scope and node name. See @ref{VERSION} for more information. +@kindex --dynamic-list-data +@item --dynamic-list-data +Include all global data symbols to the dynamic list. + +@kindex --dynamic-list-cpp-new +@item --dynamic-list-cpp-new +Provide the builtin dynamic list for C++ operator new and delete. It +is mainly useful for building shared libstdc++. + @kindex --dynamic-list-cpp-typeinfo @item --dynamic-list-cpp-typeinfo Provide the builtin dynamic list for C++ runtime type identification. diff --git a/ld/ldlang.c b/ld/ldlang.c index 5c5cb35cf32..030887dad62 100644 --- a/ld/ldlang.c +++ b/ld/ldlang.c @@ -5634,8 +5634,8 @@ void lang_process (void) { /* Finalize dynamic list. */ - if (link_info.dynamic) - lang_finalize_version_expr_head (&link_info.dynamic->head); + if (link_info.dynamic_list) + lang_finalize_version_expr_head (&link_info.dynamic_list->head); current_target = default_target; @@ -6945,13 +6945,13 @@ lang_add_unique (const char *name) void lang_append_dynamic_list (struct bfd_elf_version_expr *dynamic) { - if (link_info.dynamic) + if (link_info.dynamic_list) { struct bfd_elf_version_expr *tail; for (tail = dynamic; tail->next != NULL; tail = tail->next) ; - tail->next = link_info.dynamic->head.list; - link_info.dynamic->head.list = dynamic; + tail->next = link_info.dynamic_list->head.list; + link_info.dynamic_list->head.list = dynamic; } else { @@ -6960,7 +6960,7 @@ lang_append_dynamic_list (struct bfd_elf_version_expr *dynamic) d = xcalloc (1, sizeof *d); d->head.list = dynamic; d->match = lang_vers_match; - link_info.dynamic = d; + link_info.dynamic_list = d; } } @@ -6984,3 +6984,24 @@ lang_append_dynamic_list_cpp_typeinfo (void) lang_append_dynamic_list (dynamic); } + +/* Append the list of C++ operator new and delete dynamic symbols to the + existing one. */ + +void +lang_append_dynamic_list_cpp_new (void) +{ + const char * symbols [] = + { + "operator new*", + "operator delete*" + }; + struct bfd_elf_version_expr *dynamic = NULL; + unsigned int i; + + for (i = 0; i < ARRAY_SIZE (symbols); i++) + dynamic = lang_new_vers_pattern (dynamic, symbols [i], "C++", + FALSE); + + lang_append_dynamic_list (dynamic); +} diff --git a/ld/ldlang.h b/ld/ldlang.h index 08d3f30046a..0074159fc90 100644 --- a/ld/ldlang.h +++ b/ld/ldlang.h @@ -607,6 +607,7 @@ extern void lang_register_vers_node (const char *, struct bfd_elf_version_tree *, struct bfd_elf_version_deps *); extern void lang_append_dynamic_list (struct bfd_elf_version_expr *); extern void lang_append_dynamic_list_cpp_typeinfo (void); +extern void lang_append_dynamic_list_cpp_new (void); bfd_boolean unique_section_p (const asection *); extern void lang_add_unique diff --git a/ld/ldmain.c b/ld/ldmain.c index 1784b16c16a..3f696394bcd 100644 --- a/ld/ldmain.c +++ b/ld/ldmain.c @@ -318,7 +318,9 @@ main (int argc, char **argv) link_info.warn_shared_textrel = FALSE; link_info.gc_sections = FALSE; link_info.print_gc_sections = FALSE; - link_info.dynamic = NULL; + link_info.dynamic = FALSE; + link_info.dynamic_list = NULL; + link_info.dynamic_data = FALSE; link_info.reduce_memory_overheads = FALSE; config.maxpagesize = 0; diff --git a/ld/lexsup.c b/ld/lexsup.c index 347d6fc536a..4da949625da 100644 --- a/ld/lexsup.c +++ b/ld/lexsup.c @@ -108,7 +108,9 @@ enum option_values OPTION_VERSION_SCRIPT, OPTION_VERSION_EXPORTS_SECTION, OPTION_DYNAMIC_LIST, + OPTION_DYNAMIC_LIST_CPP_NEW, OPTION_DYNAMIC_LIST_CPP_TYPEINFO, + OPTION_DYNAMIC_LIST_DATA, OPTION_WARN_COMMON, OPTION_WARN_CONSTRUCTORS, OPTION_WARN_FATAL, @@ -346,6 +348,8 @@ static const struct ld_option ld_options[] = '\0', NULL, NULL, ONE_DASH }, { {"Bsymbolic", no_argument, NULL, OPTION_SYMBOLIC}, '\0', NULL, N_("Bind global references locally"), ONE_DASH }, + { {"Bsymbolic-functions", no_argument, NULL, OPTION_DYNAMIC_LIST_DATA}, + '\0', NULL, N_("Bind global function references locally"), ONE_DASH }, { {"check-sections", no_argument, NULL, OPTION_CHECK_SECTIONS}, '\0', NULL, N_("Check section addresses for overlaps (default)"), TWO_DASHES }, @@ -503,6 +507,10 @@ static const struct ld_option ld_options[] = OPTION_VERSION_EXPORTS_SECTION }, '\0', N_("SYMBOL"), N_("Take export symbols list from .exports, using\n" "\t\t\t\tSYMBOL as the version."), TWO_DASHES }, + { {"dynamic-list-data", no_argument, NULL, OPTION_DYNAMIC_LIST_DATA}, + '\0', NULL, N_("Add data symbols to dynamic list"), TWO_DASHES }, + { {"dynamic-list-cpp-new", no_argument, NULL, OPTION_DYNAMIC_LIST_CPP_NEW}, + '\0', NULL, N_("Use C++ operator new/delete dynamic list"), TWO_DASHES }, { {"dynamic-list-cpp-typeinfo", no_argument, NULL, OPTION_DYNAMIC_LIST_CPP_TYPEINFO}, '\0', NULL, N_("Use C++ typeinfo dynamic list"), TWO_DASHES }, { {"dynamic-list", required_argument, NULL, OPTION_DYNAMIC_LIST}, @@ -1244,8 +1252,17 @@ parse_args (unsigned argc, char **argv) .exports sections. */ command_line.version_exports_section = optarg; break; + case OPTION_DYNAMIC_LIST_DATA: + link_info.dynamic_data = TRUE; + link_info.dynamic = TRUE; + break; case OPTION_DYNAMIC_LIST_CPP_TYPEINFO: lang_append_dynamic_list_cpp_typeinfo (); + link_info.dynamic = TRUE; + break; + case OPTION_DYNAMIC_LIST_CPP_NEW: + lang_append_dynamic_list_cpp_new (); + link_info.dynamic = TRUE; break; case OPTION_DYNAMIC_LIST: /* This option indicates a small script that only specifies @@ -1260,6 +1277,7 @@ parse_args (unsigned argc, char **argv) parser_input = input_dynamic_list; yyparse (); } + link_info.dynamic = TRUE; break; case OPTION_WARN_COMMON: config.warn_common = TRUE; diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog index 1525b57c024..e8e31d46631 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,3 +1,14 @@ +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. + 2007-01-12 Hans-Peter Nilsson * 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 00000000000..4e2cc60d74a --- /dev/null +++ b/ld/testsuite/ld-elf/del.cc @@ -0,0 +1,29 @@ +#include + +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 00000000000..cc404553f93 --- /dev/null +++ b/ld/testsuite/ld-elf/dl5.cc @@ -0,0 +1,61 @@ +#include +#include +#include + +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 00000000000..7ef22e9a431 --- /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 00000000000..b4c888247e0 --- /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); +} diff --git a/ld/testsuite/ld-elf/shared.exp b/ld/testsuite/ld-elf/shared.exp index ff330a45002..a6f97092a46 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 -- 2.30.2