This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
On Monday, July 12, 2010 04:05:02 Ian Lance Taylor wrote: > Mike Frysinger writes: > > first, i'm asking what the default language is for the version script. > > i'd expect the answer to be "no language" which means the symbols would > > be matched against any random leading char a target introduces. i'm > > also OK with the answer "C language", although it does prevent working > > with symbols that lack the prefix char because they were created via > > assembly code. > > The default language is "C". I think the right thing to do in that case > is strip the leading character if present, and otherwise do nothing. > That is what bfd_demangle does. works for me > > yes, but presumably changing ldlang.c to consider that value is > > unacceptable. the current parsing code is also not given the current > > bfd, only bfd_elf_version_expr structures, and those dont contain links > > back to a bfd that i can see. unless there is a way to get the current > > "active" bfd ? then it should be easy to drop in support in > > lang_vers_match() with the function bfd_get_symbol_leading_char() you > > pointed out. > > I think it would be entirely reasonable to change lang_vers_match to > take a BFD parameter, and change the corresponding calling code in > bfd/elflink.c. Or, the output BFD is always available in > link_info.output_bfd. since the existing bfd_demangle user in this file is using link_info.output_bfd, i'm going to roll with that. how does the attached patch look ? seems to fix things with Blackfin targets, and no regressions are seen with x86_64-linux-gnu and bfin-linux-uclibc. i'll do some more system wide testing in the mean time ... -mike diff --git a/ld/ldlang.c b/ld/ldlang.c index 9c4e17b..5875ef6 100644 --- a/ld/ldlang.c +++ b/ld/ldlang.c @@ -7179,19 +7179,28 @@ lang_vers_match (struct bfd_elf_version_expr_head *head, struct bfd_elf_version_expr *prev, const char *sym) { + const char *c_sym; const char *cxx_sym = sym; const char *java_sym = sym; struct bfd_elf_version_expr *expr = NULL; + enum demangling_styles curr_style; + + curr_style = CURRENT_DEMANGLING_STYLE; + c_sym = bfd_demangle (link_info.output_bfd, sym, DMGL_NO_OPTS); + if (!c_sym) + c_sym = sym; + cplus_demangle_set_style (curr_style); if (head->mask & BFD_ELF_VERSION_CXX_TYPE) { - cxx_sym = cplus_demangle (sym, DMGL_PARAMS | DMGL_ANSI); + cxx_sym = bfd_demangle (link_info.output_bfd, sym, + DMGL_PARAMS | DMGL_ANSI); if (!cxx_sym) cxx_sym = sym; } if (head->mask & BFD_ELF_VERSION_JAVA_TYPE) { - java_sym = cplus_demangle (sym, DMGL_JAVA); + java_sym = bfd_demangle (link_info.output_bfd, sym, DMGL_JAVA); if (!java_sym) java_sym = sym; } @@ -7205,10 +7214,10 @@ lang_vers_match (struct bfd_elf_version_expr_head *head, case 0: if (head->mask & BFD_ELF_VERSION_C_TYPE) { - e.pattern = sym; + e.pattern = c_sym; expr = (struct bfd_elf_version_expr *) htab_find ((htab_t) head->htab, &e); - while (expr && strcmp (expr->pattern, sym) == 0) + while (expr && strcmp (expr->pattern, c_sym) == 0) if (expr->mask == BFD_ELF_VERSION_C_TYPE) goto out_ret; else @@ -7266,12 +7275,14 @@ lang_vers_match (struct bfd_elf_version_expr_head *head, else if (expr->mask == BFD_ELF_VERSION_CXX_TYPE) s = cxx_sym; else - s = sym; + s = c_sym; if (fnmatch (expr->pattern, s, 0) == 0) break; } out_ret: + if (c_sym != sym) + free ((char *) c_sym); if (cxx_sym != sym) free ((char *) cxx_sym); if (java_sym != sym)
Attachment:
signature.asc
Description: This is a digitally signed message part.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |