Commit 32433112 authored by Alexandre Julliard's avatar Alexandre Julliard

winebuild: Add a -ordinal flag for entry points that must be imported by ordinal…

winebuild: Add a -ordinal flag for entry points that must be imported by ordinal but exported by name.
parent 8170acfc
...@@ -124,15 +124,16 @@ extern enum target_platform target_platform; ...@@ -124,15 +124,16 @@ extern enum target_platform target_platform;
/* entry point flags */ /* entry point flags */
#define FLAG_NORELAY 0x01 /* don't use relay debugging for this function */ #define FLAG_NORELAY 0x01 /* don't use relay debugging for this function */
#define FLAG_NONAME 0x02 /* don't import function by name */ #define FLAG_NONAME 0x02 /* don't export function by name */
#define FLAG_RET16 0x04 /* function returns a 16-bit value */ #define FLAG_RET16 0x04 /* function returns a 16-bit value */
#define FLAG_RET64 0x08 /* function returns a 64-bit value */ #define FLAG_RET64 0x08 /* function returns a 64-bit value */
#define FLAG_I386 0x10 /* function is i386 only */ #define FLAG_I386 0x10 /* function is i386 only */
#define FLAG_REGISTER 0x20 /* use register calling convention */ #define FLAG_REGISTER 0x20 /* use register calling convention */
#define FLAG_PRIVATE 0x40 /* function is private (cannot be imported) */ #define FLAG_PRIVATE 0x40 /* function is private (cannot be imported) */
#define FLAG_ORDINAL 0x80 /* function should be imported by ordinal */
#define FLAG_FORWARD 0x80 /* function is a forwarded name */ #define FLAG_FORWARD 0x100 /* function is a forwarded name */
#define FLAG_EXT_LINK 0x100 /* function links to an external symbol */ #define FLAG_EXT_LINK 0x200 /* function links to an external symbol */
#define MAX_ORDINALS 65535 #define MAX_ORDINALS 65535
......
...@@ -70,6 +70,7 @@ static const char * const FlagNames[] = ...@@ -70,6 +70,7 @@ static const char * const FlagNames[] =
"i386", /* FLAG_I386 */ "i386", /* FLAG_I386 */
"register", /* FLAG_REGISTER */ "register", /* FLAG_REGISTER */
"private", /* FLAG_PRIVATE */ "private", /* FLAG_PRIVATE */
"ordinal", /* FLAG_ORDINAL */
NULL NULL
}; };
...@@ -545,11 +546,14 @@ static int parse_spec_ordinal( int ordinal, DLLSPEC *spec ) ...@@ -545,11 +546,14 @@ static int parse_spec_ordinal( int ordinal, DLLSPEC *spec )
} }
} }
if (!strcmp( odp->name, "@" ) || odp->flags & FLAG_NONAME) if (!strcmp( odp->name, "@" ) || odp->flags & (FLAG_NONAME | FLAG_ORDINAL))
{ {
if (ordinal == -1) if (ordinal == -1)
{ {
error( "Nameless function needs an explicit ordinal number\n" ); if (!strcmp( odp->name, "@" ))
error( "Nameless function needs an explicit ordinal number\n" );
else
error( "Function imported by ordinal needs an explicit ordinal number\n" );
goto error; goto error;
} }
if (spec->type != SPEC_WIN32) if (spec->type != SPEC_WIN32)
...@@ -557,9 +561,16 @@ static int parse_spec_ordinal( int ordinal, DLLSPEC *spec ) ...@@ -557,9 +561,16 @@ static int parse_spec_ordinal( int ordinal, DLLSPEC *spec )
error( "Nameless functions not supported for Win16\n" ); error( "Nameless functions not supported for Win16\n" );
goto error; goto error;
} }
if (!strcmp( odp->name, "@" )) free( odp->name ); if (!strcmp( odp->name, "@" ))
else odp->export_name = odp->name; {
odp->name = NULL; free( odp->name );
odp->name = NULL;
}
else if (!(odp->flags & FLAG_ORDINAL)) /* -ordinal only affects the import library */
{
odp->export_name = odp->name;
odp->name = NULL;
}
} }
return 1; return 1;
......
...@@ -552,7 +552,7 @@ void BuildDef32File( DLLSPEC *spec ) ...@@ -552,7 +552,7 @@ void BuildDef32File( DLLSPEC *spec )
assert(0); assert(0);
} }
output( " @%d", odp->ordinal ); output( " @%d", odp->ordinal );
if (!odp->name) output( " NONAME" ); if (!odp->name || (odp->flags & FLAG_ORDINAL)) output( " NONAME" );
if (is_data) output( " DATA" ); if (is_data) output( " DATA" );
if (odp->flags & FLAG_PRIVATE) output( " PRIVATE" ); if (odp->flags & FLAG_PRIVATE) output( " PRIVATE" );
output( "\n" ); output( "\n" );
......
...@@ -260,7 +260,8 @@ The entry point is not displayed in relay debugging traces (Win32 ...@@ -260,7 +260,8 @@ The entry point is not displayed in relay debugging traces (Win32
only). only).
.TP .TP
.B -noname .B -noname
The entry point will be imported by ordinal instead of by name. The entry point will be exported by ordinal instead of by name. The
name is still available for importing.
.TP .TP
.B -ret16 .B -ret16
The function returns a 16-bit value (Win16 only). The function returns a 16-bit value (Win16 only).
...@@ -277,6 +278,10 @@ The function uses CPU register to pass arguments. ...@@ -277,6 +278,10 @@ The function uses CPU register to pass arguments.
.B -private .B -private
The function cannot be imported from other dlls, it can only be The function cannot be imported from other dlls, it can only be
accessed through GetProcAddress. accessed through GetProcAddress.
.TP
.B -ordinal
The entry point will be imported by ordinal instead of by name. The
name is still exported.
.SS "Function ordinals" .SS "Function ordinals"
Syntax: Syntax:
.br .br
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment