winehq.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
February
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
January
2003
December
November
October
September
August
July
June
May
April
March
February
January
2002
December
November
October
September
August
July
June
May
April
March
February
January
2001
December
November
October
September
August
July
June
May
April
March
February
List overview
wine-commits
May 2020
----- 2025 -----
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
January 2004
----- 2003 -----
December 2003
November 2003
October 2003
September 2003
August 2003
July 2003
June 2003
May 2003
April 2003
March 2003
February 2003
January 2003
----- 2002 -----
December 2002
November 2002
October 2002
September 2002
August 2002
July 2002
June 2002
May 2002
April 2002
March 2002
February 2002
January 2002
----- 2001 -----
December 2001
November 2001
October 2001
September 2001
August 2001
July 2001
June 2001
May 2001
April 2001
March 2001
February 2001
wine-commits@winehq.org
1 participants
743 discussions
Start a n
N
ew thread
Dmitry Timoshkov : server: All fields up to CheckSum are mandatory regardless of SizeOfOptionalHeader value.
by Alexandre Julliard
15 May '20
15 May '20
Module: wine Branch: master Commit: ae9eb36e21c9b8e31b1e4a4c1eb6deae9b90262d URL:
https://source.winehq.org/git/wine.git/?a=commit;h=ae9eb36e21c9b8e31b1e4a4c…
Author: Dmitry Timoshkov <dmitry(a)baikal.ru> Date: Wed May 6 15:15:54 2020 +0800 server: All fields up to CheckSum are mandatory regardless of SizeOfOptionalHeader value. Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=42125
Signed-off-by: Dmitry Timoshkov <dmitry(a)baikal.ru> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- server/mapping.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/server/mapping.c b/server/mapping.c index 6970c86ffc..ffd20450df 100644 --- a/server/mapping.c +++ b/server/mapping.c @@ -580,7 +580,7 @@ static unsigned int get_image_params( struct mapping *mapping, file_pos_t file_s } opt; } nt; off_t pos; - int size; + int size, opt_size; size_t mz_size, clr_va, clr_size; unsigned int i, cpu_mask = get_supported_cpu_mask(); @@ -596,7 +596,8 @@ static unsigned int get_image_params( struct mapping *mapping, file_pos_t file_s size = pread( unix_fd, &nt, sizeof(nt), pos ); if (size < sizeof(nt.Signature) + sizeof(nt.FileHeader)) return STATUS_INVALID_IMAGE_PROTECT; /* zero out Optional header in the case it's not present or partial */ - size = min( size, sizeof(nt.Signature) + sizeof(nt.FileHeader) + nt.FileHeader.SizeOfOptionalHeader ); + opt_size = max( nt.FileHeader.SizeOfOptionalHeader, offsetof( IMAGE_OPTIONAL_HEADER32, CheckSum )); + size = min( size, sizeof(nt.Signature) + sizeof(nt.FileHeader) + opt_size ); if (size < sizeof(nt)) memset( (char *)&nt + size, 0, sizeof(nt) - size ); if (nt.Signature != IMAGE_NT_SIGNATURE) {
1
0
0
0
Murray Colpman : winex11.drv: Interpret mouse 6/7 as horiz scroll.
by Alexandre Julliard
14 May '20
14 May '20
Module: wine Branch: master Commit: 893080e4df5a45929320ebb88b8668eea316476c URL:
https://source.winehq.org/git/wine.git/?a=commit;h=893080e4df5a45929320ebb8…
Author: Murray Colpman <muzer(a)tim32.org> Date: Tue May 12 00:39:02 2020 +0100 winex11.drv: Interpret mouse 6/7 as horiz scroll. X11 Mouse buttons 6 and 7 were set to translate into browser back/forward button events. However, this is based on an old convention where buttons 6 and 7 could either mean horizontal scroll or browser back/forward. Nowadays, 6 and 7 solely mean horizontal scroll, 8 and 9 being used for back/forward. In addition, the wide adoption of two-finger two-dimensional scrolling on laptop trackpads since this code was written has meant that back/forward events may be generated unintentionally, which can be very disruptive when using tools such as web browsers. Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=49142
Signed-off-by: Murray Colpman <muzer(a)tim32.org> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/winex11.drv/mouse.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c index d4bfc5a196..d78449c2cc 100644 --- a/dlls/winex11.drv/mouse.c +++ b/dlls/winex11.drv/mouse.c @@ -74,8 +74,8 @@ static const UINT button_down_flags[NB_BUTTONS] = MOUSEEVENTF_RIGHTDOWN, MOUSEEVENTF_WHEEL, MOUSEEVENTF_WHEEL, - MOUSEEVENTF_XDOWN, /* FIXME: horizontal wheel */ - MOUSEEVENTF_XDOWN, + MOUSEEVENTF_HWHEEL, + MOUSEEVENTF_HWHEEL, MOUSEEVENTF_XDOWN, MOUSEEVENTF_XDOWN }; @@ -87,8 +87,8 @@ static const UINT button_up_flags[NB_BUTTONS] = MOUSEEVENTF_RIGHTUP, 0, 0, - MOUSEEVENTF_XUP, - MOUSEEVENTF_XUP, + 0, + 0, MOUSEEVENTF_XUP, MOUSEEVENTF_XUP }; @@ -100,8 +100,8 @@ static const UINT button_down_data[NB_BUTTONS] = 0, WHEEL_DELTA, -WHEEL_DELTA, - XBUTTON1, - XBUTTON2, + -WHEEL_DELTA, + WHEEL_DELTA, XBUTTON1, XBUTTON2 }; @@ -113,8 +113,8 @@ static const UINT button_up_data[NB_BUTTONS] = 0, 0, 0, - XBUTTON1, - XBUTTON2, + 0, + 0, XBUTTON1, XBUTTON2 };
1
0
0
0
Alexandre Julliard : loader: Try to load ntdll.so before libwine initialization.
by Alexandre Julliard
14 May '20
14 May '20
Module: wine Branch: master Commit: 526522caae103a27cd36740d6eca59387a189d02 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=526522caae103a27cd36740d…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Thu May 14 15:43:56 2020 +0200 loader: Try to load ntdll.so before libwine initialization. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- loader/Makefile.in | 2 + loader/main.c | 121 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 123 insertions(+) diff --git a/loader/Makefile.in b/loader/Makefile.in index f76b7c6d64..75b0b7b9dd 100644 --- a/loader/Makefile.in +++ b/loader/Makefile.in @@ -18,6 +18,8 @@ INSTALL_LIB = $(WINELOADER_PROGRAMS) preloader_EXTRADEFS = -fno-builtin +main_EXTRADEFS = -DDLLDIR=\"${dlldir}\" -DBIN_TO_DLLDIR=\"`$(MAKEDEP) -R ${bindir} ${dlldir}`\" + wine_OBJS = main.o wine_DEPS = $(WINELOADER_DEPENDS) wine_LDFLAGS = $(WINELOADER_LDFLAGS) $(LDEXECFLAGS) -lwine $(PTHREAD_LIBS) diff --git a/loader/main.c b/loader/main.c index 407c897892..9f9165ff93 100644 --- a/loader/main.c +++ b/loader/main.c @@ -40,6 +40,8 @@ #include "wine/library.h" #include "main.h" +extern char **environ; + /* the preloader will set this variable */ const struct wine_preload_info *wine_main_preload_info = NULL; @@ -158,6 +160,116 @@ static int pre_exec(void) #endif +/* canonicalize path and return its directory name */ +static char *realpath_dirname( const char *name ) +{ + char *p, *fullpath = realpath( name, NULL ); + + if (fullpath) + { + p = strrchr( fullpath, '/' ); + if (p == fullpath) p++; + if (p) *p = 0; + } + return fullpath; +} + +/* if string ends with tail, remove it */ +static char *remove_tail( const char *str, const char *tail ) +{ + size_t len = strlen( str ); + size_t tail_len = strlen( tail ); + char *ret; + + if (len < tail_len) return NULL; + if (strcmp( str + len - tail_len, tail )) return NULL; + ret = malloc( len - tail_len + 1 ); + memcpy( ret, str, len - tail_len ); + ret[len - tail_len] = 0; + return ret; +} + +/* build a path from the specified dir and name */ +static char *build_path( const char *dir, const char *name ) +{ + size_t len = strlen( dir ); + char *ret = malloc( len + strlen( name ) + 2 ); + + memcpy( ret, dir, len ); + if (len && ret[len - 1] != '/') ret[len++] = '/'; + strcpy( ret + len, name ); + return ret; +} + +static const char *get_self_exe( char *argv0 ) +{ +#if defined(__linux__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__) + return "/proc/self/exe"; +#elif defined (__FreeBSD__) || defined(__DragonFly__) + return "/proc/curproc/file"; +#else + if (!strchr( argv0, '/' )) /* search in PATH */ + { + char *p, *path = getenv( "PATH" ); + + if (!path || !(path = strdup(path))) return NULL; + for (p = strtok( path, ":" ); p; p = strtok( NULL, ":" )) + { + char *name = build_path( p, argv0 ); + int found = !access( name, X_OK ); + free( name ); + if (found) break; + } + if (p) p = strdup( p ); + free( path ); + return p; + } + return argv0; +#endif +} + +static void *try_dlopen( const char *dir, const char *name ) +{ + char *path = build_path( dir, name ); + void *handle = dlopen( path, RTLD_NOW ); + free( path ); + return handle; +} + +static void *load_ntdll( char *argv0 ) +{ + const char *self = get_self_exe( argv0 ); + char *path, *p; + void *handle = NULL; + + if (self && ((path = realpath_dirname( self )))) + { + if ((p = remove_tail( path, "/loader" ))) + { + handle = try_dlopen( p, "dlls/ntdll/ntdll.so" ); + free( p ); + } + else handle = try_dlopen( path, BIN_TO_DLLDIR "/ntdll.so" ); + free( path ); + } + + if (!handle && (path = getenv( "WINEDLLPATH" ))) + { + path = strdup( path ); + for (p = strtok( path, ":" ); p; p = strtok( NULL, ":" )) + { + handle = try_dlopen( p, "ntdll.so" ); + if (handle) break; + } + free( path ); + } + + if (!handle && !self) handle = try_dlopen( DLLDIR, "ntdll.so" ); + + return handle; +} + + /********************************************************************** * main */ @@ -165,6 +277,7 @@ int main( int argc, char *argv[] ) { char error[1024]; int i; + void *handle; if (!getenv( "WINELOADERNOEXEC" )) /* first time around */ { @@ -181,6 +294,14 @@ int main( int argc, char *argv[] ) } } + if ((handle = load_ntdll( argv[0] ))) + { + void (*init_func)(int, char **, char **) = dlsym( handle, "__wine_main" ); + if (init_func) init_func( argc, argv, environ ); + fprintf( stderr, "wine: __wine_main function not found in ntdll.so\n" ); + exit(1); + } + if (wine_main_preload_info) { for (i = 0; wine_main_preload_info[i].size; i++)
1
0
0
0
Alexandre Julliard : ntdll: Set up virtual memory layout in the Unix library.
by Alexandre Julliard
14 May '20
14 May '20
Module: wine Branch: master Commit: 7e6a67d8c9f6931ee6b034bcc7db0adc6ba2ab0b URL:
https://source.winehq.org/git/wine.git/?a=commit;h=7e6a67d8c9f6931ee6b034bc…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Thu May 14 15:33:36 2020 +0200 ntdll: Set up virtual memory layout in the Unix library. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntdll/Makefile.in | 1 + dlls/ntdll/unix/loader.c | 3 +- dlls/ntdll/unix/unix_private.h | 28 ++++++ dlls/ntdll/unix/virtual.c | 213 +++++++++++++++++++++++++++++++++++++++++ 4 files changed, 244 insertions(+), 1 deletion(-) diff --git a/dlls/ntdll/Makefile.in b/dlls/ntdll/Makefile.in index 813d9a43e2..699c97a1ce 100644 --- a/dlls/ntdll/Makefile.in +++ b/dlls/ntdll/Makefile.in @@ -52,6 +52,7 @@ C_SRCS = \ threadpool.c \ time.c \ unix/loader.c \ + unix/virtual.c \ version.c \ virtual.c \ wcstring.c diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c index 4008c0a55d..257e74ffca 100644 --- a/dlls/ntdll/unix/loader.c +++ b/dlls/ntdll/unix/loader.c @@ -49,7 +49,7 @@ #include "windef.h" #include "winnt.h" #include "winternl.h" -#include "unixlib.h" +#include "unix_private.h" #include "wine/library.h" extern IMAGE_NT_HEADERS __wine_spec_nt_header; @@ -514,6 +514,7 @@ void __wine_main( int argc, char *argv[], char *envp[] ) __wine_main_argc = argc; __wine_main_argv = argv; __wine_main_environ = envp; + virtual_init(); module = load_ntdll(); fixup_ntdll_imports( &__wine_spec_nt_header, module ); diff --git a/dlls/ntdll/unix/unix_private.h b/dlls/ntdll/unix/unix_private.h new file mode 100644 index 0000000000..071db90218 --- /dev/null +++ b/dlls/ntdll/unix/unix_private.h @@ -0,0 +1,28 @@ +/* + * Ntdll Unix private interface + * + * Copyright (C) 2020 Alexandre Julliard + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#ifndef __NTDLL_UNIX_PRIVATE_H +#define __NTDLL_UNIX_PRIVATE_H + +#include "unixlib.h" + +extern void virtual_init(void) DECLSPEC_HIDDEN; + +#endif /* __NTDLL_UNIX_PRIVATE_H */ diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c new file mode 100644 index 0000000000..21201c298c --- /dev/null +++ b/dlls/ntdll/unix/virtual.c @@ -0,0 +1,213 @@ +/* + * Unix interface for virtual memory functions + * + * Copyright (C) 2020 Alexandre Julliard + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#if 0 +#pragma makedep unix +#endif + +#include "config.h" +#include "wine/port.h" + +#include <assert.h> +#include <stdarg.h> +#ifdef HAVE_SYS_MMAN_H +# include <sys/mman.h> +#endif +#if defined(__APPLE__) +# include <mach/mach_init.h> +# include <mach/mach_vm.h> +#endif + +#include <stdio.h> + +#include "ntstatus.h" +#define WIN32_NO_STATUS +#define NONAMELESSUNION +#define NONAMELESSSTRUCT +#include "windef.h" +#include "winnt.h" +#include "winternl.h" +#include "unixlib.h" +#include "wine/library.h" + +struct preload_info +{ + void *addr; + size_t size; +}; + +static const unsigned int granularity_mask = 0xffff; /* reserved areas have 64k granularity */ + +extern IMAGE_NT_HEADERS __wine_spec_nt_header; + +#ifndef MAP_NORESERVE +#define MAP_NORESERVE 0 +#endif +#ifndef MAP_TRYFIXED +#define MAP_TRYFIXED 0 +#endif + + +static void reserve_area( void *addr, void *end ) +{ +#ifdef __APPLE__ + +#ifdef __i386__ + static const mach_vm_address_t max_address = VM_MAX_ADDRESS; +#else + static const mach_vm_address_t max_address = MACH_VM_MAX_ADDRESS; +#endif + mach_vm_address_t address = (mach_vm_address_t)addr; + mach_vm_address_t end_address = (mach_vm_address_t)end; + + if (!end_address || max_address < end_address) + end_address = max_address; + + while (address < end_address) + { + mach_vm_address_t hole_address = address; + kern_return_t ret; + mach_vm_size_t size; + vm_region_basic_info_data_64_t info; + mach_msg_type_number_t count = VM_REGION_BASIC_INFO_COUNT_64; + mach_port_t dummy_object_name = MACH_PORT_NULL; + + /* find the mapped region at or above the current address. */ + ret = mach_vm_region(mach_task_self(), &address, &size, VM_REGION_BASIC_INFO_64, + (vm_region_info_t)&info, &count, &dummy_object_name); + if (ret != KERN_SUCCESS) + { + address = max_address; + size = 0; + } + + if (end_address < address) + address = end_address; + if (hole_address < address) + { + /* found a hole, attempt to reserve it. */ + size_t hole_size = address - hole_address; + mach_vm_address_t alloc_address = hole_address; + + ret = mach_vm_map( mach_task_self(), &alloc_address, hole_size, 0, VM_FLAGS_FIXED, + MEMORY_OBJECT_NULL, 0, 0, PROT_NONE, VM_PROT_ALL, VM_INHERIT_COPY ); + if (!ret) wine_mmap_add_reserved_area( (void*)hole_address, hole_size ); + else if (ret == KERN_NO_SPACE) + { + /* something filled (part of) the hole before we could. + go back and look again. */ + address = hole_address; + continue; + } + } + address += size; + } +#else + void *ptr; + int flags = MAP_PRIVATE | MAP_ANON | MAP_NORESERVE | MAP_TRYFIXED; + size_t size = (char *)end - (char *)addr; + + if (!size) return; + + ptr = mmap( addr, size, PROT_NONE, flags, -1, 0 ); + if (ptr == addr) + { + wine_mmap_add_reserved_area( addr, size ); + return; + } + if (ptr != (void *)-1) munmap( ptr, size ); + + size = (size / 2) & ~granularity_mask; + if (size) + { + reserve_area( addr, (char *)addr + size ); + reserve_area( (char *)addr + size, end ); + } +#endif /* __APPLE__ */ +} + + +static void mmap_init( const struct preload_info *preload_info ) +{ +#ifdef __i386__ +#ifndef __APPLE__ + char stack; + char * const stack_ptr = &stack; +#endif + char *user_space_limit = (char *)0x7ffe0000; + int i; + + if (preload_info) + { + /* check for a reserved area starting at the user space limit */ + /* to avoid wasting time trying to allocate it again */ + for (i = 0; preload_info[i].size; i++) + { + if ((char *)preload_info[i].addr > user_space_limit) break; + if ((char *)preload_info[i].addr + preload_info[i].size > user_space_limit) + { + user_space_limit = (char *)preload_info[i].addr + preload_info[i].size; + break; + } + } + } + else reserve_area( (void *)0x00010000, (void *)0x40000000 ); + + +#ifndef __APPLE__ + if (stack_ptr >= user_space_limit) + { + char *end = 0; + char *base = stack_ptr - ((unsigned int)stack_ptr & granularity_mask) - (granularity_mask + 1); + if (base > user_space_limit) reserve_area( user_space_limit, base ); + base = stack_ptr - ((unsigned int)stack_ptr & granularity_mask) + (granularity_mask + 1); +#if defined(linux) || defined(__FreeBSD__) || defined (__FreeBSD_kernel__) || defined(__DragonFly__) + /* Heuristic: assume the stack is near the end of the address */ + /* space, this avoids a lot of futile allocation attempts */ + end = (char *)(((unsigned long)base + 0x0fffffff) & 0xf0000000); +#endif + reserve_area( base, end ); + } + else +#endif + reserve_area( user_space_limit, 0 ); + +#elif defined(__x86_64__) || defined(__aarch64__) + + if (preload_info) return; + /* if we don't have a preloader, try to reserve the space now */ + reserve_area( (void *)0x000000010000, (void *)0x000068000000 ); + reserve_area( (void *)0x00007ff00000, (void *)0x00007fff0000 ); + reserve_area( (void *)0x7ffffe000000, (void *)0x7fffffff0000 ); + +#endif +} + +void virtual_init(void) +{ + const struct preload_info **preload_info = dlsym( RTLD_DEFAULT, "wine_main_preload_info" ); + int i; + + if (preload_info && *preload_info) + for (i = 0; (*preload_info)[i].size; i++) + wine_mmap_add_reserved_area( (*preload_info)[i].addr, (*preload_info)[i].size ); + + mmap_init( preload_info ? *preload_info : NULL ); +}
1
0
0
0
Alexandre Julliard : ntdll: Allow ntdll.so to be loaded before wine_init() has run.
by Alexandre Julliard
14 May '20
14 May '20
Module: wine Branch: master Commit: b7150570d374bf52bf30355e763ae8a70e14a5c3 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=b7150570d374bf52bf30355e…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Thu May 14 15:26:32 2020 +0200 ntdll: Allow ntdll.so to be loaded before wine_init() has run. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntdll/Makefile.in | 2 +- dlls/ntdll/loader.c | 10 +++ dlls/ntdll/ntdll.spec | 1 + dlls/ntdll/unix/loader.c | 193 ++++++++++++++++++++++++++++++++++++++++++++++- 4 files changed, 203 insertions(+), 3 deletions(-) diff --git a/dlls/ntdll/Makefile.in b/dlls/ntdll/Makefile.in index 3673f4a342..813d9a43e2 100644 --- a/dlls/ntdll/Makefile.in +++ b/dlls/ntdll/Makefile.in @@ -3,7 +3,7 @@ MODULE = ntdll.dll IMPORTLIB = ntdll IMPORTS = winecrt0 EXTRAINCL = $(UNWIND_CFLAGS) -EXTRALIBS = -lwine $(IOKIT_LIBS) $(RT_LIBS) $(PTHREAD_LIBS) $(UNWIND_LIBS) +EXTRALIBS = -lwine $(IOKIT_LIBS) $(COREFOUNDATION_LIBS) $(CORESERVICES_LIBS) $(RT_LIBS) $(PTHREAD_LIBS) $(UNWIND_LIBS) $(I386_LIBS) EXTRADLLFLAGS = -nodefaultlibs -Wl,--image-base,0x7bc00000 C_SRCS = \ diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c index bd13d17b2e..35dc7e1eaa 100644 --- a/dlls/ntdll/loader.c +++ b/dlls/ntdll/loader.c @@ -4437,3 +4437,13 @@ void __wine_process_init(void) server_init_process_done(); } + +/*********************************************************************** + * __wine_set_unix_funcs + */ +void CDECL __wine_set_unix_funcs( int version, const struct unix_funcs *funcs ) +{ + assert( version == NTDLL_UNIXLIB_VERSION ); + unix_funcs = funcs; + __wine_process_init(); +} diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec index 136d98f6d8..1326c62fcf 100644 --- a/dlls/ntdll/ntdll.spec +++ b/dlls/ntdll/ntdll.spec @@ -1573,6 +1573,7 @@ @ cdecl wine_server_release_fd(long long) @ cdecl wine_server_send_fd(long) @ cdecl __wine_make_process_system() +@ cdecl __wine_set_unix_funcs(long ptr) @ extern -arch=i386 __wine_ldt_copy # Debugging diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c index 68f3723e96..4008c0a55d 100644 --- a/dlls/ntdll/unix/loader.c +++ b/dlls/ntdll/unix/loader.c @@ -27,15 +27,21 @@ #include <assert.h> #include <stdarg.h> +#include <stdio.h> #ifdef HAVE_SYS_MMAN_H # include <sys/mman.h> #endif #ifdef __APPLE__ +# include <CoreFoundation/CoreFoundation.h> +# define LoadResource MacLoadResource +# define GetCurrentThread MacGetCurrentThread +# include <CoreServices/CoreServices.h> +# undef LoadResource +# undef GetCurrentThread +# include <pthread.h> # include <mach-o/getsect.h> #endif -#include <stdio.h> - #include "ntstatus.h" #define WIN32_NO_STATUS #define NONAMELESSUNION @@ -47,6 +53,7 @@ #include "wine/library.h" extern IMAGE_NT_HEADERS __wine_spec_nt_header; +extern void CDECL __wine_set_unix_funcs( int version, const struct unix_funcs *funcs ); static inline void *get_rva( const IMAGE_NT_HEADERS *nt, ULONG_PTR addr ) { @@ -328,6 +335,42 @@ static void fixup_ntdll_imports( const IMAGE_NT_HEADERS *nt, HMODULE ntdll_modul } } +/*********************************************************************** + * load_ntdll + */ +static HMODULE load_ntdll(void) +{ + const IMAGE_NT_HEADERS *nt; + HMODULE module; + Dl_info info; + char *name; + void *handle; + + if (!dladdr( load_ntdll, &info )) + { + fprintf( stderr, "cannot get path to ntdll.so\n" ); + exit(1); + } + name = malloc( strlen(info.dli_fname) + 5 ); + strcpy( name, info.dli_fname ); + strcpy( name + strlen(info.dli_fname) - 3, ".dll.so" ); + if (!(handle = dlopen( name, RTLD_NOW ))) + { + fprintf( stderr, "failed to load %s: %s\n", name, dlerror() ); + exit(1); + } + if (!(nt = dlsym( handle, "__wine_spec_nt_header" ))) + { + fprintf( stderr, "NT header not found in %s (too old?)\n", name ); + exit(1); + } + free( name ); + module = (HMODULE)((nt->OptionalHeader.ImageBase + 0xffff) & ~0xffff); + map_so_dll( nt, module ); + return module; +} + + /*********************************************************************** * unix_funcs */ @@ -336,8 +379,154 @@ static struct unix_funcs unix_funcs = map_so_dll, }; + +#ifdef __APPLE__ +struct apple_stack_info +{ + void *stack; + size_t desired_size; +}; + +static void *apple_wine_thread( void *arg ) +{ + __wine_set_unix_funcs( NTDLL_UNIXLIB_VERSION, &unix_funcs ); + return NULL; +} + +/*********************************************************************** + * apple_alloc_thread_stack + * + * Callback for wine_mmap_enum_reserved_areas to allocate space for + * the secondary thread's stack. + */ +#ifndef _WIN64 +static int apple_alloc_thread_stack( void *base, size_t size, void *arg ) +{ + struct apple_stack_info *info = arg; + + /* For mysterious reasons, putting the thread stack at the very top + * of the address space causes subsequent execs to fail, even on the + * child side of a fork. Avoid the top 16MB. */ + char * const limit = (char*)0xff000000; + if ((char *)base >= limit) return 0; + if (size > limit - (char*)base) + size = limit - (char*)base; + if (size < info->desired_size) return 0; + info->stack = wine_anon_mmap( (char *)base + size - info->desired_size, + info->desired_size, PROT_READ|PROT_WRITE, MAP_FIXED ); + return (info->stack != (void *)-1); +} +#endif + +/*********************************************************************** + * apple_create_wine_thread + * + * Spin off a secondary thread to complete Wine initialization, leaving + * the original thread for the Mac frameworks. + * + * Invoked as a CFRunLoopSource perform callback. + */ +static void apple_create_wine_thread( void *arg ) +{ + int success = 0; + pthread_t thread; + pthread_attr_t attr; + + if (!pthread_attr_init( &attr )) + { +#ifndef _WIN64 + struct apple_stack_info info; + + /* Try to put the new thread's stack in the reserved area. If this + * fails, just let it go wherever. It'll be a waste of space, but we + * can go on. */ + if (!pthread_attr_getstacksize( &attr, &info.desired_size ) && + wine_mmap_enum_reserved_areas( apple_alloc_thread_stack, &info, 1 )) + { + wine_mmap_remove_reserved_area( info.stack, info.desired_size, 0 ); + pthread_attr_setstackaddr( &attr, (char*)info.stack + info.desired_size ); + } +#endif + + if (!pthread_attr_setdetachstate( &attr, PTHREAD_CREATE_JOINABLE ) && + !pthread_create( &thread, &attr, apple_wine_thread, NULL )) + success = 1; + + pthread_attr_destroy( &attr ); + } + if (!success) exit(1); +} + + +/*********************************************************************** + * apple_main_thread + * + * Park the process's original thread in a Core Foundation run loop for + * use by the Mac frameworks, especially receiving and handling + * distributed notifications. Spin off a new thread for the rest of the + * Wine initialization. + */ +static void apple_main_thread(void) +{ + CFRunLoopSourceContext source_context = { 0 }; + CFRunLoopSourceRef source; + + if (!pthread_main_np()) return; + + /* Multi-processing Services can get confused about the main thread if the + * first time it's used is on a secondary thread. Use it here to make sure + * that doesn't happen. */ + MPTaskIsPreemptive(MPCurrentTaskID()); + + /* Give ourselves the best chance of having the distributed notification + * center scheduled on this thread's run loop. In theory, it's scheduled + * in the first thread to ask for it. */ + CFNotificationCenterGetDistributedCenter(); + + /* We use this run loop source for two purposes. First, a run loop exits + * if it has no more sources scheduled. So, we need at least one source + * to keep the run loop running. Second, although it's not critical, it's + * preferable for the Wine initialization to not proceed until we know + * the run loop is running. So, we signal our source immediately after + * adding it and have its callback spin off the Wine thread. */ + source_context.perform = apple_create_wine_thread; + source = CFRunLoopSourceCreate( NULL, 0, &source_context ); + CFRunLoopAddSource( CFRunLoopGetCurrent(), source, kCFRunLoopCommonModes ); + CFRunLoopSourceSignal( source ); + CFRelease( source ); + CFRunLoopRun(); /* Should never return, except on error. */ +} +#endif /* __APPLE__ */ + +/*********************************************************************** + * __wine_main + * + * Main entry point called by the wine loader. + */ +void __wine_main( int argc, char *argv[], char *envp[] ) +{ + extern int __wine_main_argc; + extern char **__wine_main_argv; + extern char **__wine_main_environ; + HMODULE module; + + wine_init_argv0_path( argv[0] ); + __wine_main_argc = argc; + __wine_main_argv = argv; + __wine_main_environ = envp; + + module = load_ntdll(); + fixup_ntdll_imports( &__wine_spec_nt_header, module ); +#ifdef __APPLE__ + apple_main_thread(); +#endif + __wine_set_unix_funcs( NTDLL_UNIXLIB_VERSION, &unix_funcs ); +} + /*********************************************************************** * __wine_init_unix_lib + * + * Lib entry point called by ntdll.dll.so if not yet initialized. */ NTSTATUS __cdecl __wine_init_unix_lib( HMODULE module, const void *ptr_in, void *ptr_out ) {
1
0
0
0
Alexandre Julliard : ntdll: Initial version of the ntdll.so Unix library.
by Alexandre Julliard
14 May '20
14 May '20
Module: wine Branch: master Commit: b7b1ad09629a6678383a5ae791a9507c9eb87be3 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=b7b1ad09629a6678383a5ae7…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Thu May 14 15:17:06 2020 +0200 ntdll: Initial version of the ntdll.so Unix library. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntdll/Makefile.in | 1 + dlls/ntdll/loader.c | 225 +++++------------------------- dlls/ntdll/ntdll_misc.h | 2 + dlls/ntdll/unix/loader.c | 356 +++++++++++++++++++++++++++++++++++++++++++++++ dlls/ntdll/unixlib.h | 32 +++++ 5 files changed, 428 insertions(+), 188 deletions(-) Diff:
https://source.winehq.org/git/wine.git/?a=commitdiff;h=b7b1ad09629a6678383a…
1
0
0
0
Alexandre Julliard : makefiles: Add support for building Unix .so libraries.
by Alexandre Julliard
14 May '20
14 May '20
Module: wine Branch: master Commit: b7e3c931598cc17db7a3f916d9e2730fe602b48a URL:
https://source.winehq.org/git/wine.git/?a=commit;h=b7e3c931598cc17db7a3f916…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Thu May 14 14:03:40 2020 +0200 makefiles: Add support for building Unix .so libraries. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- tools/makedep.c | 126 ++++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 81 insertions(+), 45 deletions(-) Diff:
https://source.winehq.org/git/wine.git/?a=commitdiff;h=b7e3c931598cc17db7a3…
1
0
0
0
Alexandre Julliard : winegcc: Allow the output file to end in .so.
by Alexandre Julliard
14 May '20
14 May '20
Module: wine Branch: master Commit: 469058acc17ace339bf30a693d8d635ff1e0dbd6 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=469058acc17ace339bf30a69…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Thu May 14 14:01:24 2020 +0200 winegcc: Allow the output file to end in .so. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- tools/winegcc/winegcc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/winegcc/winegcc.c b/tools/winegcc/winegcc.c index 920ede6c3d..c966c08665 100644 --- a/tools/winegcc/winegcc.c +++ b/tools/winegcc/winegcc.c @@ -1107,12 +1107,12 @@ static void build(struct options* opts) if (strendswith(output_file, ".fake")) fake_module = 1; /* normalize the filename a bit: strip .so, ensure it has proper ext */ - if (strendswith(output_file, ".so")) - output_file[strlen(output_file) - 3] = 0; if ((output_name = strrchr(output_file, '/'))) output_name++; else output_name = output_file; if (!strchr(output_name, '.')) output_file = strmake("%s.%s", output_file, opts->shared ? "dll" : "exe"); + else if (strendswith(output_file, ".so")) + output_file[strlen(output_file) - 3] = 0; output_path = is_pe ? output_file : strmake( "%s.so", output_file ); /* get the filename from the path */
1
0
0
0
Jacek Caban : makedep: Support split debug for cross compiled modules.
by Alexandre Julliard
14 May '20
14 May '20
Module: wine Branch: master Commit: 83d00d328f58f910a9b197e0a465b110cbdc727c URL:
https://source.winehq.org/git/wine.git/?a=commit;h=83d00d328f58f910a9b197e0…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Thu May 14 16:40:21 2020 +0200 makedep: Support split debug for cross compiled modules. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- tools/makedep.c | 41 ++++++++++++++++++++++++++++++++++++----- 1 file changed, 36 insertions(+), 5 deletions(-) diff --git a/tools/makedep.c b/tools/makedep.c index fb2e145ced..3884ce3ace 100644 --- a/tools/makedep.c +++ b/tools/makedep.c @@ -152,6 +152,7 @@ static const char *exe_ext; static const char *dll_ext; static const char *man_ext; static const char *crosstarget; +static const char *crossdebug; static const char *fontforge; static const char *convert; static const char *flex; @@ -214,6 +215,7 @@ struct makefile struct strarray unixobj_files; struct strarray res_files; struct strarray c2man_files; + struct strarray debug_files; struct strarray dlldata_files; struct strarray implib_objs; struct strarray all_targets; @@ -2341,6 +2343,20 @@ static struct strarray get_source_defines( struct makefile *make, struct incl_fi } +/******************************************************************* + * get_debug_file + */ +static const char *get_debug_file( struct makefile *make, const char *name ) +{ + const char *debug_file = NULL; + if (!make->is_cross || !crossdebug) return NULL; + if (!strcmp( crossdebug, "pdb" )) debug_file = strmake( "%s.pdb", get_base_name( name )); + else if(!strncmp( crossdebug, "split", 5 )) debug_file = strmake( "%s.debug", name ); + if (debug_file) strarray_add( &make->debug_files, debug_file ); + return debug_file; +} + + /******************************************************************* * output_winegcc_command */ @@ -2998,7 +3014,8 @@ static void output_source_spec( struct makefile *make, struct incl_file *source, struct strarray imports = get_expanded_file_local_var( make, obj, "IMPORTS" ); struct strarray dll_flags = get_expanded_file_local_var( make, obj, "EXTRADLLFLAGS" ); struct strarray all_libs, dep_libs = empty_strarray; - char *dll_name, *obj_name; + char *dll_name, *obj_name, *output_file; + const char *debug_file; if (!imports.count) imports = make->imports; if (!dll_flags.count) dll_flags = make->extradllflags; @@ -3006,14 +3023,15 @@ static void output_source_spec( struct makefile *make, struct incl_file *source, add_import_libs( make, &dep_libs, get_default_imports( make ), 0 ); /* dependencies only */ dll_name = strmake( "%s.dll%s", obj, make->is_cross ? "" : dll_ext ); obj_name = strmake( "%s%s", obj_dir_path( make, obj ), make->is_cross ? ".cross.o" : ".o" ); + output_file = obj_dir_path( make, dll_name ); strarray_add( &make->clean_files, dll_name ); strarray_add( &make->res_files, strmake( "%s.res", obj )); output( "%s.res: %s\n", obj_dir_path( make, obj ), obj_dir_path( make, dll_name )); - output( "\techo \"%s.dll TESTDLL \\\"%s\\\"\" | %s -u -o $@\n", obj, - obj_dir_path( make, dll_name ), tools_path( make, "wrc" )); + output( "\techo \"%s.dll TESTDLL \\\"%s\\\"\" | %s -u -o $@\n", obj, output_file, + tools_path( make, "wrc" )); - output( "%s:", obj_dir_path( make, dll_name )); + output( "%s:", output_file); output_filename( source->filename ); output_filename( obj_name ); output_filenames( dep_libs ); @@ -3026,6 +3044,8 @@ static void output_source_spec( struct makefile *make, struct incl_file *source, output_filename( "-shared" ); output_filename( source->filename ); output_filename( obj_name ); + if ((debug_file = get_debug_file( make, output_file ))) + output_filename( strmake( "-Wl,--debug-file,%s", debug_file )); output_filenames( all_libs ); output_filename( make->is_cross ? "$(CROSSLDFLAGS)" : "$(LDFLAGS)" ); output( "\n" ); @@ -3222,6 +3242,7 @@ static void output_module( struct makefile *make ) struct strarray all_libs = empty_strarray; struct strarray dep_libs = empty_strarray; char *module_path = obj_dir_path( make, make->module ); + const char *debug_file = NULL; char *spec_file = NULL; unsigned int i; @@ -3241,6 +3262,7 @@ static void output_module( struct makefile *make ) strarray_add( &make->all_targets, strmake( "%s", make->module )); add_install_rule( make, make->module, strmake( "%s", make->module ), strmake( "c$(dlldir)/%s", make->module )); + debug_file = get_debug_file( make, module_path ); output( "%s:", module_path ); } else @@ -3265,6 +3287,7 @@ static void output_module( struct makefile *make ) strarray_add( &make->all_targets, make->module ); add_install_rule( make, make->module, make->module, strmake( "p$(%s)/%s", spec_file ? "dlldir" : "bindir", make->module )); + debug_file = get_debug_file( make, module_path ); output( "%s:", module_path ); } } @@ -3286,6 +3309,7 @@ static void output_module( struct makefile *make ) output_filenames( make->extradllflags ); output_filenames_obj_dir( make, make->is_cross ? make->crossobj_files : make->object_files ); output_filenames_obj_dir( make, make->res_files ); + if (debug_file) output_filename( strmake( "-Wl,--debug-file,%s", debug_file )); output_filenames( all_libs ); output_filename( make->is_cross ? "$(CROSSLDFLAGS)" : "$(LDFLAGS)" ); output( "\n" ); @@ -3448,15 +3472,20 @@ static void output_test_module( struct makefile *make ) struct makefile *parent = get_parent_makefile( make ); const char *ext = make->is_cross ? "" : dll_ext; const char *parent_ext = parent && parent->is_cross ? "" : dll_ext; + const char *debug_file; + char *output_file; add_import_libs( make, &dep_libs, get_default_imports( make ), 0 ); /* dependencies only */ strarray_add( &make->all_targets, strmake( "%s%s", testmodule, ext )); strarray_add( &make->clean_files, strmake( "%s%s", stripped, ext )); - output( "%s%s:\n", obj_dir_path( make, testmodule ), ext ); + output_file = strmake( "%s%s", obj_dir_path( make, testmodule ), ext ); + output( "%s:\n", output_file ); output_winegcc_command( make ); output_filenames( make->extradllflags ); output_filenames_obj_dir( make, make->is_cross ? make->crossobj_files : make->object_files ); output_filenames_obj_dir( make, make->res_files ); + if ((debug_file = get_debug_file( make, output_file ))) + output_filename( strmake( "-Wl,--debug-file,%s", debug_file )); output_filenames( all_libs ); output_filename( make->is_cross ? "$(CROSSLDFLAGS)" : "$(LDFLAGS)" ); output( "\n" ); @@ -3899,6 +3928,7 @@ static void output_sources( struct makefile *make ) strarray_addall( &make->clean_files, make->crossobj_files ); strarray_addall( &make->clean_files, make->unixobj_files ); strarray_addall( &make->clean_files, make->res_files ); + strarray_addall( &make->clean_files, make->debug_files ); strarray_addall( &make->clean_files, make->all_targets ); strarray_addall( &make->clean_files, make->extra_targets ); @@ -4415,6 +4445,7 @@ int main( int argc, char *argv[] ) man_ext = get_expanded_make_variable( top_makefile, "api_manext" ); dll_ext = (exe_ext && !strcmp( exe_ext, ".exe" )) ? "" : ".so"; crosstarget = get_expanded_make_variable( top_makefile, "CROSSTARGET" ); + crossdebug = get_expanded_make_variable( top_makefile, "CROSSDEBUG" ); fontforge = get_expanded_make_variable( top_makefile, "FONTFORGE" ); convert = get_expanded_make_variable( top_makefile, "CONVERT" ); flex = get_expanded_make_variable( top_makefile, "FLEX" );
1
0
0
0
Jacek Caban : configure: Allow specifying cross debug format.
by Alexandre Julliard
14 May '20
14 May '20
Module: wine Branch: master Commit: 8e051c5802e60e37b2187314180e94fc4b5f8071 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=8e051c5802e60e37b2187314…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Thu May 14 16:40:03 2020 +0200 configure: Allow specifying cross debug format. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- Makefile.in | 1 + configure | 53 +++++++++++++++++++++++++++++++++++++++++++++++------ configure.ac | 24 +++++++++++++++++------- 3 files changed, 65 insertions(+), 13 deletions(-) diff --git a/Makefile.in b/Makefile.in index 0e9b50c8f5..0e1f6cd6ca 100644 --- a/Makefile.in +++ b/Makefile.in @@ -69,6 +69,7 @@ CONVERT = @CONVERT@ ICOTOOL = @ICOTOOL@ MSGFMT = @MSGFMT@ CROSSTARGET = @CROSSTARGET@ +CROSSDEBUG = @CROSSDEBUG@ SUBDIRS = @SUBDIRS@ RUNTESTFLAGS = -q -P wine MAKEDEP = $(TOOLSDIR)/tools/makedep$(TOOLSEXT) diff --git a/configure b/configure index 27fb2fd0ed..f85e18b77f 100755 --- a/configure +++ b/configure @@ -705,6 +705,7 @@ X_PRE_LIBS X_CFLAGS XMKMF PTHREAD_LIBS +CROSSDEBUG DELAYLOADFLAG CROSSLDFLAGS EXTRACROSSCFLAGS @@ -10520,9 +10521,19 @@ if test "x$ac_cv_crosscflags__Wnonnull" = xyes; then : fi ;; esac - for ac_flag in $CROSSCFLAGS; do - case $ac_flag in - -g) { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the cross-compiler supports -gdwarf-2" >&5 + + if test -z "$CROSSDEBUG" + then + for ac_flag in $CROSSCFLAGS; do + case $ac_flag in + -gdwarf*) CROSSDEBUG=dwarf ;; + -gcodeview) CROSSDEBUG=pdb ;; + -g) CROSSDEBUG=${CROSSDEBUG:-dwarf} ;; + esac + done + fi + case $CROSSDEBUG in + *dwarf) { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the cross-compiler supports -gdwarf-2" >&5 $as_echo_n "checking whether the cross-compiler supports -gdwarf-2... " >&6; } if ${ac_cv_crosscflags__gdwarf_2+:} false; then : $as_echo_n "(cached) " >&6 @@ -10553,7 +10564,7 @@ $as_echo "$ac_cv_crosscflags__gdwarf_2" >&6; } if test "x$ac_cv_crosscflags__gdwarf_2" = xyes; then : EXTRACROSSCFLAGS="$EXTRACROSSCFLAGS -gdwarf-2" fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the cross-compiler supports -gstrict-dwarf" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the cross-compiler supports -gstrict-dwarf" >&5 $as_echo_n "checking whether the cross-compiler supports -gstrict-dwarf... " >&6; } if ${ac_cv_crosscflags__gstrict_dwarf+:} false; then : $as_echo_n "(cached) " >&6 @@ -10584,8 +10595,38 @@ $as_echo "$ac_cv_crosscflags__gstrict_dwarf" >&6; } if test "x$ac_cv_crosscflags__gstrict_dwarf" = xyes; then : EXTRACROSSCFLAGS="$EXTRACROSSCFLAGS -gstrict-dwarf" fi ;; - esac - done + pdb) { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the cross-compiler supports -gcodeview" >&5 +$as_echo_n "checking whether the cross-compiler supports -gcodeview... " >&6; } +if ${ac_cv_crosscflags__gcodeview+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_wine_try_cflags_saved=$CFLAGS +ac_wine_try_cflags_saved_cc=$CC +ac_wine_try_cflags_saved_exeext=$ac_exeext +CFLAGS="$CFLAGS $EXTRACROSSCFLAGS -nostartfiles -nodefaultlibs -gcodeview" +CC="$CROSSCC" +ac_exeext=".exe" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int __cdecl mainCRTStartup(void) { return 0; } +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_crosscflags__gcodeview=yes +else + ac_cv_crosscflags__gcodeview=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +CFLAGS=$ac_wine_try_cflags_saved +CC=$ac_wine_try_cflags_saved_cc +ac_exeext=$ac_wine_try_cflags_saved_exeext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_crosscflags__gcodeview" >&5 +$as_echo "$ac_cv_crosscflags__gcodeview" >&6; } +if test "x$ac_cv_crosscflags__gcodeview" = xyes; then : + EXTRACROSSCFLAGS="$EXTRACROSSCFLAGS -gcodeview" +fi ;; + esac if test "x$enable_werror" = "xyes" then diff --git a/configure.ac b/configure.ac index 3e0511325c..0dbcb3d095 100644 --- a/configure.ac +++ b/configure.ac @@ -1100,13 +1100,23 @@ then WINE_TRY_CROSSCFLAGS([-Wnonnull]) ;; esac - dnl Default to dwarf-2 debug info - for ac_flag in $CROSSCFLAGS; do - case $ac_flag in - -g) WINE_TRY_CROSSCFLAGS([-gdwarf-2]) - WINE_TRY_CROSSCFLAGS([-gstrict-dwarf]) ;; - esac - done + dnl Determine debug info format + AC_SUBST(CROSSDEBUG) + if test -z "$CROSSDEBUG" + then + for ac_flag in $CROSSCFLAGS; do + case $ac_flag in + -gdwarf*) CROSSDEBUG=dwarf ;; + -gcodeview) CROSSDEBUG=pdb ;; + -g) CROSSDEBUG=${CROSSDEBUG:-dwarf} ;; + esac + done + fi + case $CROSSDEBUG in + *dwarf) WINE_TRY_CROSSCFLAGS([-gdwarf-2]) + WINE_TRY_CROSSCFLAGS([-gstrict-dwarf]) ;; + pdb) WINE_TRY_CROSSCFLAGS([-gcodeview]) ;; + esac if test "x$enable_werror" = "xyes" then
1
0
0
0
← Newer
1
...
39
40
41
42
43
44
45
...
75
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
Results per page:
10
25
50
100
200