Commit graph

1339 commits

Author SHA1 Message Date
Brendan Shanks
4e6dbf3b9e loader: In macOS preloader, add __program_vars section.
This is needed to be a correct macOS 10.7 binary.
2023-07-18 15:16:12 +02:00
Brendan Shanks
cfa0dd9dd9 loader: On 64-bit macOS, reserve the low 8GB using a zerofill section.
A zerofill section is the only way to reserve address space and prevent
system frameworks from using it, including preventing allocations
before any preloader code runs:
- starting with Ventura, dyld allocates private memory from 0x1000-0x81000.
  This breaks EXEs that have an image base of 0x10000.
- Rosetta allocates memory starting at 0x100000000, which breaks EXEs based there.
- starting with Monterey, for proper 10.7 binaries (which include a __program_vars section),
  libSystem initializes itself before the preloader runs. This fragments the <4GB
  address space which is needed for Wow64.

This will need to be adjusted if any EXEs based at 0x200000000 or higher
are found.
2023-07-18 15:16:12 +02:00
Jinoh Kang
966233aee6 loader: Set the visibility of symbols in preloader to "hidden".
Today, the preloader is linked with -fPIE in spite of the fact that the
preloader is a non-PIE statically linked binary.  This is due to a
limitation in tools/makedep that makes it difficult to specify CFLAGS
for each individual object file's recipe.

This can seemingly cause problems with some GOTPCREL(X) relocations
inside the preloader. Since preloader does not link to the system
library directly, there is no need for a Global Offset Table (GOT).
However, a few extern (non-static) function symbols are declared, the
use of which makes GCC emit instructions that references those symbols
by indirection through GOT.  The linker then tries to optimize such
instructions to eliminate GOT references, which can fail due to various
reasons.

This stands in contradiction with Jinoh Kang's suggestion (in bug 55050)
that "-fPIE is harmless even when applied to an object linked into
non-PIE executables." The claim is theoretically true since
position-independent code can in principle be relocated to any address
(fixed or dynamic); however, it fails due to some peculiar practical
issues, which is arguably a limitation in the linker's implementation
(since it can be worked around with -Wl,--no-relax without issues).

Fix this by eliminating GOT usage by setting the default visibility of
non-static declarations to "hidden". Assuming GCC's medium code model
(-mcmodel=medium; default code model for x86_64), this suppresses any
unnecessary PLT or GOT relocations for defined symbols, and provides
opportunity for GCC to optimize the code better.

