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
1181011c
Commit
1181011c
authored
Nov 29, 2022
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winebuild: Pass the delay import descriptor to the __wine_spec_delay_load function.
parent
a2d8e7a5
Hide 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
+1
-4
import.c
tools/winebuild/import.c
+32
-17
No files found.
dlls/winecrt0/delay_load.c
View file @
1181011c
...
@@ -47,11 +47,8 @@ FARPROC WINAPI __delayLoadHelper2( const IMAGE_DELAYLOAD_DESCRIPTOR *descr, IMAG
...
@@ -47,11 +47,8 @@ FARPROC WINAPI __delayLoadHelper2( const IMAGE_DELAYLOAD_DESCRIPTOR *descr, IMAG
#ifndef __WINE_PE_BUILD
#ifndef __WINE_PE_BUILD
extern
IMAGE_DELAYLOAD_DESCRIPTOR
__wine_spec_delay_imports
[];
FARPROC
WINAPI
DECLSPEC_HIDDEN
__wine_spec_delay_load
(
const
IMAGE_DELAYLOAD_DESCRIPTOR
*
descr
,
unsigned
int
id
)
FARPROC
WINAPI
DECLSPEC_HIDDEN
__wine_spec_delay_load
(
unsigned
int
id
)
{
{
const
IMAGE_DELAYLOAD_DESCRIPTOR
*
descr
=
__wine_spec_delay_imports
+
HIWORD
(
id
);
IMAGE_THUNK_DATA
*
thunk
=
(
IMAGE_THUNK_DATA
*
)((
char
*
)
image_base
()
+
descr
->
ImportAddressTableRVA
);
IMAGE_THUNK_DATA
*
thunk
=
(
IMAGE_THUNK_DATA
*
)((
char
*
)
image_base
()
+
descr
->
ImportAddressTableRVA
);
return
__delayLoadHelper2
(
descr
,
thunk
+
LOWORD
(
id
)
);
return
__delayLoadHelper2
(
descr
,
thunk
+
LOWORD
(
id
)
);
...
...
tools/winebuild/import.c
View file @
1181011c
...
@@ -943,7 +943,6 @@ static void output_delayed_imports( const DLLSPEC *spec )
...
@@ -943,7 +943,6 @@ static void output_delayed_imports( const DLLSPEC *spec )
output
(
"
\t
.data
\n
"
);
output
(
"
\t
.data
\n
"
);
output
(
"
\t
.align %d
\n
"
,
get_alignment
(
get_ptr_size
())
);
output
(
"
\t
.align %d
\n
"
,
get_alignment
(
get_ptr_size
())
);
output
(
".L__wine_spec_delay_imports:
\n
"
);
output
(
".L__wine_spec_delay_imports:
\n
"
);
output
(
"%s
\n
"
,
asm_globl
(
"__wine_spec_delay_imports"
)
);
/* list of dlls */
/* list of dlls */
...
@@ -1014,13 +1013,12 @@ static void output_delayed_imports( const DLLSPEC *spec )
...
@@ -1014,13 +1013,12 @@ static void output_delayed_imports( const DLLSPEC *spec )
output
(
"
\t
%s
\"
%s
\"\n
"
,
get_asm_string_keyword
(),
func
->
name
);
output
(
"
\t
%s
\"
%s
\"\n
"
,
get_asm_string_keyword
(),
func
->
name
);
}
}
}
}
output_function_size
(
"__wine_spec_delay_imports"
);
}
}
/* output the delayed import thunks of a Win32 module */
/* output the delayed import thunks of a Win32 module */
static
void
output_delayed_import_thunks
(
const
DLLSPEC
*
spec
)
static
void
output_delayed_import_thunks
(
const
DLLSPEC
*
spec
)
{
{
int
idx
,
j
,
pos
;
int
j
,
pos
;
struct
import
*
import
;
struct
import
*
import
;
static
const
char
delayed_import_loaders
[]
=
"__wine_spec_delayed_import_loaders"
;
static
const
char
delayed_import_loaders
[]
=
"__wine_spec_delayed_import_loaders"
;
static
const
char
delayed_import_thunks
[]
=
"__wine_spec_delayed_import_thunks"
;
static
const
char
delayed_import_thunks
[]
=
"__wine_spec_delayed_import_thunks"
;
...
@@ -1032,7 +1030,7 @@ static void output_delayed_import_thunks( const DLLSPEC *spec )
...
@@ -1032,7 +1030,7 @@ static void output_delayed_import_thunks( const DLLSPEC *spec )
output
(
"
\t
.align %d
\n
"
,
get_alignment
(
8
)
);
output
(
"
\t
.align %d
\n
"
,
get_alignment
(
8
)
);
output
(
"%s:
\n
"
,
asm_name
(
delayed_import_loaders
));
output
(
"%s:
\n
"
,
asm_name
(
delayed_import_loaders
));
idx
=
0
;
pos
=
0
;
LIST_FOR_EACH_ENTRY
(
import
,
&
dll_delayed
,
struct
import
,
entry
)
LIST_FOR_EACH_ENTRY
(
import
,
&
dll_delayed
,
struct
import
,
entry
)
{
{
char
*
module_func
=
strmake
(
"__wine_delay_load_asm_%s"
,
import
->
c_name
);
char
*
module_func
=
strmake
(
"__wine_delay_load_asm_%s"
,
import
->
c_name
);
...
@@ -1049,8 +1047,21 @@ static void output_delayed_import_thunks( const DLLSPEC *spec )
...
@@ -1049,8 +1047,21 @@ static void output_delayed_import_thunks( const DLLSPEC *spec )
output_cfi
(
".cfi_adjust_cfa_offset 4"
);
output_cfi
(
".cfi_adjust_cfa_offset 4"
);
output
(
"
\t
pushl %%eax
\n
"
);
output
(
"
\t
pushl %%eax
\n
"
);
output_cfi
(
".cfi_adjust_cfa_offset 4"
);
output_cfi
(
".cfi_adjust_cfa_offset 4"
);
if
(
UsePIC
)
{
output
(
"
\t
call %s
\n
"
,
asm_name
(
"__wine_spec_get_pc_thunk_eax"
)
);
output
(
"1:
\t
leal .L__wine_spec_delay_imports+%d-1b(%%eax),%%eax
\n
"
,
pos
);
output
(
"
\t
pushl %%eax
\n
"
);
output_cfi
(
".cfi_adjust_cfa_offset 4"
);
needs_get_pc_thunk
=
1
;
}
else
{
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
(
"__wine_spec_delay_load"
)
);
output_cfi
(
".cfi_adjust_cfa_offset -
4
"
);
output_cfi
(
".cfi_adjust_cfa_offset -
8
"
);
output
(
"
\t
popl %%edx
\n
"
);
output
(
"
\t
popl %%edx
\n
"
);
output_cfi
(
".cfi_adjust_cfa_offset -4"
);
output_cfi
(
".cfi_adjust_cfa_offset -4"
);
output
(
"
\t
popl %%ecx
\n
"
);
output
(
"
\t
popl %%ecx
\n
"
);
...
@@ -1070,7 +1081,8 @@ static void output_delayed_import_thunks( const DLLSPEC *spec )
...
@@ -1070,7 +1081,8 @@ static void output_delayed_import_thunks( const DLLSPEC *spec )
output
(
"
\t
movups %%xmm1,0x40(%%rsp)
\n
"
);
output
(
"
\t
movups %%xmm1,0x40(%%rsp)
\n
"
);
output
(
"
\t
movups %%xmm2,0x30(%%rsp)
\n
"
);
output
(
"
\t
movups %%xmm2,0x30(%%rsp)
\n
"
);
output
(
"
\t
movups %%xmm3,0x20(%%rsp)
\n
"
);
output
(
"
\t
movups %%xmm3,0x20(%%rsp)
\n
"
);
output
(
"
\t
movq %%rax,%%rcx
\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
(
"__wine_spec_delay_load"
)
);
output
(
"
\t
movups 0x20(%%rsp),%%xmm3
\n
"
);
output
(
"
\t
movups 0x20(%%rsp),%%xmm3
\n
"
);
output
(
"
\t
movups 0x30(%%rsp),%%xmm2
\n
"
);
output
(
"
\t
movups 0x30(%%rsp),%%xmm2
\n
"
);
...
@@ -1088,11 +1100,17 @@ static void output_delayed_import_thunks( const DLLSPEC *spec )
...
@@ -1088,11 +1100,17 @@ static void output_delayed_import_thunks( const DLLSPEC *spec )
break
;
break
;
case
CPU_ARM
:
case
CPU_ARM
:
output
(
"
\t
push {r0-r3,FP,LR}
\n
"
);
output
(
"
\t
push {r0-r3,FP,LR}
\n
"
);
output
(
"
\t
mov r0,IP
\n
"
);
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
(
"__wine_spec_delay_load"
)
);
output
(
"
\t
mov IP,r0
\n
"
);
output
(
"
\t
mov IP,r0
\n
"
);
output
(
"
\t
pop {r0-r3,FP,LR}
\n
"
);
output
(
"
\t
pop {r0-r3,FP,LR}
\n
"
);
output
(
"
\t
bx IP
\n
"
);
output
(
"
\t
bx IP
\n
"
);
if
(
UsePIC
)
output
(
"1:
\t
.long .L__wine_spec_delay_imports+%u-2b-%u
\n
"
,
pos
,
thumb_mode
?
4
:
8
);
else
output
(
"1:
\t
.long .L__wine_spec_delay_imports+%u
\n
"
,
pos
);
break
;
break
;
case
CPU_ARM64
:
case
CPU_ARM64
:
output
(
"
\t
stp x29, x30, [sp,#-80]!
\n
"
);
output
(
"
\t
stp x29, x30, [sp,#-80]!
\n
"
);
...
@@ -1101,7 +1119,10 @@ static void output_delayed_import_thunks( const DLLSPEC *spec )
...
@@ -1101,7 +1119,10 @@ static void output_delayed_import_thunks( const DLLSPEC *spec )
output
(
"
\t
stp x2, x3, [sp,#32]
\n
"
);
output
(
"
\t
stp x2, x3, [sp,#32]
\n
"
);
output
(
"
\t
stp x4, x5, [sp,#48]
\n
"
);
output
(
"
\t
stp x4, x5, [sp,#48]
\n
"
);
output
(
"
\t
stp x6, x7, [sp,#64]
\n
"
);
output
(
"
\t
stp x6, x7, [sp,#64]
\n
"
);
output
(
"
\t
mov x0, x16
\n
"
);
output
(
"
\t
mov x1, x16
\n
"
);
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
(
"__wine_spec_delay_load"
)
);
output
(
"
\t
mov x16, x0
\n
"
);
output
(
"
\t
mov x16, x0
\n
"
);
output
(
"
\t
ldp x0, x1, [sp,#16]
\n
"
);
output
(
"
\t
ldp x0, x1, [sp,#16]
\n
"
);
...
@@ -1128,27 +1149,21 @@ static void output_delayed_import_thunks( const DLLSPEC *spec )
...
@@ -1128,27 +1149,21 @@ static void output_delayed_import_thunks( const DLLSPEC *spec )
{
{
case
CPU_i386
:
case
CPU_i386
:
case
CPU_x86_64
:
case
CPU_x86_64
:
output
(
"
\t
movl $%d,%%eax
\n
"
,
(
idx
<<
16
)
|
j
);
output
(
"
\t
movl $%d,%%eax
\n
"
,
j
);
output
(
"
\t
jmp %s
\n
"
,
asm_name
(
module_func
)
);
output
(
"
\t
jmp %s
\n
"
,
asm_name
(
module_func
)
);
break
;
break
;
case
CPU_ARM
:
case
CPU_ARM
:
output
(
"
\t
mov ip, #%u
\n
"
,
j
);
output
(
"
\t
mov ip, #%u
\n
"
,
j
);
if
(
idx
)
output
(
"
\t
movt ip, #%u
\n
"
,
idx
);
output
(
"
\t
b %s
\n
"
,
asm_name
(
module_func
)
);
output
(
"
\t
b %s
\n
"
,
asm_name
(
module_func
)
);
break
;
break
;
case
CPU_ARM64
:
case
CPU_ARM64
:
if
(
idx
)
output
(
"
\t
mov x16, #0x%x
\n
"
,
j
);
{
output
(
"
\t
mov x16, #0x%x
\n
"
,
idx
<<
16
);
if
(
j
)
output
(
"
\t
movk x16, #0x%x
\n
"
,
j
);
}
else
output
(
"
\t
mov x16, #0x%x
\n
"
,
j
);
output
(
"
\t
b %s
\n
"
,
asm_name
(
module_func
)
);
output
(
"
\t
b %s
\n
"
,
asm_name
(
module_func
)
);
break
;
break
;
}
}
output_cfi
(
".cfi_endproc"
);
output_cfi
(
".cfi_endproc"
);
}
}
idx
++
;
pos
+=
8
*
4
;
/* IMAGE_DELAYLOAD_DESCRIPTOR is 8 DWORDs */
}
}
output_function_size
(
delayed_import_loaders
);
output_function_size
(
delayed_import_loaders
);
...
...
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