winegcc: Align sections in PE files to page size.
This makes sure it will be possible to mmap the section directly instead of having to copy them. It then also makes perf able to figure the code origin for Wine modules. Signed-off-by: Rémi Bernon <rbernon@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
716bdfcbfa
commit
e36bed4f37
|
@ -791,7 +791,7 @@ free_page:
|
|||
}
|
||||
|
||||
static void check_QueryWorkingSetEx(PVOID addr, const char *desc, DWORD expected_valid,
|
||||
DWORD expected_protection, DWORD expected_shared, BOOL todo, BOOL todo_shared)
|
||||
DWORD expected_protection, DWORD expected_shared, BOOL todo)
|
||||
{
|
||||
PSAPI_WORKING_SET_EX_INFORMATION info;
|
||||
BOOL ret;
|
||||
|
@ -814,7 +814,6 @@ static void check_QueryWorkingSetEx(PVOID addr, const char *desc, DWORD expected
|
|||
ok(info.VirtualAttributes.LargePage == 0, "%s expected LargePage=0 but got %u\n",
|
||||
desc, info.VirtualAttributes.LargePage);
|
||||
|
||||
todo_wine_if(todo_shared)
|
||||
ok(info.VirtualAttributes.Shared == expected_shared || broken(!info.VirtualAttributes.Valid) /* w2003 */,
|
||||
"%s expected Shared=%u but got %u\n", desc, expected_shared, info.VirtualAttributes.Shared);
|
||||
if (info.VirtualAttributes.Valid && info.VirtualAttributes.Shared)
|
||||
|
@ -838,44 +837,44 @@ static void test_QueryWorkingSetEx(void)
|
|||
}
|
||||
|
||||
addr = GetModuleHandleA(NULL);
|
||||
check_QueryWorkingSetEx(addr, "exe", 1, PAGE_READONLY, 1, FALSE, TRUE);
|
||||
check_QueryWorkingSetEx(addr, "exe", 1, PAGE_READONLY, 1, FALSE);
|
||||
|
||||
ret = VirtualProtect(addr, 0x1000, PAGE_NOACCESS, &prot);
|
||||
ok(ret, "VirtualProtect failed with %d\n", GetLastError());
|
||||
check_QueryWorkingSetEx(addr, "exe,noaccess", 0, 0, 1, FALSE, TRUE);
|
||||
check_QueryWorkingSetEx(addr, "exe,noaccess", 0, 0, 1, FALSE);
|
||||
|
||||
ret = VirtualProtect(addr, 0x1000, prot, &prot);
|
||||
ok(ret, "VirtualProtect failed with %d\n", GetLastError());
|
||||
check_QueryWorkingSetEx(addr, "exe,readonly1", 0, 0, 1, TRUE, TRUE);
|
||||
check_QueryWorkingSetEx(addr, "exe,readonly1", 0, 0, 1, TRUE);
|
||||
|
||||
*(volatile char *)addr;
|
||||
ok(ret, "VirtualProtect failed with %d\n", GetLastError());
|
||||
check_QueryWorkingSetEx(addr, "exe,readonly2", 1, PAGE_READONLY, 1, FALSE, TRUE);
|
||||
check_QueryWorkingSetEx(addr, "exe,readonly2", 1, PAGE_READONLY, 1, FALSE);
|
||||
|
||||
addr = VirtualAlloc(NULL, 0x1000, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE);
|
||||
ok(addr != NULL, "VirtualAlloc failed with %d\n", GetLastError());
|
||||
check_QueryWorkingSetEx(addr, "valloc", 0, 0, 0, FALSE, FALSE);
|
||||
check_QueryWorkingSetEx(addr, "valloc", 0, 0, 0, FALSE);
|
||||
|
||||
*(volatile char *)addr;
|
||||
check_QueryWorkingSetEx(addr, "valloc,read", 1, PAGE_READWRITE, 0, FALSE, FALSE);
|
||||
check_QueryWorkingSetEx(addr, "valloc,read", 1, PAGE_READWRITE, 0, FALSE);
|
||||
|
||||
*(volatile char *)addr = 0x42;
|
||||
check_QueryWorkingSetEx(addr, "valloc,write", 1, PAGE_READWRITE, 0, FALSE, FALSE);
|
||||
check_QueryWorkingSetEx(addr, "valloc,write", 1, PAGE_READWRITE, 0, FALSE);
|
||||
|
||||
ret = VirtualProtect(addr, 0x1000, PAGE_NOACCESS, &prot);
|
||||
ok(ret, "VirtualProtect failed with %d\n", GetLastError());
|
||||
check_QueryWorkingSetEx(addr, "valloc,noaccess", 0, 0, 0, FALSE, FALSE);
|
||||
check_QueryWorkingSetEx(addr, "valloc,noaccess", 0, 0, 0, FALSE);
|
||||
|
||||
ret = VirtualProtect(addr, 0x1000, prot, &prot);
|
||||
ok(ret, "VirtualProtect failed with %d\n", GetLastError());
|
||||
check_QueryWorkingSetEx(addr, "valloc,readwrite1", 0, 0, 0, TRUE, FALSE);
|
||||
check_QueryWorkingSetEx(addr, "valloc,readwrite1", 0, 0, 0, TRUE);
|
||||
|
||||
*(volatile char *)addr;
|
||||
check_QueryWorkingSetEx(addr, "valloc,readwrite2", 1, PAGE_READWRITE, 0, FALSE, FALSE);
|
||||
check_QueryWorkingSetEx(addr, "valloc,readwrite2", 1, PAGE_READWRITE, 0, FALSE);
|
||||
|
||||
ret = VirtualFree(addr, 0, MEM_RELEASE);
|
||||
ok(ret, "VirtualFree failed with %d\n", GetLastError());
|
||||
check_QueryWorkingSetEx(addr, "valloc,free", FALSE, 0, 0, FALSE, FALSE);
|
||||
check_QueryWorkingSetEx(addr, "valloc,free", FALSE, 0, 0, FALSE);
|
||||
}
|
||||
|
||||
START_TEST(psapi_main)
|
||||
|
|
|
@ -521,6 +521,9 @@ static strarray *get_link_args( struct options *opts, const char *output_name )
|
|||
if (opts->debug_file && strendswith(opts->debug_file, ".pdb"))
|
||||
strarray_add(link_args, strmake("-Wl,-pdb,%s", opts->debug_file));
|
||||
|
||||
if (!try_link( opts->prefix, link_args, "-Wl,--file-alignment,0x1000" ))
|
||||
strarray_add( link_args, "-Wl,--file-alignment,0x1000" );
|
||||
|
||||
strarray_addall( link_args, flags );
|
||||
return link_args;
|
||||
|
||||
|
|
Loading…
Reference in New Issue