Fixes: 78ed343842
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=55091
2023-06-20 20:27:45 +02:00
Alexandre Julliard
ac1761d1da loader: Build the preloader as PIE on 64-bit. 2023-06-19 17:32:24 +02:00
Alexandre Julliard
78ed343842 loader: Force building the main loader as PIE on 64-bit.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=55050
2023-06-19 17:30:45 +02:00
Tim Clem
6b0836e3f1 loader: Reserve some space for 32-bit top-down allocations on 64-bit. 2023-05-31 22:50:10 +02:00
Hans Leidekker
956e580f06 wine.inf: Use FLG_ADDREG_NOCLOBBER for CurrentMajor/MinorVersionNumber.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=54844
2023-04-17 18:55:41 +02:00
Sven Baars
cabd68728d wine.inf: Put the Clients key in the right place. 2023-03-29 22:29:37 +02:00
Louis Lenders
e8b0c92395 wine.inf: Add EditionID to HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=54675
2023-03-27 15:48:14 +02:00
Brendan Shanks
93941d6ec6 loader: In macOS preloader, stop using mincore() to test if a region is empty. 2023-03-06 11:09:29 +01:00
Brendan Shanks
c10207e2a7 loader: In macOS preloader, move the top-down allocations area down.
On Ventura, the Rosetta runtime and dyld shared cache now reach down
to 0x7ff7fffb8000 on my system.
2023-03-06 11:09:21 +01:00
Alexandre Julliard
7611492ddc wine.inf: Add keys for the platform-specific Wow64 backend. 2023-03-02 18:12:52 +01:00
Alexandre Julliard
aebc819abf wine.inf: Set Program Files variables separately for all WoW platforms. 2023-03-02 18:12:28 +01:00
Alexandre Julliard
863858da2a wine.inf: Remove redundant platform-specific sections. 2023-03-02 18:11:32 +01:00
Shaun Ren
d83e03f638 wine.inf: Enable ir50_32 video codec. 2023-02-13 21:39:40 +01:00
Brendan Shanks
36bb7175c1 loader: In macOS preloader, fix an environment variable sometimes being lost. 2023-02-08 09:01:34 +01:00
Zebediah Figura
aff181e6d9 scardsvr: Add stub service.
The Rutoken driver installer tries to start this service, and fails if it
doesn't exist.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=54396
2023-02-08 08:58:25 +01:00
Zebediah Figura
c08310a882 wine.inf: Always use FLG_ADDREG_APPEND for SvcHost entries.
Now that FLG_ADDREG_APPEND is changed to correctly create the value if it
doesn't exist, this is safe, and less error-prone when adding new services.
2023-02-08 08:58:10 +01:00
Hans Leidekker
69154f0329 ntdll: Default to Windows 10. 2023-02-01 17:11:47 +01:00
Floris Renaud
11bd4b53a9 loader: Document the WINE_D3D_CONFIG environment variable. 2023-01-24 15:22:49 +01:00
Brendan Shanks
f99eef6847 loader: In macOS preloader, set NXArgc, NXArgv, and environ on i386 and x86_64. 2022-12-07 23:20:39 +01:00
Piotr Caban
b090025479 wineps: Register print processor. 2022-12-07 17:10:26 +01:00
Piotr Caban
28aa2017d7 wine.inf: Also install wineps.drv to print processor directory. 2022-12-07 17:10:23 +01:00
Piotr Caban
3285363da6 winprint: Register winprint print processor. 2022-12-05 20:04:54 +01:00
Brendan Shanks
9ab93415f7 loader: In macOS preloader, manually set 'environ' to work around a bug in macOS 12 and later.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=54009
2022-12-01 10:25:19 +01:00
Brendan Shanks
588e555425 loader: In macOS preloader, fix up argc/argv in C rather than asm. 2022-12-01 10:25:19 +01:00
Brendan Shanks
4ec770a139 loader: Add comments to 'start' in macOS preloader. 2022-12-01 10:25:19 +01:00
Piotr Caban
b7d7b23a61 winprint: Add stub dll. 2022-11-21 18:03:53 +01:00
Martin Storsjö
f760976803 ntdll: Add ARM EHABI unwind instructions in assembly functions.
On most ELF platforms on ARM, ARM EHABI is the unwind info
format normally used, instead of DWARF like on most other platforms.

Currently, when unwinding through ELF objects with libunwind, the
libraries don't have any .eh_frame section mapped at runtime (since
DWARF isn't used for unwinding). Instead, what happens is that
libunwind ends up loading .debug_frame from the libraries on disk
instead.

Therefore, currently, ELF unwinding relies on the .so files not being
stripped.

This patch adds the necessary EHABI unwinding instructions in the
assembly functions that currently have DWARF CFI instructions.

EHABI isn't signaled via any specific preprocessor macro, but
is signaled by the absence of other unwind mechanisms (such
as __ARM_DWARF_EH__ and __SEH__, or maybe SjLj).

Mark the asm functions in the preloaders as .cantunwind, to avoid
undefined references to __aeabi_unwind_cpp_pr* functions.

Also mark other assembly functions as .cantunwind; for
signal_exit_thread this is essential if the function is marked
with .fnstart/.fnend - otherwise exiting threads does hang.
(pthread_exit internally calls _Unwind_ForcedUnwind, which would
hang if signal_exit_thread had .fnstart without any matching unwind
info).

