From 487b6440dad57440939fab7afdd84a218b612796 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Mon, 21 Aug 2017 13:28:06 +0930 Subject: [PATCH] Make __start/__stop symbols protected visibility They can't be hidden visibility since apparently people use dlsym to look them up. bfd/ PR ld/21964 * elf-bfd.h (SYMBOLIC_BIND): Return TRUE for __start/__stop symbols. * elflink.c (bfd_elf_define_start_stop): Rewrite. ld/ PR ld/21964 * testsuite/ld-elf/pr21562a.d: Update for changed start/stop symbols. * testsuite/ld-elf/pr21562b.d: Likewise. * testsuite/ld-elf/pr21562c.d: Likewise. * testsuite/ld-elf/pr21562d.d: Likewise. * testsuite/ld-elf/pr21562e.d: Likewise. * testsuite/ld-elf/pr21562f.d: Likewise. * testsuite/ld-elf/pr21562g.d: Likewise. * testsuite/ld-elf/pr21562h.d: Likewise. * testsuite/ld-elf/pr21562i.d: Likewise. * testsuite/ld-elf/pr21562j.d: Likewise. * testsuite/ld-elf/pr21562k.d: Likewise. * testsuite/ld-elf/pr21562l.d: Likewise. * testsuite/ld-elf/pr21562m.d: Likewise. * testsuite/ld-elf/pr21562n.d: Likewise. * testsuite/ld-elf/sizeofa.d: Likewise. * testsuite/ld-elf/sizeofb.d: Likewise. * testsuite/ld-elf/startofa.d: Likewise. * testsuite/ld-elf/startofb.d: Likewise. * testsuite/ld-gc/pr20022.d: Likewise. * testsuite/ld-gc/start.d: Likewise. * testsuite/ld-elf/pr21964-1a.c: New file. * testsuite/ld-elf/pr21964-1b.c: New file. * testsuite/ld-elf/pr21964-2a.c: New file. * testsuite/ld-elf/pr21964-2b.c: New file. * testsuite/ld-elf/shared.exp: Run PR ld/21964 tests. --- bfd/ChangeLog | 7 +++++++ bfd/elf-bfd.h | 4 +++- bfd/elflink.c | 34 +++++++++++++++++++++++----------- ld/ChangeLog | 30 ++++++++++++++++++++++++++++++ ld/testsuite/ld-elf/pr21562a.d | 2 +- ld/testsuite/ld-elf/pr21562b.d | 2 +- ld/testsuite/ld-elf/pr21562c.d | 2 +- ld/testsuite/ld-elf/pr21562d.d | 2 +- ld/testsuite/ld-elf/pr21562e.d | 2 +- ld/testsuite/ld-elf/pr21562f.d | 2 +- ld/testsuite/ld-elf/pr21562g.d | 2 +- ld/testsuite/ld-elf/pr21562h.d | 2 +- ld/testsuite/ld-elf/pr21562i.d | 2 +- ld/testsuite/ld-elf/pr21562j.d | 2 +- ld/testsuite/ld-elf/pr21562k.d | 2 +- ld/testsuite/ld-elf/pr21562l.d | 2 +- ld/testsuite/ld-elf/pr21562m.d | 2 +- ld/testsuite/ld-elf/pr21562n.d | 2 +- ld/testsuite/ld-elf/pr21964-1a.c | 11 +++++++++++ ld/testsuite/ld-elf/pr21964-1b.c | 24 ++++++++++++++++++++++++ ld/testsuite/ld-elf/pr21964-2a.c | 11 +++++++++++ ld/testsuite/ld-elf/pr21964-2b.c | 27 +++++++++++++++++++++++++++ ld/testsuite/ld-elf/shared.exp | 12 ++++++++++++ ld/testsuite/ld-elf/sizeofa.d | 2 +- ld/testsuite/ld-elf/sizeofb.d | 4 +--- ld/testsuite/ld-elf/startofa.d | 4 ++-- ld/testsuite/ld-elf/startofb.d | 4 +--- ld/testsuite/ld-gc/pr20022.d | 2 +- ld/testsuite/ld-gc/start.d | 2 +- 29 files changed, 169 insertions(+), 37 deletions(-) create mode 100644 ld/testsuite/ld-elf/pr21964-1a.c create mode 100644 ld/testsuite/ld-elf/pr21964-1b.c create mode 100644 ld/testsuite/ld-elf/pr21964-2a.c create mode 100644 ld/testsuite/ld-elf/pr21964-2b.c diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 6badc5d..15f1a3f 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,10 @@ +2017-08-21 Alan Modra + H.J. Lu + + PR ld/21964 + * elf-bfd.h (SYMBOLIC_BIND): Return TRUE for __start/__stop symbols. + * elflink.c (bfd_elf_define_start_stop): Rewrite. + 2017-08-21 Hans-Peter Nilsson PR ld/20125 diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h index 92a8e02..83958e4 100644 --- a/bfd/elf-bfd.h +++ b/bfd/elf-bfd.h @@ -2802,7 +2802,9 @@ extern asection _bfd_elf_large_com_section; library, if any. A unique symbol can never be bound locally. */ #define SYMBOLIC_BIND(INFO, H) \ (!(H)->unique_global \ - && ((INFO)->symbolic || ((INFO)->dynamic && !(H)->dynamic))) + && ((INFO)->symbolic \ + || (H)->start_stop \ + || ((INFO)->dynamic && !(H)->dynamic))) #ifdef __cplusplus } diff --git a/bfd/elflink.c b/bfd/elflink.c index f9886dc..ceacb37 100644 --- a/bfd/elflink.c +++ b/bfd/elflink.c @@ -14260,18 +14260,30 @@ struct bfd_link_hash_entry * bfd_elf_define_start_stop (struct bfd_link_info *info, const char *symbol, asection *sec) { - struct bfd_link_hash_entry *h; + struct elf_link_hash_entry *h; - h = bfd_generic_define_start_stop (info, symbol, sec); - if (h != NULL) + h = elf_link_hash_lookup (elf_hash_table (info), symbol, + FALSE, FALSE, TRUE); + if (h != NULL + && (h->root.type == bfd_link_hash_undefined + || h->root.type == bfd_link_hash_undefweak + || (h->ref_regular && !h->def_regular))) { - struct elf_link_hash_entry *eh = (struct elf_link_hash_entry *) h; - eh->start_stop = 1; - eh->u2.start_stop_section = sec; - _bfd_elf_link_hash_hide_symbol (info, eh, TRUE); - if (ELF_ST_VISIBILITY (eh->other) != STV_INTERNAL) - eh->other = ((eh->other & ~ELF_ST_VISIBILITY (-1)) - | STV_HIDDEN); + h->root.type = bfd_link_hash_defined; + h->root.u.def.section = sec; + h->root.u.def.value = 0; + h->def_regular = 1; + h->def_dynamic = 0; + h->start_stop = 1; + h->u2.start_stop_section = sec; + if (symbol[0] == '.') + { + /* .startof. and .sizeof. symbols are local. */ + _bfd_elf_link_hash_hide_symbol (info, h, TRUE); + } + else if (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT) + h->other = (h->other & ~ELF_ST_VISIBILITY (-1)) | STV_PROTECTED; + return &h->root; } - return h; + return NULL; } diff --git a/ld/ChangeLog b/ld/ChangeLog index a150256..5e2ddf4 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,33 @@ +2017-08-21 H.J. Lu + Alan Modra + + PR ld/21964 + * testsuite/ld-elf/pr21562a.d: Update for changed start/stop symbols. + * testsuite/ld-elf/pr21562b.d: Likewise. + * testsuite/ld-elf/pr21562c.d: Likewise. + * testsuite/ld-elf/pr21562d.d: Likewise. + * testsuite/ld-elf/pr21562e.d: Likewise. + * testsuite/ld-elf/pr21562f.d: Likewise. + * testsuite/ld-elf/pr21562g.d: Likewise. + * testsuite/ld-elf/pr21562h.d: Likewise. + * testsuite/ld-elf/pr21562i.d: Likewise. + * testsuite/ld-elf/pr21562j.d: Likewise. + * testsuite/ld-elf/pr21562k.d: Likewise. + * testsuite/ld-elf/pr21562l.d: Likewise. + * testsuite/ld-elf/pr21562m.d: Likewise. + * testsuite/ld-elf/pr21562n.d: Likewise. + * testsuite/ld-elf/sizeofa.d: Likewise. + * testsuite/ld-elf/sizeofb.d: Likewise. + * testsuite/ld-elf/startofa.d: Likewise. + * testsuite/ld-elf/startofb.d: Likewise. + * testsuite/ld-gc/pr20022.d: Likewise. + * testsuite/ld-gc/start.d: Likewise. + * testsuite/ld-elf/pr21964-1a.c: New file. + * testsuite/ld-elf/pr21964-1b.c: New file. + * testsuite/ld-elf/pr21964-2a.c: New file. + * testsuite/ld-elf/pr21964-2b.c: New file. + * testsuite/ld-elf/shared.exp: Run PR ld/21964 tests. + 2017-08-21 Hans-Peter Nilsson PR ld/20125 diff --git a/ld/testsuite/ld-elf/pr21562a.d b/ld/testsuite/ld-elf/pr21562a.d index ecf013f..e978734 100644 --- a/ld/testsuite/ld-elf/pr21562a.d +++ b/ld/testsuite/ld-elf/pr21562a.d @@ -8,5 +8,5 @@ #... \[[ 0-9]+\] scnfoo[ \t]+PROGBITS[ \t]+[0-9a-f]+ +[0-9a-f]+ +0*10[ \t]+.* #... - +[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +NOTYPE +LOCAL +DEFAULT +[0-9]+ +___?start_scnfoo + +[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +NOTYPE +GLOBAL +PROTECTED +[0-9]+ +___?start_scnfoo #pass diff --git a/ld/testsuite/ld-elf/pr21562b.d b/ld/testsuite/ld-elf/pr21562b.d index 063a141..f1d058a 100644 --- a/ld/testsuite/ld-elf/pr21562b.d +++ b/ld/testsuite/ld-elf/pr21562b.d @@ -8,5 +8,5 @@ #... \[[ 0-9]+\] scnfoo[ \t]+PROGBITS[ \t]+[0-9a-f]+ +[0-9a-f]+ +0*10[ \t]+.* #... - +[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +NOTYPE +LOCAL +DEFAULT +[0-9]+ +___?stop_scnfoo + +[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +NOTYPE +GLOBAL +PROTECTED +[0-9]+ +___?stop_scnfoo #pass diff --git a/ld/testsuite/ld-elf/pr21562c.d b/ld/testsuite/ld-elf/pr21562c.d index 1d72a0d..1bfbff3 100644 --- a/ld/testsuite/ld-elf/pr21562c.d +++ b/ld/testsuite/ld-elf/pr21562c.d @@ -9,5 +9,5 @@ #... \[[ 0-9]+\] scnfoo[ \t]+PROGBITS[ \t]+[0-9a-f]+ +[0-9a-f]+ +0*10[ \t]+.* #... - +[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +NOTYPE +LOCAL +DEFAULT +[0-9]+ +___?start_scnfoo + +[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +NOTYPE +GLOBAL +PROTECTED +[0-9]+ +___?start_scnfoo #pass diff --git a/ld/testsuite/ld-elf/pr21562d.d b/ld/testsuite/ld-elf/pr21562d.d index f752a24..4f8e91e 100644 --- a/ld/testsuite/ld-elf/pr21562d.d +++ b/ld/testsuite/ld-elf/pr21562d.d @@ -9,5 +9,5 @@ #... \[[ 0-9]+\] scnfoo[ \t]+PROGBITS[ \t]+[0-9a-f]+ +[0-9a-f]+ +0*10[ \t]+.* #... - +[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +NOTYPE +LOCAL +DEFAULT +[0-9]+ +___?stop_scnfoo + +[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +NOTYPE +GLOBAL +PROTECTED +[0-9]+ +___?stop_scnfoo #pass diff --git a/ld/testsuite/ld-elf/pr21562e.d b/ld/testsuite/ld-elf/pr21562e.d index 769f2f8..ee969bd 100644 --- a/ld/testsuite/ld-elf/pr21562e.d +++ b/ld/testsuite/ld-elf/pr21562e.d @@ -6,5 +6,5 @@ #... \[[ 0-9]+\] scnfoo[ \t]+PROGBITS[ \t]+[0-9a-f]+ +[0-9a-f]+ +0*10[ \t]+.* #... - +[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +NOTYPE +LOCAL +DEFAULT +[0-9]+ +___?start_scnfoo + +[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +NOTYPE +GLOBAL +PROTECTED +[0-9]+ +___?start_scnfoo #pass diff --git a/ld/testsuite/ld-elf/pr21562f.d b/ld/testsuite/ld-elf/pr21562f.d index cb81c2a..119f43e 100644 --- a/ld/testsuite/ld-elf/pr21562f.d +++ b/ld/testsuite/ld-elf/pr21562f.d @@ -6,5 +6,5 @@ #... \[[ 0-9]+\] scnfoo[ \t]+PROGBITS[ \t]+[0-9a-f]+ +[0-9a-f]+ +0*10[ \t]+.* #... - +[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +NOTYPE +LOCAL +DEFAULT +[0-9]+ +___?stop_scnfoo + +[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +NOTYPE +GLOBAL +PROTECTED +[0-9]+ +___?stop_scnfoo #pass diff --git a/ld/testsuite/ld-elf/pr21562g.d b/ld/testsuite/ld-elf/pr21562g.d index 9926416..f3d2a31 100644 --- a/ld/testsuite/ld-elf/pr21562g.d +++ b/ld/testsuite/ld-elf/pr21562g.d @@ -6,5 +6,5 @@ #... \[[ 0-9]+\] scnfoo[ \t]+PROGBITS[ \t]+[0-9a-f]+ +[0-9a-f]+ +0*10[ \t]+.* #... - +[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +NOTYPE +LOCAL +DEFAULT +[0-9]+ +___?start_scnfoo + +[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +NOTYPE +GLOBAL +PROTECTED +[0-9]+ +___?start_scnfoo #pass diff --git a/ld/testsuite/ld-elf/pr21562h.d b/ld/testsuite/ld-elf/pr21562h.d index 1e723ba..0517aec 100644 --- a/ld/testsuite/ld-elf/pr21562h.d +++ b/ld/testsuite/ld-elf/pr21562h.d @@ -6,5 +6,5 @@ #... \[[ 0-9]+\] scnfoo[ \t]+PROGBITS[ \t]+[0-9a-f]+ +[0-9a-f]+ +0*10[ \t]+.* #... - +[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +NOTYPE +LOCAL +DEFAULT +[0-9]+ +___?stop_scnfoo + +[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +NOTYPE +GLOBAL +PROTECTED +[0-9]+ +___?stop_scnfoo #pass diff --git a/ld/testsuite/ld-elf/pr21562i.d b/ld/testsuite/ld-elf/pr21562i.d index f5b59c5..8baa583 100644 --- a/ld/testsuite/ld-elf/pr21562i.d +++ b/ld/testsuite/ld-elf/pr21562i.d @@ -9,5 +9,5 @@ #... \[[ 0-9]+\] scnfoo[ \t]+PROGBITS[ \t]+[0-9a-f]+ +[0-9a-f]+ +0*10[ \t]+.* #... - +[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +NOTYPE +LOCAL +DEFAULT +[0-9]+ +___?start_scnfoo + +[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +NOTYPE +GLOBAL +PROTECTED +[0-9]+ +___?start_scnfoo #pass diff --git a/ld/testsuite/ld-elf/pr21562j.d b/ld/testsuite/ld-elf/pr21562j.d index 70e311e..99d987c 100644 --- a/ld/testsuite/ld-elf/pr21562j.d +++ b/ld/testsuite/ld-elf/pr21562j.d @@ -9,5 +9,5 @@ #... \[[ 0-9]+\] scnfoo[ \t]+PROGBITS[ \t]+[0-9a-f]+ +[0-9a-f]+ +0*10[ \t]+.* #... - +[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +NOTYPE +LOCAL +DEFAULT +[0-9]+ +___?stop_scnfoo + +[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +NOTYPE +GLOBAL +PROTECTED +[0-9]+ +___?stop_scnfoo #pass diff --git a/ld/testsuite/ld-elf/pr21562k.d b/ld/testsuite/ld-elf/pr21562k.d index 4c62eb7..6aa8334 100644 --- a/ld/testsuite/ld-elf/pr21562k.d +++ b/ld/testsuite/ld-elf/pr21562k.d @@ -9,5 +9,5 @@ #... \[[ 0-9]+\] \.foo[ \t]+PROGBITS[ \t]+[0-9a-f]+ +[0-9a-f]+ +0*10[ \t]+.* #... - +[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +NOTYPE +LOCAL +DEFAULT +[0-9]+ +___?start_scnfoo + +[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +NOTYPE +GLOBAL +PROTECTED +[0-9]+ +___?start_scnfoo #pass diff --git a/ld/testsuite/ld-elf/pr21562l.d b/ld/testsuite/ld-elf/pr21562l.d index b0ba90d..82bab1e 100644 --- a/ld/testsuite/ld-elf/pr21562l.d +++ b/ld/testsuite/ld-elf/pr21562l.d @@ -9,5 +9,5 @@ #... \[[ 0-9]+\] \.foo[ \t]+PROGBITS[ \t]+[0-9a-f]+ +[0-9a-f]+ +0*10[ \t]+.* #... - +[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +NOTYPE +LOCAL +DEFAULT +[0-9]+ +___?stop_scnfoo + +[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +NOTYPE +GLOBAL +PROTECTED +[0-9]+ +___?stop_scnfoo #pass diff --git a/ld/testsuite/ld-elf/pr21562m.d b/ld/testsuite/ld-elf/pr21562m.d index fbcf76f..e1ad876 100644 --- a/ld/testsuite/ld-elf/pr21562m.d +++ b/ld/testsuite/ld-elf/pr21562m.d @@ -9,5 +9,5 @@ #... \[[ 0-9]+\] \.foo[ \t]+PROGBITS[ \t]+[0-9a-f]+ +[0-9a-f]+ +0*10[ \t]+.* #... - +[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +NOTYPE +LOCAL +DEFAULT +[0-9]+ +___?start_scnfoo + +[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +NOTYPE +GLOBAL +PROTECTED +[0-9]+ +___?start_scnfoo #pass diff --git a/ld/testsuite/ld-elf/pr21562n.d b/ld/testsuite/ld-elf/pr21562n.d index 2453169..583c771 100644 --- a/ld/testsuite/ld-elf/pr21562n.d +++ b/ld/testsuite/ld-elf/pr21562n.d @@ -9,5 +9,5 @@ #... \[[ 0-9]+\] \.foo[ \t]+PROGBITS[ \t]+[0-9a-f]+ +[0-9a-f]+ +0*10[ \t]+.* #... - +[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +NOTYPE +LOCAL +DEFAULT +[0-9]+ +___?stop_scnfoo + +[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +NOTYPE +GLOBAL +PROTECTED +[0-9]+ +___?stop_scnfoo #pass diff --git a/ld/testsuite/ld-elf/pr21964-1a.c b/ld/testsuite/ld-elf/pr21964-1a.c new file mode 100644 index 0000000..f2eae53 --- /dev/null +++ b/ld/testsuite/ld-elf/pr21964-1a.c @@ -0,0 +1,11 @@ +extern int __start___verbose[]; +extern int __stop___verbose[]; +int foo (void) +{ + static int my_var __attribute__((used, section("__verbose"))) = 5; + if (__start___verbose == __stop___verbose + || __start___verbose[0] != 5) + return -1; + else + return 0; +} diff --git a/ld/testsuite/ld-elf/pr21964-1b.c b/ld/testsuite/ld-elf/pr21964-1b.c new file mode 100644 index 0000000..440c937 --- /dev/null +++ b/ld/testsuite/ld-elf/pr21964-1b.c @@ -0,0 +1,24 @@ +#include + +extern int foo (void); + +extern int __start___verbose[]; +extern int __stop___verbose[]; +static int my_var __attribute__((used, section("__verbose"))) = 6; +int bar (void) +{ + if (__start___verbose == __stop___verbose) + return -1; + + if (__start___verbose[0] != 6) + return -2; + else + return 0; +} + +int main() +{ + if (bar () == 0 && foo () == 0) + printf ("PASS\n"); + return 0; +} diff --git a/ld/testsuite/ld-elf/pr21964-2a.c b/ld/testsuite/ld-elf/pr21964-2a.c new file mode 100644 index 0000000..617ce75 --- /dev/null +++ b/ld/testsuite/ld-elf/pr21964-2a.c @@ -0,0 +1,11 @@ +extern int __start___verbose[]; +extern int __stop___verbose[]; +int foo (void) +{ + static int my_var __attribute__((used, section("__verbose"))) = 5; + if (__start___verbose == __stop___verbose + && __start___verbose[0] != 5) + return -1; + else + return 0; +} diff --git a/ld/testsuite/ld-elf/pr21964-2b.c b/ld/testsuite/ld-elf/pr21964-2b.c new file mode 100644 index 0000000..5f638a3 --- /dev/null +++ b/ld/testsuite/ld-elf/pr21964-2b.c @@ -0,0 +1,27 @@ +#include +#include + +int main() +{ + void *dl; + void *sym; + int (*func) (void); + + dl = dlopen("pr21964-2.so", RTLD_LAZY); + if (!dl) + return 1; + + sym = dlsym(dl, "__start___verbose"); + if (!sym) + return 2; + + func = dlsym(dl, "foo"); + if (!func) + return 3; + if (func () == 0) + printf ("PASS\n"); + + dlclose(dl); + + return 0; +} diff --git a/ld/testsuite/ld-elf/shared.exp b/ld/testsuite/ld-elf/shared.exp index 8b139ec..0802fa2 100644 --- a/ld/testsuite/ld-elf/shared.exp +++ b/ld/testsuite/ld-elf/shared.exp @@ -423,6 +423,12 @@ set build_tests { {"Build libpr19073.so" "-shared -Wl,--version-script=pr19073.map tmpdir/pr19073a.o" "-fPIC" {dummy.c} {{readelf {--dyn-syms --wide} pr19073.rd}} "libpr19073.so"} + {"Build pr21964-1.so" + "-shared" "-fPIC" + {pr21964-1a.c} {} "pr21964-1.so"} + {"Build pr21964-2.so" + "-shared" "-fPIC" + {pr21964-2a.c} {} "pr21964-2.so"} } run_cc_link_tests $build_tests @@ -540,6 +546,9 @@ set run_tests [list \ [list "Run pr18458" \ "-Wl,--no-as-needed,-z,now tmpdir/libpr18458a.so tmpdir/libpr18458b.so" "" \ {pr18458c.c} "pr18458" "pass.out" ] \ + [list "Run pr21964-1" \ + "-Wl,--no-as-needed,-rpath,tmpdir tmpdir/pr21964-1.so" "" \ + {pr21964-1b.c} "pr21964-1" "pass.out" ] \ ] # NetBSD ELF systems do not currently support the .*_array sections. @@ -586,6 +595,9 @@ set dlopen_run_tests [list \ [list "Run dl6d1 with --dynamic-list-data and dlopen on libdl6d.so" \ "-Wl,--no-as-needed,--dynamic-list-data $extralibs" "" \ {dl6dmain.c} "dl6d1" "dl6b.out" ] \ + [list "Run pr21964-2" \ + "-Wl,--no-as-needed,-rpath,tmpdir $extralibs" "" \ + {pr21964-2b.c} "pr21964-2" "pass.out" ] \ ] # Only run them when libdl is available. diff --git a/ld/testsuite/ld-elf/sizeofa.d b/ld/testsuite/ld-elf/sizeofa.d index 572ffbd..3eaa4e5 100644 --- a/ld/testsuite/ld-elf/sizeofa.d +++ b/ld/testsuite/ld-elf/sizeofa.d @@ -6,7 +6,7 @@ Symbol table '\.symtab' contains [0-9]+ entries: +Num: +Value +Size Type +Bind +Vis +Ndx Name +0: 0+ +0 +NOTYPE +LOCAL +DEFAULT +UND + #... - +[0-9]+: +[a-f0-9]+ +0 +(NOTYPE|OBJECT) +(LOC|GLOB)AL +DEFAULT +[0-9]+ +___?stop_scnfoo + +[0-9]+: +[a-f0-9]+ +0 +(NOTYPE|OBJECT) +GLOBAL +(PROTECTED|DEFAULT) +[0-9]+ +___?stop_scnfoo #... +[0-9]+: +[a-f0-9]+ +0 +(NOTYPE|OBJECT) +GLOBAL +DEFAULT +UND +.sizeof.scnfoo #pass diff --git a/ld/testsuite/ld-elf/sizeofb.d b/ld/testsuite/ld-elf/sizeofb.d index ac4a6a4..c7d4edd 100644 --- a/ld/testsuite/ld-elf/sizeofb.d +++ b/ld/testsuite/ld-elf/sizeofb.d @@ -7,7 +7,5 @@ Symbol table '\.dynsym' contains [0-9]+ entries: +Num: +Value +Size Type +Bind +Vis +Ndx Name +0: 0+ +0 +NOTYPE +LOCAL +DEFAULT +UND + #... - +[0-9]+: +[a-f0-9]+ +0 +NOTYPE +LOCAL +DEFAULT +[0-9]+ +___?stop_scnfoo -#... - +[0-9]+: 0+10 + +0 +NOTYPE +LOCAL +DEFAULT +ABS +.sizeof.scnfoo + +[0-9]+: +[a-f0-9]+ +0 +NOTYPE +GLOBAL +PROTECTED +[0-9]+ +___?stop_scnfoo #pass diff --git a/ld/testsuite/ld-elf/startofa.d b/ld/testsuite/ld-elf/startofa.d index 07d5dda..6a4460f 100644 --- a/ld/testsuite/ld-elf/startofa.d +++ b/ld/testsuite/ld-elf/startofa.d @@ -6,7 +6,7 @@ Symbol table '\.symtab' contains [0-9]+ entries: +Num: +Value +Size Type +Bind +Vis +Ndx Name +0: 0+ +0 +NOTYPE +LOCAL +DEFAULT +UND + #... - +[0-9]+: +[a-f0-9]+ +0 +(NOTYPE|OBJECT) +(LOCAL +DEFAULT +[0-9]+ +___?start_scnfoo|GLOBAL +DEFAULT +UND +.startof.scnfoo) + +[0-9]+: +[a-f0-9]+ +0 +(NOTYPE|OBJECT) +GLOBAL +DEFAULT +UND +.startof.scnfoo #... - +[0-9]+: +[a-f0-9]+ +0 +(NOTYPE|OBJECT) +GLOBAL +DEFAULT +(UND +.startof.scnfoo|[0-9]+ +___?start_scnfoo) + +[0-9]+: +[a-f0-9]+ +0 +(NOTYPE|OBJECT) +GLOBAL +(PROTECTED|DEFAULT) +[0-9]+ +___?start_scnfoo #pass diff --git a/ld/testsuite/ld-elf/startofb.d b/ld/testsuite/ld-elf/startofb.d index 5d659bb..b0cf563 100644 --- a/ld/testsuite/ld-elf/startofb.d +++ b/ld/testsuite/ld-elf/startofb.d @@ -7,7 +7,5 @@ Symbol table '\.dynsym' contains [0-9]+ entries: +Num: +Value +Size Type +Bind +Vis +Ndx Name +0: 0+ +0 +NOTYPE +LOCAL +DEFAULT +UND + #... - +[0-9]+: +[a-f0-9]+ +0 +NOTYPE +LOCAL +DEFAULT +[0-9]+ +.startof.scnfoo -#... - +[0-9]+: +[a-f0-9]+ +0 +NOTYPE +LOCAL +DEFAULT +[0-9]+ +___?start_scnfoo + +[0-9]+: +[a-f0-9]+ +0 +NOTYPE +GLOBAL +PROTECTED +[0-9]+ +___?start_scnfoo #pass diff --git a/ld/testsuite/ld-gc/pr20022.d b/ld/testsuite/ld-gc/pr20022.d index 906f73d..40473c2 100644 --- a/ld/testsuite/ld-gc/pr20022.d +++ b/ld/testsuite/ld-gc/pr20022.d @@ -9,5 +9,5 @@ #... \[[ 0-9]+\] _foo[ \t]+PROGBITS[ \t]+[0-9a-f]+ +[0-9a-f]+ +[0-9a-f]+[ \t]+.* #... - +[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +NOTYPE +LOCAL +DEFAULT +[0-9]+ +__start__foo + +[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +NOTYPE +GLOBAL +PROTECTED +[0-9]+ +__start__foo #pass diff --git a/ld/testsuite/ld-gc/start.d b/ld/testsuite/ld-gc/start.d index 9113b48..18e74c1 100644 --- a/ld/testsuite/ld-gc/start.d +++ b/ld/testsuite/ld-gc/start.d @@ -5,5 +5,5 @@ #notarget: *-*-*aout *-*-*oldld frv-*-linux* metag-*-linux* #... -[0-9a-f]+ d +__start__foo +[0-9a-f]+ D +__start__foo #... -- 2.7.4