Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
de3c286a
Commit
de3c286a
authored
Nov 29, 2022
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winebuild: Call __delayLoadHelper2 to resolve delay imports also on non-PE builds.
parent
1181011c
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
21 deletions
+33
-21
delay_load.c
dlls/winecrt0/delay_load.c
+0
-11
import.c
tools/winebuild/import.c
+33
-10
No files found.
dlls/winecrt0/delay_load.c
View file @
de3c286a
...
...
@@ -44,14 +44,3 @@ FARPROC WINAPI __delayLoadHelper2( const IMAGE_DELAYLOAD_DESCRIPTOR *descr, IMAG
{
return
ResolveDelayLoadedAPI
(
image_base
(),
descr
,
NULL
,
DelayLoadFailureHook
,
addr
,
0
);
}
#ifndef __WINE_PE_BUILD
FARPROC
WINAPI
DECLSPEC_HIDDEN
__wine_spec_delay_load
(
const
IMAGE_DELAYLOAD_DESCRIPTOR
*
descr
,
unsigned
int
id
)
{
IMAGE_THUNK_DATA
*
thunk
=
(
IMAGE_THUNK_DATA
*
)((
char
*
)
image_base
()
+
descr
->
ImportAddressTableRVA
);
return
__delayLoadHelper2
(
descr
,
thunk
+
LOWORD
(
id
)
);
}
#endif
/* __WINE_PE_BUILD */
tools/winebuild/import.c
View file @
de3c286a
...
...
@@ -511,7 +511,7 @@ static void add_extra_undef_symbols( DLLSPEC *spec )
add_extra_ld_symbol
(
spec
->
init_func
);
if
(
spec
->
type
==
SPEC_WIN16
)
add_extra_ld_symbol
(
"DllMain"
);
if
(
has_stubs
(
spec
))
add_extra_ld_symbol
(
"__wine_spec_unimplemented_stub"
);
if
(
delayed_imports
.
count
)
add_extra_ld_symbol
(
"__
wine_spec_delay_load
"
);
if
(
delayed_imports
.
count
)
add_extra_ld_symbol
(
"__
delayLoadHelper2
"
);
}
/* check if a given imported dll is not needed, taking forwards into account */
...
...
@@ -1018,7 +1018,7 @@ static void output_delayed_imports( const DLLSPEC *spec )
/* output the delayed import thunks of a Win32 module */
static
void
output_delayed_import_thunks
(
const
DLLSPEC
*
spec
)
{
int
j
,
pos
;
int
j
,
pos
,
iat_pos
;
struct
import
*
import
;
static
const
char
delayed_import_loaders
[]
=
"__wine_spec_delayed_import_loaders"
;
static
const
char
delayed_import_thunks
[]
=
"__wine_spec_delayed_import_thunks"
;
...
...
@@ -1030,7 +1030,7 @@ static void output_delayed_import_thunks( const DLLSPEC *spec )
output
(
"
\t
.align %d
\n
"
,
get_alignment
(
8
)
);
output
(
"%s:
\n
"
,
asm_name
(
delayed_import_loaders
));
pos
=
0
;
pos
=
iat_pos
=
0
;
LIST_FOR_EACH_ENTRY
(
import
,
&
dll_delayed
,
struct
import
,
entry
)
{
char
*
module_func
=
strmake
(
"__wine_delay_load_asm_%s"
,
import
->
c_name
);
...
...
@@ -1060,7 +1060,7 @@ static void output_delayed_import_thunks( const DLLSPEC *spec )
output
(
"
\t
pushl $.L__wine_spec_delay_imports+%d
\n
"
,
pos
);
output_cfi
(
".cfi_adjust_cfa_offset 4"
);
}
output
(
"
\t
call %s
\n
"
,
asm_name
(
"__
wine_spec_delay_load
"
)
);
output
(
"
\t
call %s
\n
"
,
asm_name
(
"__
delayLoadHelper2
"
)
);
output_cfi
(
".cfi_adjust_cfa_offset -8"
);
output
(
"
\t
popl %%edx
\n
"
);
output_cfi
(
".cfi_adjust_cfa_offset -4"
);
...
...
@@ -1083,7 +1083,7 @@ static void output_delayed_import_thunks( const DLLSPEC *spec )
output
(
"
\t
movups %%xmm3,0x20(%%rsp)
\n
"
);
output
(
"
\t
leaq .L__wine_spec_delay_imports+%d(%%rip),%%rcx
\n
"
,
pos
);
output
(
"
\t
movq %%rax,%%rdx
\n
"
);
output
(
"
\t
call %s
\n
"
,
asm_name
(
"__
wine_spec_delay_load
"
)
);
output
(
"
\t
call %s
\n
"
,
asm_name
(
"__
delayLoadHelper2
"
)
);
output
(
"
\t
movups 0x20(%%rsp),%%xmm3
\n
"
);
output
(
"
\t
movups 0x30(%%rsp),%%xmm2
\n
"
);
output
(
"
\t
movups 0x40(%%rsp),%%xmm1
\n
"
);
...
...
@@ -1103,7 +1103,7 @@ static void output_delayed_import_thunks( const DLLSPEC *spec )
output
(
"
\t
mov r1,IP
\n
"
);
output
(
"
\t
ldr r0, 1f
\n
"
);
if
(
UsePIC
)
output
(
"2:
\t
add r0, pc
\n
"
);
output
(
"
\t
bl %s
\n
"
,
asm_name
(
"__
wine_spec_delay_load
"
)
);
output
(
"
\t
bl %s
\n
"
,
asm_name
(
"__
delayLoadHelper2
"
)
);
output
(
"
\t
mov IP,r0
\n
"
);
output
(
"
\t
pop {r0-r3,FP,LR}
\n
"
);
output
(
"
\t
bx IP
\n
"
);
...
...
@@ -1123,7 +1123,7 @@ static void output_delayed_import_thunks( const DLLSPEC *spec )
output
(
"
\t
adrp x0, %s
\n
"
,
arm64_page
(
".L__wine_spec_delay_imports"
)
);
output
(
"
\t
add x0, x0, #%s
\n
"
,
arm64_pageoff
(
".L__wine_spec_delay_imports"
)
);
if
(
pos
)
output
(
"
\t
add x0, x0, #%u
\n
"
,
pos
);
output
(
"
\t
bl %s
\n
"
,
asm_name
(
"__
wine_spec_delay_load
"
)
);
output
(
"
\t
bl %s
\n
"
,
asm_name
(
"__
delayLoadHelper2
"
)
);
output
(
"
\t
mov x16, x0
\n
"
);
output
(
"
\t
ldp x0, x1, [sp,#16]
\n
"
);
output
(
"
\t
ldp x2, x3, [sp,#32]
\n
"
);
...
...
@@ -1148,20 +1148,43 @@ static void output_delayed_import_thunks( const DLLSPEC *spec )
switch
(
target
.
cpu
)
{
case
CPU_i386
:
if
(
UsePIC
)
{
output
(
"
\t
call %s
\n
"
,
asm_name
(
"__wine_spec_get_pc_thunk_eax"
)
);
output
(
"1:
\t
leal .L__wine_delay_IAT+%d-1b(%%eax),%%eax
\n
"
,
iat_pos
);
needs_get_pc_thunk
=
1
;
}
else
output
(
"
\t
movl $.L__wine_delay_IAT+%d,%%eax
\n
"
,
iat_pos
);
output
(
"
\t
jmp %s
\n
"
,
asm_name
(
module_func
)
);
break
;
case
CPU_x86_64
:
output
(
"
\t
movl $%d,%%eax
\n
"
,
j
);
output
(
"
\t
leaq .L__wine_delay_IAT+%d(%%rip),%%rax
\n
"
,
iat_pos
);
output
(
"
\t
jmp %s
\n
"
,
asm_name
(
module_func
)
);
break
;
case
CPU_ARM
:
output
(
"
\t
mov ip, #%u
\n
"
,
j
);
if
(
UsePIC
)
{
output
(
"
\t
ldr ip, 2f
\n
"
);
output
(
"1:
\t
add ip, pc
\n
"
);
output
(
"
\t
b %s
\n
"
,
asm_name
(
module_func
)
);
output
(
"2:
\t
.long .L__wine_delay_IAT+%u-1b-%u
\n
"
,
iat_pos
,
thumb_mode
?
4
:
8
);
}
else
{
output
(
"
\t
ldr ip, 1f
\n
"
);
output
(
"
\t
b %s
\n
"
,
asm_name
(
module_func
)
);
output
(
"1:
\t
.long .L__wine_delay_IAT+%u
\n
"
,
iat_pos
);
}
break
;
case
CPU_ARM64
:
output
(
"
\t
mov x16, #0x%x
\n
"
,
j
);
output
(
"
\t
adrp x16, %s
\n
"
,
arm64_page
(
".L__wine_delay_IAT"
)
);
output
(
"
\t
add x16, x16, #%s
\n
"
,
arm64_pageoff
(
".L__wine_delay_IAT"
)
);
if
(
iat_pos
)
output
(
"
\t
add x16, x16, #%u
\n
"
,
iat_pos
);
output
(
"
\t
b %s
\n
"
,
asm_name
(
module_func
)
);
break
;
}
output_cfi
(
".cfi_endproc"
);
iat_pos
+=
get_ptr_size
();
}
pos
+=
8
*
4
;
/* IMAGE_DELAYLOAD_DESCRIPTOR is 8 DWORDs */
}
...
...
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