This would, in principle, allow unwinding through these functions with
libunwind, for versions of libunwind that can parse the EHABI unwind
info - see e.g.
4d779f55c0.
(This commit isn't yet in any current release AFAIK). Unwinding with
EHABI via libunwind would require a few tweaks to the libunwind interface
usage in unix/signal_arm.c though, since e.g. the unw_get_proc_info call
fails if there's no .eh_frame or .debug_frame available.

Signed-off-by: Martin Storsjö <martin@martin.st>
2022-11-07 10:28:18 +01:00
Gerald Pfeifer
699067ae14 loader: Unbreak FreeBSD builds (ARRAY_SIZE undefined).
Commit af996344a8 used ARRAY_SIZE in
FreeBSD-specifc code which, alas, is not available here, so revert
that change.
2022-10-31 12:11:55 +01:00
Michael Stefaniuc
af996344a8 loader: Use ARRAY_SIZE instead of open coding it. 2022-10-25 10:58:49 +02:00
Paul Gofman
e0d8bd3f5a loader/wine.inf: Add runas shell execute verb.
Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
2022-07-19 20:05:47 +02:00
Jinoh Kang
38dfa2f455 loader: Fix return type of get_auxiliary().
This is required for fetching pointer-valued vectors (e.g.
AT_SYSINFO_EHDR).

Signed-off-by: Jinoh Kang <jinoh.kang.kr@gmail.com>
2022-07-04 20:14:02 +02:00
Alexandre Julliard
3ec7c467cd make_unicode: Generate the time zone registry keys.
Based on a script written by Giovanni Mascellani.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-06-24 21:05:26 +02:00
Giovanni Mascellani
622befd2a9 loader/wine.inf: Update time zone data.
New time zone data were generated from CLDR release 41 and tzdata
release 2022a.

Signed-off-by: Giovanni Mascellani <gmascellani@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-04-28 12:50:18 +02:00
Alexandre Julliard
989f7d6481 make_unicode: Generate the language groups registry keys.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-03-24 23:22:06 +01:00
Alexandre Julliard
8cdb593f5a make_unicode: Generate locale.nls using the Unicode CLDR data.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-03-21 14:28:09 +01:00
Alexandre Julliard
2b963bf519 mlang: Register MIME charsets from the registry script.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-03-18 17:22:02 +01:00
Alexandre Julliard
8adebaaab7 mlang: Use a registry script to register codepages.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-03-18 17:22:02 +01:00
Zhiyi Zhang
ccc2c6c613 wine.inf: Enable Light theme by default.
Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-03-02 20:17:25 +01:00
Esme Povirk
ee6bee6a45 diasymreader: Add stub dll.
Signed-off-by: Esme Povirk <esme@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-01-31 18:38:54 +01:00
Arkadiusz Hiler
2f2aba45dd hidclass.sys: Add input.inf that matches all HID devices.
This makes it so that all the devices on the HID bus now have Class,
ClassGUID, Driver and DriverDesc register properties populated.

Without having at least Driver and Class set SDL2 refuses to use HID
devices directly.

Signed-off-by: Arkadiusz Hiler <ahiler@codeweavers.com>
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-01-28 21:10:21 +01:00
Rémi Bernon
0c88a52440 wine.inf: Start EventLogService on prefix initialization.
The service has StartType=2, and should start automatically.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-01-27 18:02:49 +01:00
Rémi Bernon
b0ca06efd1 wine.inf: Start PlugPlay service on prefix initialization.
Device drivers may be installed and started on prefix initialization but
if PlugPlay is missing they won't be able to send plugplay notifications
until the prefix is restarted.

The service has StartType=2, and should start automatically.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-01-27 18:02:28 +01:00
Giovanni Mascellani
929face084 wine.inf: Regenerate time zones.
Unicode CLDR release 40 and tzdata 2021e were used.

Signed-off-by: Giovanni Mascellani <gmascellani@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-21 13:32:08 +01:00
Alexandre Julliard
e3001b6a7c configure: Assume that sys/mman.h is available on Unix.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-09 18:43:51 +01:00
Loïc Rebmeister
2173d2dcc8 loader: Create performance\winsat\datastore on prefix creation.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51968
Signed-off-by: Loïc Rebmeister <fox2code@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-04 17:54:34 +01:00
Alistair Leslie-Hughes
48cc6ce421 msdasql: New DLL.
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-25 21:18:42 +02:00
Damjan Jovanovic
f5e51cfc55 loader: Use sysctl instead of /proc/curproc/file on FreeBSD.
Signed-off-by: Damjan Jovanovic <damjan.jov@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-25 18:50:59 +02:00
Alexandre Julliard
28d7d5ba93 loader: Avoid including wine/port.h.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-20 16:16:07 +02:00