Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
84a7a7ea
Commit
84a7a7ea
authored
Feb 27, 2019
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winebuild: Add support for fastcall entry points.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
28debd82
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
39 additions
and
9 deletions
+39
-9
build.h
tools/winebuild/build.h
+4
-3
parser.c
tools/winebuild/parser.c
+24
-3
spec32.c
tools/winebuild/spec32.c
+5
-3
winebuild.man.in
tools/winebuild/winebuild.man.in
+6
-0
No files found.
tools/winebuild/build.h
View file @
84a7a7ea
...
...
@@ -173,10 +173,11 @@ struct strarray
#define FLAG_PRIVATE 0x20
/* function is private (cannot be imported) */
#define FLAG_ORDINAL 0x40
/* function should be imported by ordinal */
#define FLAG_THISCALL 0x80
/* use thiscall calling convention */
#define FLAG_FASTCALL 0x100
/* use fastcall calling convention */
#define FLAG_FORWARD 0x
1
00
/* function is a forwarded name */
#define FLAG_EXT_LINK 0x
2
00
/* function links to an external symbol */
#define FLAG_EXPORT32 0x
4
00
/* 32-bit export in 16-bit spec file */
#define FLAG_FORWARD 0x
2
00
/* function is a forwarded name */
#define FLAG_EXT_LINK 0x
4
00
/* function links to an external symbol */
#define FLAG_EXPORT32 0x
8
00
/* 32-bit export in 16-bit spec file */
#define FLAG_CPU(cpu) (0x01000 << (cpu))
#define FLAG_CPU_MASK (FLAG_CPU(CPU_LAST + 1) - FLAG_CPU(0))
...
...
tools/winebuild/parser.c
View file @
84a7a7ea
...
...
@@ -69,6 +69,7 @@ static const char * const FlagNames[] =
"private"
,
/* FLAG_PRIVATE */
"ordinal"
,
/* FLAG_ORDINAL */
"thiscall"
,
/* FLAG_THISCALL */
"fastcall"
,
/* FLAG_FASTCALL */
NULL
};
...
...
@@ -300,6 +301,24 @@ static int parse_spec_arguments( ORDDEF *odp, DLLSPEC *spec, int optional )
return
0
;
}
}
if
(
odp
->
flags
&
FLAG_FASTCALL
)
{
if
(
odp
->
type
!=
TYPE_STDCALL
)
{
error
(
"A fastcall function must use the stdcall convention
\n
"
);
return
0
;
}
if
(
!
i
||
(
odp
->
u
.
func
.
args
[
0
]
!=
ARG_PTR
&&
odp
->
u
.
func
.
args
[
0
]
!=
ARG_LONG
))
{
error
(
"First argument of a fastcall function must be a pointer or integer
\n
"
);
return
0
;
}
if
(
i
>
1
&&
odp
->
u
.
func
.
args
[
1
]
!=
ARG_PTR
&&
odp
->
u
.
func
.
args
[
1
]
!=
ARG_LONG
)
{
error
(
"Second argument of a fastcall function must be a pointer or integer
\n
"
);
return
0
;
}
}
return
1
;
}
...
...
@@ -331,7 +350,7 @@ static int parse_spec_export( ORDDEF *odp, DLLSPEC *spec )
odp
->
flags
|=
FLAG_NORELAY
;
/* no relay debug possible for varags entry point */
if
(
target_cpu
!=
CPU_x86
)
odp
->
flags
&=
~
FLAG_THISCALL
;
odp
->
flags
&=
~
(
FLAG_THISCALL
|
FLAG_FASTCALL
)
;
if
(
!
(
token
=
GetToken
(
1
)))
{
...
...
@@ -355,9 +374,10 @@ static int parse_spec_export( ORDDEF *odp, DLLSPEC *spec )
odp
->
flags
|=
FLAG_FORWARD
;
}
}
if
((
odp
->
flags
&
FLAG_THISCALL
)
&&
!
(
odp
->
flags
&
FLAG_FORWARD
))
if
((
odp
->
flags
&
(
FLAG_THISCALL
|
FLAG_FASTCALL
)
)
&&
!
(
odp
->
flags
&
FLAG_FORWARD
))
{
char
*
link_name
=
strmake
(
"__thiscall_%s"
,
odp
->
link_name
);
char
*
link_name
=
strmake
(
"__%s_%s"
,
(
odp
->
flags
&
FLAG_THISCALL
)
?
"thiscall"
:
"fastcall"
,
odp
->
link_name
);
free
(
odp
->
link_name
);
odp
->
link_name
=
link_name
;
}
...
...
@@ -513,6 +533,7 @@ static const char *parse_spec_flags( DLLSPEC *spec, ORDDEF *odp )
break
;
case
FLAG_RET64
:
case
FLAG_THISCALL
:
case
FLAG_FASTCALL
:
if
(
spec
->
type
==
SPEC_WIN16
)
error
(
"Flag '%s' is not supported in Win16
\n
"
,
FlagNames
[
i
]
);
break
;
...
...
tools/winebuild/spec32.c
View file @
84a7a7ea
...
...
@@ -128,7 +128,8 @@ static void get_arg_string( ORDDEF *odp, char str[MAX_ARGUMENTS + 1] )
break
;
}
}
if
(
odp
->
flags
&
FLAG_THISCALL
)
str
[
0
]
=
't'
;
if
(
odp
->
flags
&
(
FLAG_THISCALL
|
FLAG_FASTCALL
))
str
[
0
]
=
't'
;
if
((
odp
->
flags
&
FLAG_FASTCALL
)
&&
odp
->
u
.
func
.
nb_args
>
1
)
str
[
1
]
=
't'
;
/* append return value */
if
(
get_ptr_size
()
==
4
&&
(
odp
->
flags
&
FLAG_RET64
))
...
...
@@ -224,9 +225,10 @@ static void output_relay_debug( DLLSPEC *spec )
switch
(
target_cpu
)
{
case
CPU_x86
:
if
(
odp
->
flags
&
FLAG_THISCALL
)
/* add the this pointer
*/
if
(
odp
->
flags
&
(
FLAG_THISCALL
|
FLAG_FASTCALL
))
/* add the register arguments
*/
{
output
(
"
\t
popl %%eax
\n
"
);
if
((
odp
->
flags
&
FLAG_FASTCALL
)
&&
get_args_size
(
odp
)
>
4
)
output
(
"
\t
pushl %%edx
\n
"
);
output
(
"
\t
pushl %%ecx
\n
"
);
output
(
"
\t
pushl %%eax
\n
"
);
}
...
...
@@ -966,7 +968,7 @@ void output_def_file( DLLSPEC *spec, int include_private )
else
if
(
strcmp
(
name
,
odp
->
link_name
))
/* try to reduce output */
{
output
(
"=%s"
,
odp
->
link_name
);
if
(
!
kill_at
&&
target_cpu
==
CPU_x86
&&
!
(
odp
->
flags
&
FLAG_THISCALL
))
if
(
!
kill_at
&&
target_cpu
==
CPU_x86
&&
!
(
odp
->
flags
&
(
FLAG_THISCALL
|
FLAG_FASTCALL
)
))
output
(
"@%d"
,
at_param
);
}
break
;
...
...
tools/winebuild/winebuild.man.in
View file @
84a7a7ea
...
...
@@ -304,6 +304,12 @@ The function uses the
.I thiscall
calling convention (first parameter in %ecx register on i386).
.TP
.B -fastcall
The function uses the
.I fastcall
calling convention (first two parameters in %ecx/%edx registers on
i386).
.TP
.RE
.BI -arch= cpu\fR[\fB,\fIcpu\fR]
The entry point is only available on the specified CPU
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment