Rebase against fa66c1b3011a32036b42c436320212aa3b30ae3f

This commit is contained in:
Alistair Leslie-Hughes 2019-12-19 09:19:11 +11:00
parent 088d7f9ddf
commit 108662b1cc
3 changed files with 52 additions and 53 deletions

View File

@ -52,7 +52,7 @@ usage()
# Get the upstream commit sha
upstream_commit()
{
echo "238c6be5b81cbfcf8cd147b1cbb25d16803efbe1"
echo "fa66c1b3011a32036b42c436320212aa3b30ae3f"
}
# Show version information

View File

@ -1,4 +1,4 @@
From 06aedadd2d7a6f0333e050806ce1d368e8a5fece Mon Sep 17 00:00:00 2001
From 24441c46a4496982ff9ce2f1243f2cd8b52616b6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Mon, 15 May 2017 02:05:49 +0200
Subject: [PATCH] winebuild: Use multipass label system to generate fake dlls.
@ -6,15 +6,15 @@ Subject: [PATCH] winebuild: Use multipass label system to generate fake dlls.
---
tools/winebuild/build.h | 6 ++
tools/winebuild/res32.c | 1 -
tools/winebuild/spec32.c | 145 +++++++++++++++++++++++++++--------------------
tools/winebuild/utils.c | 92 ++++++++++++++++++++++++++++++
4 files changed, 180 insertions(+), 64 deletions(-)
tools/winebuild/spec32.c | 145 ++++++++++++++++++++++-----------------
tools/winebuild/utils.c | 92 +++++++++++++++++++++++++
4 files changed, 181 insertions(+), 63 deletions(-)
diff --git a/tools/winebuild/build.h b/tools/winebuild/build.h
index 0b7cb37..c1703de 100644
index c92a184749c..53d4ba192eb 100644
--- a/tools/winebuild/build.h
+++ b/tools/winebuild/build.h
@@ -338,6 +338,7 @@ extern size_t input_buffer_pos;
@@ -342,6 +342,7 @@ extern size_t input_buffer_pos;
extern size_t input_buffer_size;
extern unsigned char *output_buffer;
extern size_t output_buffer_pos;
@ -22,7 +22,7 @@ index 0b7cb37..c1703de 100644
extern size_t output_buffer_size;
extern void init_input_buffer( const char *file );
@@ -353,6 +354,11 @@ extern void put_dword( unsigned int val );
@@ -357,6 +358,11 @@ extern void put_dword( unsigned int val );
extern void put_qword( unsigned int val );
extern void put_pword( unsigned int val );
extern void align_output( unsigned int align );
@ -35,7 +35,7 @@ index 0b7cb37..c1703de 100644
/* global variables */
diff --git a/tools/winebuild/res32.c b/tools/winebuild/res32.c
index bd55bb2..d932901 100644
index bd55bb2fa5c..d9329019f8a 100644
--- a/tools/winebuild/res32.c
+++ b/tools/winebuild/res32.c
@@ -539,7 +539,6 @@ void output_bin_resources( DLLSPEC *spec, unsigned int start_rva )
@ -47,10 +47,10 @@ index bd55bb2..d932901 100644
/* output the resource directories */
diff --git a/tools/winebuild/spec32.c b/tools/winebuild/spec32.c
index f9b6a72..f176519 100644
index fa7984e1a38..e67cb48cd08 100644
--- a/tools/winebuild/spec32.c
+++ b/tools/winebuild/spec32.c
@@ -823,11 +823,11 @@ void output_pe_module( DLLSPEC *spec )
@@ -885,11 +885,11 @@ void output_spec32_file( DLLSPEC *spec )
/*******************************************************************
@ -65,12 +65,12 @@ index f9b6a72..f176519 100644
{
static const unsigned char dll_code_section[] = { 0x31, 0xc0, /* xor %eax,%eax */
0xc2, 0x0c, 0x00 }; /* ret $12 */
@@ -839,22 +839,8 @@ void output_fake_module( DLLSPEC *spec )
const unsigned int page_size = get_page_size();
@@ -901,21 +901,8 @@ void output_fake_module( DLLSPEC *spec )
const unsigned int section_align = page_size;
const unsigned int file_align = 0x200;
- const unsigned int reloc_size = 8;
const unsigned int lfanew = (0x40 + sizeof(fakedll_signature) + 15) & ~15;
const unsigned int reloc_size = 8;
- const unsigned int lfanew = 0x40 + sizeof(fakedll_signature);
+ const unsigned int lfanew = (0x40 + sizeof(fakedll_signature) + 15) & ~15;
const unsigned int nb_sections = 2 + (spec->nb_resources != 0);
- const unsigned int text_size = (spec->characteristics & IMAGE_FILE_DLL) ?
- sizeof(dll_code_section) : sizeof(exe_code_section);
@ -88,16 +88,15 @@ index f9b6a72..f176519 100644
put_word( 0x5a4d ); /* e_magic */
put_word( 0x40 ); /* e_cblp */
@@ -882,7 +868,7 @@ void output_fake_module( DLLSPEC *spec )
@@ -943,6 +930,7 @@ void output_fake_module( DLLSPEC *spec )
put_dword( lfanew );
put_data( fakedll_signature, sizeof(fakedll_signature) );
- align_output( 16 );
+ align_output_rva( 16, 16 );
put_dword( 0x4550 ); /* Signature */
switch(target_cpu)
@@ -906,11 +892,11 @@ void output_fake_module( DLLSPEC *spec )
@@ -966,11 +954,11 @@ void output_fake_module( DLLSPEC *spec )
IMAGE_NT_OPTIONAL_HDR32_MAGIC ); /* Magic */
put_byte( 7 ); /* MajorLinkerVersion */
put_byte( 10 ); /* MinorLinkerVersion */
@ -112,7 +111,7 @@ index f9b6a72..f176519 100644
if (get_ptr_size() == 4) put_dword( 0 ); /* BaseOfData */
put_pword( 0x10000000 ); /* ImageBase */
put_dword( section_align ); /* SectionAlignment */
@@ -922,8 +908,8 @@ void output_fake_module( DLLSPEC *spec )
@@ -982,8 +970,8 @@ void output_fake_module( DLLSPEC *spec )
put_word( spec->subsystem_major ); /* MajorSubsystemVersion */
put_word( spec->subsystem_minor ); /* MinorSubsystemVersion */
put_dword( 0 ); /* Win32VersionValue */
@ -123,7 +122,7 @@ index f9b6a72..f176519 100644
put_dword( 0 ); /* CheckSum */
put_word( spec->subsystem ); /* Subsystem */
put_word( spec->dll_characteristics ); /* DllCharacteristics */
@@ -936,10 +922,10 @@ void output_fake_module( DLLSPEC *spec )
@@ -996,10 +984,10 @@ void output_fake_module( DLLSPEC *spec )
put_dword( 0 ); put_dword( 0 ); /* DataDirectory[IMAGE_DIRECTORY_ENTRY_EXPORT] */
put_dword( 0 ); put_dword( 0 ); /* DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT] */
@ -137,7 +136,7 @@ index f9b6a72..f176519 100644
}
else
{
@@ -949,8 +935,8 @@ void output_fake_module( DLLSPEC *spec )
@@ -1009,8 +997,8 @@ void output_fake_module( DLLSPEC *spec )
put_dword( 0 ); put_dword( 0 ); /* DataDirectory[IMAGE_DIRECTORY_ENTRY_EXCEPTION] */
put_dword( 0 ); put_dword( 0 ); /* DataDirectory[IMAGE_DIRECTORY_ENTRY_SECURITY] */
@ -148,7 +147,7 @@ index f9b6a72..f176519 100644
put_dword( 0 ); put_dword( 0 ); /* DataDirectory[IMAGE_DIRECTORY_ENTRY_DEBUG] */
put_dword( 0 ); put_dword( 0 ); /* DataDirectory[IMAGE_DIRECTORY_ENTRY_COPYRIGHT] */
put_dword( 0 ); put_dword( 0 ); /* DataDirectory[IMAGE_DIRECTORY_ENTRY_GLOBALPTR] */
@@ -963,62 +949,95 @@ void output_fake_module( DLLSPEC *spec )
@@ -1023,62 +1011,95 @@ void output_fake_module( DLLSPEC *spec )
put_dword( 0 ); put_dword( 0 ); /* DataDirectory[15] */
/* .text section */
@ -280,7 +279,7 @@ index f9b6a72..f176519 100644
}
diff --git a/tools/winebuild/utils.c b/tools/winebuild/utils.c
index 355c5ab..26ef44e 100644
index 05063786928..f53e09227ca 100644
--- a/tools/winebuild/utils.c
+++ b/tools/winebuild/utils.c
@@ -34,6 +34,7 @@
@ -291,7 +290,7 @@ index 355c5ab..26ef44e 100644
#include "build.h"
#if defined(_WIN32) && !defined(__CYGWIN__)
@@ -522,8 +523,86 @@ size_t input_buffer_pos;
@@ -541,8 +542,86 @@ size_t input_buffer_pos;
size_t input_buffer_size;
unsigned char *output_buffer;
size_t output_buffer_pos;
@ -378,7 +377,7 @@ index 355c5ab..26ef44e 100644
static void check_output_buffer_space( size_t size )
{
if (output_buffer_pos + size >= output_buffer_size)
@@ -555,7 +634,9 @@ void init_output_buffer(void)
@@ -574,7 +653,9 @@ void init_output_buffer(void)
{
output_buffer_size = 1024;
output_buffer_pos = 0;
@ -388,7 +387,7 @@ index 355c5ab..26ef44e 100644
}
void flush_output_buffer(void)
@@ -565,6 +646,7 @@ void flush_output_buffer(void)
@@ -584,6 +665,7 @@ void flush_output_buffer(void)
fatal_error( "Error writing to %s\n", output_file_name );
close_output_file();
free( output_buffer );
@ -396,7 +395,7 @@ index 355c5ab..26ef44e 100644
}
unsigned char get_byte(void)
@@ -604,12 +686,14 @@ void put_data( const void *data, size_t size )
@@ -623,12 +705,14 @@ void put_data( const void *data, size_t size )
check_output_buffer_space( size );
memcpy( output_buffer + output_buffer_pos, data, size );
output_buffer_pos += size;
@ -411,7 +410,7 @@ index 355c5ab..26ef44e 100644
}
void put_word( unsigned short val )
@@ -656,6 +740,14 @@ void align_output( unsigned int align )
@@ -675,6 +759,14 @@ void align_output( unsigned int align )
output_buffer_pos += size;
}
@ -427,5 +426,5 @@ index 355c5ab..26ef44e 100644
void output_standard_file_header(void)
{
--
1.9.1
2.17.1

View File

@ -1,4 +1,4 @@
From 1bde7847e392610773a57ee77731ac6d4caf26aa Mon Sep 17 00:00:00 2001
From 97479646b6ae8f865b4184c6dff988c06f0c32f5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Mon, 15 May 2017 16:27:56 +0200
Subject: [PATCH] winebuild: Add stub functions in fake dlls.
@ -13,10 +13,10 @@ Subject: [PATCH] winebuild: Add stub functions in fake dlls.
6 files changed, 255 insertions(+), 15 deletions(-)
diff --git a/dlls/kernel32/tests/loader.c b/dlls/kernel32/tests/loader.c
index 3b87ca4d151..ed5ed28b510 100644
index 4d9a26075f2..29cf15585f9 100644
--- a/dlls/kernel32/tests/loader.c
+++ b/dlls/kernel32/tests/loader.c
@@ -1555,9 +1555,7 @@ static void test_FakeDLL(void)
@@ -1559,9 +1559,7 @@ static void test_FakeDLL(void)
ok(ptr != NULL, "MapViewOfFile failed with error %u\n", GetLastError());
dir = RtlImageDirectoryEntryToData(ptr, TRUE, IMAGE_DIRECTORY_ENTRY_EXPORT, &size);
@ -26,7 +26,7 @@ index 3b87ca4d151..ed5ed28b510 100644
names = RVAToAddr(dir->AddressOfNames, ptr);
ordinals = RVAToAddr(dir->AddressOfNameOrdinals, ptr);
@@ -1586,17 +1584,20 @@ todo_wine
@@ -1590,17 +1588,20 @@ todo_wine
/* check position in memory */
dll_rva = (DWORD_PTR)dll_func - (DWORD_PTR)module;
map_rva = funcs[ordinals[i]];
@ -47,7 +47,7 @@ index 3b87ca4d151..ed5ed28b510 100644
ok(!memcmp(map_func, dll_func, 0x20), "%s: Function content does not match!\n", func_name);
if (!strcmp(func_name, "NtSetEvent"))
@@ -1610,10 +1611,11 @@ todo_wine
@@ -1614,10 +1615,11 @@ todo_wine
ok(event != NULL, "CreateEvent failed with error %u\n", GetLastError());
pNtSetEvent(event, 0);
ok(WaitForSingleObject(event, 0) == WAIT_OBJECT_0, "Event was not signaled\n");
@ -61,10 +61,10 @@ index 3b87ca4d151..ed5ed28b510 100644
CloseHandle(map);
CloseHandle(file);
diff --git a/dlls/ntdll/signal_i386.c b/dlls/ntdll/signal_i386.c
index edd11baf11a..1f33e759b77 100644
index a0f8b3a2ec6..e551646301f 100644
--- a/dlls/ntdll/signal_i386.c
+++ b/dlls/ntdll/signal_i386.c
@@ -430,6 +430,45 @@ static wine_signal_handler handlers[256];
@@ -445,6 +445,45 @@ static wine_signal_handler handlers[256];
extern void DECLSPEC_NORETURN __wine_syscall_dispatcher( void );
extern NTSTATUS WINAPI __syscall_NtGetContextThread( HANDLE handle, CONTEXT *context );
@ -110,7 +110,7 @@ index edd11baf11a..1f33e759b77 100644
enum i386_trap_code
{
TRAP_x86_UNKNOWN = -1, /* Unknown fault (TRAP_sig not defined) */
@@ -2343,6 +2382,7 @@ NTSTATUS signal_alloc_thread( TEB **teb )
@@ -2307,6 +2346,7 @@ NTSTATUS signal_alloc_thread( TEB **teb )
(*teb)->Tib.Self = &(*teb)->Tib;
(*teb)->Tib.ExceptionList = (void *)~0UL;
(*teb)->WOW32Reserved = __wine_syscall_dispatcher;
@ -119,7 +119,7 @@ index edd11baf11a..1f33e759b77 100644
if (!(thread_data->fs = wine_ldt_alloc_fs()))
{
diff --git a/include/winternl.h b/include/winternl.h
index b3ad0d361d2..ba1e1a355fd 100644
index 843c874031b..464703e3925 100644
--- a/include/winternl.h
+++ b/include/winternl.h
@@ -396,7 +396,7 @@ typedef struct _TEB
@ -132,10 +132,10 @@ index b3ad0d361d2..ba1e1a355fd 100644
PVOID ReservedForPerf; /* f7c/1750 */
PVOID ReservedForOle; /* f80/1758 */
diff --git a/tools/winebuild/build.h b/tools/winebuild/build.h
index e9967874d51..dcfb37e906b 100644
index 53d4ba192eb..09a654de165 100644
--- a/tools/winebuild/build.h
+++ b/tools/winebuild/build.h
@@ -356,6 +356,7 @@ extern void put_word( unsigned short val );
@@ -357,6 +357,7 @@ extern void put_word( unsigned short val );
extern void put_dword( unsigned int val );
extern void put_qword( unsigned int val );
extern void put_pword( unsigned int val );
@ -144,10 +144,10 @@ index e9967874d51..dcfb37e906b 100644
extern void align_output_rva( unsigned int file_align, unsigned int rva_align );
extern size_t label_pos( const char *name );
diff --git a/tools/winebuild/spec32.c b/tools/winebuild/spec32.c
index e86188f175a..88b3d4b4090 100644
index e67cb48cd08..89ad63cd738 100644
--- a/tools/winebuild/spec32.c
+++ b/tools/winebuild/spec32.c
@@ -881,6 +881,163 @@ void output_spec32_file( DLLSPEC *spec )
@@ -884,6 +884,163 @@ void output_spec32_file( DLLSPEC *spec )
}
@ -311,16 +311,16 @@ index e86188f175a..88b3d4b4090 100644
/*******************************************************************
* output_fake_module_pass
*
@@ -899,7 +1056,7 @@ static void output_fake_module_pass( DLLSPEC *spec )
const unsigned int section_align = page_size;
@@ -902,7 +1059,7 @@ static void output_fake_module_pass( DLLSPEC *spec )
const unsigned int file_align = 0x200;
const unsigned int reloc_size = 8;
const unsigned int lfanew = (0x40 + sizeof(fakedll_signature) + 15) & ~15;
- const unsigned int nb_sections = 2 + (spec->nb_resources != 0);
+ const unsigned int nb_sections = 2 + (needs_stub_exports( spec ) != 0) + (spec->nb_resources != 0);
put_word( 0x5a4d ); /* e_magic */
put_word( 0x40 ); /* e_cblp */
@@ -956,7 +1113,7 @@ static void output_fake_module_pass( DLLSPEC *spec )
@@ -959,7 +1116,7 @@ static void output_fake_module_pass( DLLSPEC *spec )
put_dword( 0 ); /* SizeOfUninitializedData */
put_dword( label_rva("entrypoint") ); /* AddressOfEntryPoint */
put_dword( label_rva("text_start") ); /* BaseOfCode */
@ -329,7 +329,7 @@ index e86188f175a..88b3d4b4090 100644
put_pword( 0x10000000 ); /* ImageBase */
put_dword( section_align ); /* SectionAlignment */
put_dword( file_align ); /* FileAlignment */
@@ -979,7 +1136,8 @@ static void output_fake_module_pass( DLLSPEC *spec )
@@ -982,7 +1139,8 @@ static void output_fake_module_pass( DLLSPEC *spec )
put_dword( 0 ); /* LoaderFlags */
put_dword( 16 ); /* NumberOfRvaAndSizes */
@ -339,7 +339,7 @@ index e86188f175a..88b3d4b4090 100644
put_dword( 0 ); put_dword( 0 ); /* DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT] */
if (spec->nb_resources) /* DataDirectory[IMAGE_DIRECTORY_ENTRY_RESOURCE] */
{
@@ -1019,6 +1177,21 @@ static void output_fake_module_pass( DLLSPEC *spec )
@@ -1022,6 +1180,21 @@ static void output_fake_module_pass( DLLSPEC *spec )
put_word( 0 ); /* NumberOfLinenumbers */
put_dword( 0x60000020 /* CNT_CODE|MEM_EXECUTE|MEM_READ */ ); /* Characteristics */
@ -361,7 +361,7 @@ index e86188f175a..88b3d4b4090 100644
/* .reloc section */
put_data( ".reloc\0", 8 ); /* Name */
put_dword( label_rva_align("reloc_end") - label_rva("reloc_start") ); /* VirtualSize */
@@ -1051,13 +1224,31 @@ static void output_fake_module_pass( DLLSPEC *spec )
@@ -1054,13 +1227,31 @@ static void output_fake_module_pass( DLLSPEC *spec )
/* .text contents */
align_output_rva( file_align, section_align );
@ -400,10 +400,10 @@ index e86188f175a..88b3d4b4090 100644
/* .reloc contents */
align_output_rva( file_align, section_align );
diff --git a/tools/winebuild/utils.c b/tools/winebuild/utils.c
index 07ae445be15..a9f5b9ae336 100644
index f53e09227ca..0f4642d43ae 100644
--- a/tools/winebuild/utils.c
+++ b/tools/winebuild/utils.c
@@ -533,7 +533,7 @@ size_t output_buffer_size;
@@ -548,7 +548,7 @@ size_t output_buffer_size;
struct label
{
struct list entry;
@ -412,7 +412,7 @@ index 07ae445be15..a9f5b9ae336 100644
size_t pos;
size_t rva;
};
@@ -551,7 +551,7 @@ struct label *get_label( const char *name )
@@ -566,7 +566,7 @@ struct label *get_label( const char *name )
}
label = xmalloc( sizeof(*label) );
@ -421,7 +421,7 @@ index 07ae445be15..a9f5b9ae336 100644
label->pos = 0;
label->rva = 0;
@@ -603,6 +603,7 @@ void free_labels( void )
@@ -618,6 +618,7 @@ void free_labels( void )
LIST_FOR_EACH_ENTRY_SAFE( label, label2, &labels, struct label, entry )
{
list_remove( &label->entry );
@ -429,7 +429,7 @@ index 07ae445be15..a9f5b9ae336 100644
free( label );
}
}
@@ -734,6 +735,11 @@ void put_pword( unsigned int val )
@@ -749,6 +750,11 @@ void put_pword( unsigned int val )
else put_dword( val );
}