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
e550e8a1
Commit
e550e8a1
authored
Apr 11, 2010
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winebuild: Add a wrapper function to output cfi directives.
parent
11f10c6f
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
61 additions
and
47 deletions
+61
-47
build.h
tools/winebuild/build.h
+2
-0
import.c
tools/winebuild/import.c
+11
-11
relay.c
tools/winebuild/relay.c
+36
-36
utils.c
tools/winebuild/utils.c
+12
-0
No files found.
tools/winebuild/build.h
View file @
e550e8a1
...
...
@@ -209,6 +209,8 @@ extern void warning( const char *msg, ... )
__attribute__
((
__format__
(
__printf__
,
1
,
2
)));
extern
int
output
(
const
char
*
format
,
...
)
__attribute__
((
__format__
(
__printf__
,
1
,
2
)));
extern
void
output_cfi
(
const
char
*
format
,
...
)
__attribute__
((
__format__
(
__printf__
,
1
,
2
)));
extern
char
*
find_tool
(
const
char
*
name
,
const
char
*
const
*
names
);
extern
const
char
*
get_as_command
(
void
);
extern
const
char
*
get_ld_command
(
void
);
...
...
tools/winebuild/import.c
View file @
e550e8a1
...
...
@@ -672,9 +672,9 @@ static void output_import_thunk( const char *name, const char *table, int pos )
}
break
;
case
CPU_x86_64
:
output
(
"
\t
.cfi_startproc
\n
"
);
output
_cfi
(
".cfi_startproc
"
);
output
(
"
\t
jmpq *%s+%d(%%rip)
\n
"
,
table
,
pos
);
output
(
"
\t
.cfi_endproc
\n
"
);
output
_cfi
(
".cfi_endproc
"
);
break
;
case
CPU_SPARC
:
if
(
!
UsePIC
)
...
...
@@ -980,9 +980,9 @@ static void output_delayed_import_thunks( const DLLSPEC *spec )
output
(
"
\t
jmp *%%eax
\n
"
);
break
;
case
CPU_x86_64
:
output
(
"
\t
.cfi_startproc
\n
"
);
output
_cfi
(
".cfi_startproc
"
);
output
(
"
\t
subq $88,%%rsp
\n
"
);
output
(
"
\t
.cfi_adjust_cfa_offset 88
\n
"
);
output
_cfi
(
".cfi_adjust_cfa_offset 88
"
);
output
(
"
\t
movq %%rdx,80(%%rsp)
\n
"
);
output
(
"
\t
movq %%rcx,72(%%rsp)
\n
"
);
output
(
"
\t
movq %%r8,64(%%rsp)
\n
"
);
...
...
@@ -998,9 +998,9 @@ static void output_delayed_import_thunks( const DLLSPEC *spec )
output
(
"
\t
movq 72(%%rsp),%%rcx
\n
"
);
output
(
"
\t
movq 80(%%rsp),%%rdx
\n
"
);
output
(
"
\t
addq $88,%%rsp
\n
"
);
output
(
"
\t
.cfi_adjust_cfa_offset -88
\n
"
);
output
_cfi
(
".cfi_adjust_cfa_offset -88
"
);
output
(
"
\t
jmp *%%rax
\n
"
);
output
(
"
\t
.cfi_endproc
\n
"
);
output
_cfi
(
".cfi_endproc
"
);
break
;
case
CPU_SPARC
:
output
(
"
\t
save %%sp, -96, %%sp
\n
"
);
...
...
@@ -1087,10 +1087,10 @@ static void output_delayed_import_thunks( const DLLSPEC *spec )
output
(
"
\t
jmp %s
\n
"
,
asm_name
(
"__wine_delay_load_asm"
)
);
break
;
case
CPU_x86_64
:
output
(
"
\t
.cfi_startproc
\n
"
);
output
_cfi
(
".cfi_startproc
"
);
output
(
"
\t
movq $%d,%%rax
\n
"
,
(
idx
<<
16
)
|
j
);
output
(
"
\t
jmp %s
\n
"
,
asm_name
(
"__wine_delay_load_asm"
)
);
output
(
"
\t
.cfi_endproc
\n
"
);
output
_cfi
(
".cfi_endproc
"
);
break
;
case
CPU_SPARC
:
output
(
"
\t
set %d, %%g1
\n
"
,
(
idx
<<
16
)
|
j
);
...
...
@@ -1259,9 +1259,9 @@ void output_stubs( DLLSPEC *spec )
output
(
"
\t
call %s
\n
"
,
asm_name
(
"__wine_spec_unimplemented_stub"
)
);
break
;
case
CPU_x86_64
:
output
(
"
\t
.cfi_startproc
\n
"
);
output
_cfi
(
".cfi_startproc
"
);
output
(
"
\t
subq $8,%%rsp
\n
"
);
output
(
"
\t
.cfi_adjust_cfa_offset 8
\n
"
);
output
_cfi
(
".cfi_adjust_cfa_offset 8
"
);
output
(
"
\t
leaq .L__wine_spec_file_name(%%rip),%%rdi
\n
"
);
if
(
exp_name
)
{
...
...
@@ -1271,7 +1271,7 @@ void output_stubs( DLLSPEC *spec )
else
output
(
"
\t
movq $%d,%%rsi
\n
"
,
odp
->
ordinal
);
output
(
"
\t
call %s
\n
"
,
asm_name
(
"__wine_spec_unimplemented_stub"
)
);
output
(
"
\t
.cfi_endproc
\n
"
);
output
_cfi
(
".cfi_endproc
"
);
break
;
default:
assert
(
0
);
...
...
tools/winebuild/relay.c
View file @
e550e8a1
...
...
@@ -984,46 +984,46 @@ static void build_call_from_regs_x86_64(void)
output
(
"
\t
.text
\n
"
);
function_header
(
"__wine_call_from_regs"
);
output
(
"
\t
.cfi_startproc
\n
"
);
output
_cfi
(
".cfi_startproc
"
);
output
(
"
\t
subq $%u,%%rsp
\n
"
,
STACK_SPACE
);
output
(
"
\t
.cfi_adjust_cfa_offset %u
\n
"
,
STACK_SPACE
);
output
_cfi
(
".cfi_adjust_cfa_offset %u
"
,
STACK_SPACE
);
/* save registers into the context */
output
(
"
\t
movq %%rax,0x78(%%rsp)
\n
"
);
output
(
"
\t
.cfi_rel_offset %%rax,0x78
\n
"
);
output
_cfi
(
".cfi_rel_offset %%rax,0x78
"
);
output
(
"
\t
movq %u(%%rsp),%%rax
\n
"
,
STACK_SPACE
+
16
);
/* saved %rcx on stack */
output
(
"
\t
movq %%rax,0x80(%%rsp)
\n
"
);
output
(
"
\t
.cfi_rel_offset %%rcx,0x80
\n
"
);
output
_cfi
(
".cfi_rel_offset %%rcx,0x80
"
);
output
(
"
\t
movq %u(%%rsp),%%rax
\n
"
,
STACK_SPACE
+
24
);
/* saved %rdx on stack */
output
(
"
\t
.cfi_rel_offset %%rdx,0x88
\n
"
);
output
_cfi
(
".cfi_rel_offset %%rdx,0x88
"
);
output
(
"
\t
movq %%rax,0x88(%%rsp)
\n
"
);
output
(
"
\t
movq %%rbx,0x90(%%rsp)
\n
"
);
output
(
"
\t
.cfi_rel_offset %%rbx,0x90
\n
"
);
output
_cfi
(
".cfi_rel_offset %%rbx,0x90
"
);
output
(
"
\t
leaq %u(%%rsp),%%rax
\n
"
,
STACK_SPACE
+
16
);
output
(
"
\t
movq %%rax,0x98(%%rsp)
\n
"
);
output
(
"
\t
movq %%rbp,0xa0(%%rsp)
\n
"
);
output
(
"
\t
.cfi_rel_offset %%rbp,0xa0
\n
"
);
output
_cfi
(
".cfi_rel_offset %%rbp,0xa0
"
);
output
(
"
\t
movq %%rsi,0xa8(%%rsp)
\n
"
);
output
(
"
\t
.cfi_rel_offset %%rsi,0xa8
\n
"
);
output
_cfi
(
".cfi_rel_offset %%rsi,0xa8
"
);
output
(
"
\t
movq %%rdi,0xb0(%%rsp)
\n
"
);
output
(
"
\t
.cfi_rel_offset %%rdi,0xb0
\n
"
);
output
_cfi
(
".cfi_rel_offset %%rdi,0xb0
"
);
output
(
"
\t
movq %%r8,0xb8(%%rsp)
\n
"
);
output
(
"
\t
.cfi_rel_offset %%r8,0xb8
\n
"
);
output
_cfi
(
".cfi_rel_offset %%r8,0xb8
"
);
output
(
"
\t
movq %%r9,0xc0(%%rsp)
\n
"
);
output
(
"
\t
.cfi_rel_offset %%r9,0xc0
\n
"
);
output
_cfi
(
".cfi_rel_offset %%r9,0xc0
"
);
output
(
"
\t
movq %%r10,0xc8(%%rsp)
\n
"
);
output
(
"
\t
.cfi_rel_offset %%r10,0xc8
\n
"
);
output
_cfi
(
".cfi_rel_offset %%r10,0xc8
"
);
output
(
"
\t
movq %%r11,0xd0(%%rsp)
\n
"
);
output
(
"
\t
.cfi_rel_offset %%r11,0xd0
\n
"
);
output
_cfi
(
".cfi_rel_offset %%r11,0xd0
"
);
output
(
"
\t
movq %%r12,0xd8(%%rsp)
\n
"
);
output
(
"
\t
.cfi_rel_offset %%r12,0xd8
\n
"
);
output
_cfi
(
".cfi_rel_offset %%r12,0xd8
"
);
output
(
"
\t
movq %%r13,0xe0(%%rsp)
\n
"
);
output
(
"
\t
.cfi_rel_offset %%r13,0xe0
\n
"
);
output
_cfi
(
".cfi_rel_offset %%r13,0xe0
"
);
output
(
"
\t
movq %%r14,0xe8(%%rsp)
\n
"
);
output
(
"
\t
.cfi_rel_offset %%r14,0xe8
\n
"
);
output
_cfi
(
".cfi_rel_offset %%r14,0xe8
"
);
output
(
"
\t
movq %%r15,0xf0(%%rsp)
\n
"
);
output
(
"
\t
.cfi_rel_offset %%r15,0xf0
\n
"
);
output
_cfi
(
".cfi_rel_offset %%r15,0xf0
"
);
output
(
"
\t
movq %u(%%rsp),%%rax
\n
"
,
STACK_SPACE
+
8
);
output
(
"
\t
movq %%rax,0xf8(%%rsp)
\n
"
);
...
...
@@ -1032,7 +1032,7 @@ static void build_call_from_regs_x86_64(void)
for
(
i
=
0
;
i
<
16
;
i
++
)
{
output
(
"
\t
movdqa %%xmm%u,0x%x(%%rsp)
\n
"
,
i
,
0x1a0
+
16
*
i
);
output
(
"
\t
.cfi_rel_offset %%xmm%u,0x%x
\n
"
,
i
,
0x1a0
+
16
*
i
);
output
_cfi
(
".cfi_rel_offset %%xmm%u,0x%x
"
,
i
,
0x1a0
+
16
*
i
);
}
output
(
"
\t
movw %%cs,0x38(%%rsp)
\n
"
);
...
...
@@ -1056,7 +1056,7 @@ static void build_call_from_regs_x86_64(void)
output
(
"
\t
cmpq %%rax,%%rcx
\n
"
);
output
(
"
\t
cmovgq %%rcx,%%rax
\n
"
);
output
(
"
\t
movq %%rsp,%%rbx
\n
"
);
output
(
"
\t
.cfi_def_cfa_register %%rbx
\n
"
);
output
_cfi
(
".cfi_def_cfa_register %%rbx
"
);
output
(
"
\t
leaq 16(,%%rax,8),%%rax
\n
"
);
/* add 8 for context arg and 8 for rounding */
output
(
"
\t
andq $~15,%%rax
\n
"
);
output
(
"
\t
subq %%rax,%%rsp
\n
"
);
...
...
@@ -1078,36 +1078,36 @@ static void build_call_from_regs_x86_64(void)
/* restore the context structure */
output
(
"1:
\t
movq 0x80(%%rbx),%%rcx
\n
"
);
output
(
"
\t
.cfi_same_value %%rcx
\n
"
);
output
_cfi
(
".cfi_same_value %%rcx
"
);
output
(
"
\t
movq 0x88(%%rbx),%%rdx
\n
"
);
output
(
"
\t
.cfi_same_value %%rdx
\n
"
);
output
_cfi
(
".cfi_same_value %%rdx
"
);
output
(
"
\t
movq 0xa0(%%rbx),%%rbp
\n
"
);
output
(
"
\t
.cfi_same_value %%rbp
\n
"
);
output
_cfi
(
".cfi_same_value %%rbp
"
);
output
(
"
\t
movq 0xa8(%%rbx),%%rsi
\n
"
);
output
(
"
\t
.cfi_same_value %%rsi
\n
"
);
output
_cfi
(
".cfi_same_value %%rsi
"
);
output
(
"
\t
movq 0xb0(%%rbx),%%rdi
\n
"
);
output
(
"
\t
.cfi_same_value %%rdi
\n
"
);
output
_cfi
(
".cfi_same_value %%rdi
"
);
output
(
"
\t
movq 0xb8(%%rbx),%%r8
\n
"
);
output
(
"
\t
.cfi_same_value %%r8
\n
"
);
output
_cfi
(
".cfi_same_value %%r8
"
);
output
(
"
\t
movq 0xc0(%%rbx),%%r9
\n
"
);
output
(
"
\t
.cfi_same_value %%r9
\n
"
);
output
_cfi
(
".cfi_same_value %%r9
"
);
output
(
"
\t
movq 0xc8(%%rbx),%%r10
\n
"
);
output
(
"
\t
.cfi_same_value %%r10
\n
"
);
output
_cfi
(
".cfi_same_value %%r10
"
);
output
(
"
\t
movq 0xd0(%%rbx),%%r11
\n
"
);
output
(
"
\t
.cfi_same_value %%r11
\n
"
);
output
_cfi
(
".cfi_same_value %%r11
"
);
output
(
"
\t
movq 0xd8(%%rbx),%%r12
\n
"
);
output
(
"
\t
.cfi_same_value %%r12
\n
"
);
output
_cfi
(
".cfi_same_value %%r12
"
);
output
(
"
\t
movq 0xe0(%%rbx),%%r13
\n
"
);
output
(
"
\t
.cfi_same_value %%r13
\n
"
);
output
_cfi
(
".cfi_same_value %%r13
"
);
output
(
"
\t
movq 0xe8(%%rbx),%%r14
\n
"
);
output
(
"
\t
.cfi_same_value %%r14
\n
"
);
output
_cfi
(
".cfi_same_value %%r14
"
);
output
(
"
\t
movq 0xf0(%%rbx),%%r15
\n
"
);
output
(
"
\t
.cfi_same_value %%r15
\n
"
);
output
_cfi
(
".cfi_same_value %%r15
"
);
for
(
i
=
0
;
i
<
16
;
i
++
)
{
output
(
"
\t
movdqa 0x%x(%%rbx),%%xmm%u
\n
"
,
0x1a0
+
16
*
i
,
i
);
output
(
"
\t
.cfi_same_value %%xmm%u
\n
"
,
i
);
output
_cfi
(
".cfi_same_value %%xmm%u
"
,
i
);
}
output
(
"
\t
fxrstor 0x100(%%rbx)
\n
"
);
output
(
"
\t
ldmxcsr 0x34(%%rbx)
\n
"
);
...
...
@@ -1125,15 +1125,15 @@ static void build_call_from_regs_x86_64(void)
output
(
"
\t
movq 0x78(%%rbx),%%rax
\n
"
);
output
(
"
\t
movq 0x90(%%rbx),%%rbx
\n
"
);
output
(
"
\t
iretq
\n
"
);
output
(
"
\t
.cfi_endproc
\n
"
);
output
_cfi
(
".cfi_endproc
"
);
output_function_size
(
"__wine_call_from_regs"
);
function_header
(
"__wine_restore_regs"
);
output
(
"
\t
.cfi_startproc
\n
"
);
output
_cfi
(
".cfi_startproc
"
);
output
(
"
\t
movq %%rcx,%%rbx
\n
"
);
output
(
"
\t
jmp 1b
\n
"
);
output
(
"
\t
.cfi_endproc
\n
"
);
output
_cfi
(
".cfi_endproc
"
);
output_function_size
(
"__wine_restore_regs"
);
}
...
...
tools/winebuild/utils.c
View file @
e550e8a1
...
...
@@ -874,6 +874,18 @@ void output_function_size( const char *name )
}
}
/* output a .cfi directive */
void
output_cfi
(
const
char
*
format
,
...
)
{
va_list
valist
;
va_start
(
valist
,
format
);
fputc
(
'\t'
,
output_file
);
vfprintf
(
output_file
,
format
,
valist
);
fputc
(
'\n'
,
output_file
);
va_end
(
valist
);
}
/* output the GNU note for non-exec stack */
void
output_gnu_stack_note
(
void
)
{
...
...
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