notaz.gp2x.de
/
ia32rtools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
move some files, fix winelib build
[ia32rtools.git]
/
tools
/
mkbridge.c
diff --git
a/tools/mkbridge.c
b/tools/mkbridge.c
index
4b3a458
..
2066f02
100644
(file)
--- a/
tools/mkbridge.c
+++ b/
tools/mkbridge.c
@@
-41,10
+41,13
@@
static void out_toasm_x86(FILE *f, const char *sym_in,
must_save |= is_x86_reg_saved(pp->arg[i].reg);
}
must_save |= is_x86_reg_saved(pp->arg[i].reg);
}
- fprintf(f, ".global
_%s\n
", sym_in);
- fprintf(f, "
_%s:\n
", sym_in);
+ fprintf(f, ".global
%s%s\n", pp->is_fastcall ? "@" : "_
", sym_in);
+ fprintf(f, "
%s%s:\n", pp->is_fastcall ? "@" : "_
", sym_in);
- if (pp->argc_reg == 0) {
+ if (pp->argc_reg == 0 || pp->is_fastcall) {
+ fprintf(f, "\t# %s\n",
+ pp->is_fastcall ? "__fastcall" :
+ (pp->is_stdcall ? "__stdcall" : "__cdecl"));
fprintf(f, "\tjmp %s\n\n", sym_out);
return;
}
fprintf(f, "\tjmp %s\n\n", sym_out);
return;
}
@@
-123,15
+126,17
@@
static void out_fromasm_x86(FILE *f, const char *sym,
ret64 = strstr(pp->ret_type.name, "int64") != NULL;
ret64 = strstr(pp->ret_type.name, "int64") != NULL;
- fprintf(f, "# %s", pp->is_stdcall ? "__stdcall" : "__cdecl");
+ fprintf(f, "# %s",
+ pp->is_fastcall ? "__fastcall" :
+ (pp->is_stdcall ? "__stdcall" : "__cdecl"));
if (ret64)
fprintf(f, " ret64");
fprintf(f, "\n.global %s\n", sym);
fprintf(f, "%s:\n", sym);
if (ret64)
fprintf(f, " ret64");
fprintf(f, "\n.global %s\n", sym);
fprintf(f, "%s:\n", sym);
- if (pp->argc_reg == 0) {
- //fprintf(f, "\tjmp _%s\n\n", sym);
-
fprintf(f, "\tjmp _%s
", sym);
+ if (pp->argc_reg == 0
|| pp->is_fastcall
) {
+ fprintf(f, "\tjmp %s%s",
+
pp->is_fastcall ? "@" : "_
", sym);
if (pp->is_stdcall && pp->argc > 0)
fprintf(f, "@%d", pp->argc * 4);
fprintf(f, "\n\n");
if (pp->is_stdcall && pp->argc > 0)
fprintf(f, "@%d", pp->argc * 4);
fprintf(f, "\n\n");
@@
-230,7
+235,7
@@
int main(int argc, char *argv[])
if (p != NULL)
*p = 0;
if (p != NULL)
*p = 0;
- pp = proto_parse(fhdr, sym_noat);
+ pp = proto_parse(fhdr, sym_noat
, 0
);
if (pp == NULL)
goto out;
if (pp == NULL)
goto out;
@@
-245,7
+250,7
@@
int main(int argc, char *argv[])
if (sym[0] == 0 || sym[0] == ';' || sym[0] == '#')
continue;
if (sym[0] == 0 || sym[0] == ';' || sym[0] == '#')
continue;
- pp = proto_parse(fhdr, sym);
+ pp = proto_parse(fhdr, sym
, 0
);
if (pp == NULL)
goto out;
if (pp == NULL)
goto out;