aboutsummaryrefslogtreecommitdiff
path: root/bfd/peicode.h
diff options
context:
space:
mode:
authorDanny Smith <dannysmith@users.sourceforge.net>2005-03-19 06:48:31 +0000
committerDanny Smith <dannysmith@users.sourceforge.net>2005-03-19 06:48:31 +0000
commitcabd4ccc81f3c5bd0fb1f40306139b2cdc45b258 (patch)
treebfc0c920bc44db47c3fa19fc7ed1b405e797fb13 /bfd/peicode.h
parentd8d7c45959665efa90e714144b33b2b555790796 (diff)
downloadgdb-cabd4ccc81f3c5bd0fb1f40306139b2cdc45b258.zip
gdb-cabd4ccc81f3c5bd0fb1f40306139b2cdc45b258.tar.gz
gdb-cabd4ccc81f3c5bd0fb1f40306139b2cdc45b258.tar.bz2
* peicode.h (pe_ILF_build_a_bfd): Strip only one prefix
character in IMPORT_NAME_UNDECORATE and IMPORT_NAME_NOPREFIX cases. Add comment.
Diffstat (limited to 'bfd/peicode.h')
-rw-r--r--bfd/peicode.h41
1 files changed, 10 insertions, 31 deletions
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);