diff options
-rw-r--r-- | bfd/ChangeLog | 7 | ||||
-rw-r--r-- | bfd/peicode.h | 41 |
2 files changed, 17 insertions, 31 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index de6b496..f528566 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,10 @@ +2005-03-19 Danny Smith <dannysmith@users.sourceforge.net> + Ross Ridge <rridge@csclub.uwaterloo.ca> + + * peicode.h (pe_ILF_build_a_bfd): Strip only one prefix + character in IMPORT_NAME_UNDECORATE and IMPORT_NAME_NOPREFIX + cases. Add comment. + 2005-03-18 H.J. Lu <hongjiu.lu@intel.com> * elflink.c (elf_mark_used_section): Remove check for special diff --git a/bfd/peicode.h b/bfd/peicode.h index 7d5f361..fc9e4d6 100644 --- a/bfd/peicode.h +++ b/bfd/peicode.h @@ -875,39 +875,18 @@ pe_ILF_build_a_bfd (bfd * abfd, /* If necessary, trim the import symbol name. */ symbol = symbol_name; + /* As used by MS compiler, '_', '@', and '?' are alternative + forms of USER_LABEL_PREFIX, with '?' for c++ mangled names, + '@' used for fastcall (in C), '_' everywhere else. Only one + of these is used for a symbol. We strip this leading char for + IMPORT_NAME_NOPREFIX and IMPORT_NAME_UNDECORATE as per the + PE COFF 6.0 spec (section 8.3, Import Name Type). */ + if (import_name_type != IMPORT_NAME) { - bfd_boolean skipped_leading_underscore = FALSE; - bfd_boolean skipped_leading_at = FALSE; - bfd_boolean skipped_leading_question_mark = FALSE; - bfd_boolean check_again; - - /* Skip any prefix in symbol_name. */ - -- symbol; - do - { - check_again = FALSE; - ++ symbol; - - switch (*symbol) - { - case '@': - if (! skipped_leading_at) - check_again = skipped_leading_at = TRUE; - break; - case '?': - if (! skipped_leading_question_mark) - check_again = skipped_leading_question_mark = TRUE; - break; - case '_': - if (! skipped_leading_underscore) - check_again = skipped_leading_underscore = TRUE; - break; - default: - break; - } - } - while (check_again); + char c = symbol[0]; + if (c == '_' || c == '@' || c == '?') + symbol++; } len = strlen (symbol); |