Sweden-Number/tools
Martin Storsjö 9e9509f307 winebuild: Fix relay entry points in Thumb mode with binutils/ELF and LLVM/PE.
b1fe783ade fixed relay entry points
in Thumb mode when assembled with Clang/LLVM in ELF mode, but broke
them when assembled with binutils as (and PE mode with LLVM didn't
work either before or after).

When/where the thumb bit is applied on symbols varies a lot between
assemblers; this is a notoriously vague and undocumented area.

After a .thumb_func directive, binutils as considers the next
non-local symbol as a thumb symbol, to have the thumb bit set.
LLVM's built-in assembler considers the next symbol, local or not,
to be a thumb symbol. (Just noting for reference for possible
solutions, this particular difference didn't play a role so far.)

Secondly, in a symbol difference expression like this:

    .long symbol1 - symbol2

Binutils as ignores the potential thumb state for both symbols and
just calculates the raw distance. LLVM does include the thumb bit
in symbol1 but ignores it in symbol2.

Finally, for PE targets, the linker sets the thumb bit on all
absolute addresses pointing to the text section, regardless of any
.thumb_func directives at assembly time. (I.e., the
__wine_spec_relay_entry_points entry in .L__wine_spec_relay_descr
gets the bit set even if it wasn't marked as .thumb_func.)

Therefore, mark __wine_spec_relay_entry_points as .thumb_func, as
the absolute address to it will end up with the thumb bit set in
PE builds in any case.

Don't mark the individual relay entry pointers as thumb functions
(the code still is generated as thumb as there hasn't been any
mode switch back to arm mode); this makes the differences calculated
correctly (both LLVM and binutils ignore the thumb state of the
subtracted label).

If desired, one could change __wine_spec_relay_entry_point_%d into
local labels with a .L prefix, just as before
b1fe783ade again, it doesn't make
any difference in this form.

Signed-off-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-05 11:58:42 +01:00
..
sfnt2fon tools: Avoid using wine/port.h. 2021-10-07 18:03:11 +02:00
widl widl: Use sysctl instead of /proc/curproc/file on FreeBSD. 2021-10-25 18:50:59 +02:00
winapi include: Define _WINSOCKAPI_ in winsock2.h. 2021-04-27 18:55:24 +02:00
winebuild winebuild: Fix relay entry points in Thumb mode with binutils/ELF and LLVM/PE. 2021-11-05 11:58:42 +01:00
winedump mscvpdb.h: Update some line number oriented definitions. 2021-11-02 20:32:51 +01:00
winegcc winegcc: Use sysctl instead of /proc/curproc/file on FreeBSD. 2021-10-25 18:50:59 +02:00
winemaker winemaker: Fix --single-target option parsing. 2019-03-13 23:40:39 +01:00
wmc wmc: Remove struct and enum typedefs. 2021-10-26 10:39:34 +02:00
wrc wrc: Use sysctl instead of /proc/curproc/file on FreeBSD. 2021-10-25 18:50:59 +02:00
Makefile.in makefiles: Always build .in files. 2015-11-10 18:28:28 +09:00
buildimage winecfg: Store the logo image in PNG format. 2021-10-18 15:56:01 +02:00
c2man.pl c2man.pl: Move WineHQ URLs to https. 2017-12-01 09:29:41 +01:00
config.guess tools: Upgrade the config.guess/config.sub scripts. 2020-08-14 22:04:03 +02:00
config.sub tools: Upgrade the config.guess/config.sub scripts. 2020-08-14 22:04:03 +02:00
examine-relay
findfunc
install-sh tools: Upgrade the autoconf scripts. 2019-12-18 17:56:21 +01:00
make_announce make_announce: Update version number parsing for the new versioning scheme. 2017-01-31 15:58:43 +01:00
make_makefiles makefiles: Use the STATICLIB variable for static import libraries. 2021-10-06 20:29:34 +02:00
make_requests server: Send HID report data with the WM_INPUT messages. 2021-05-31 12:31:21 +02:00
make_specfiles cng.sys: New dll. 2021-10-25 18:53:31 +02:00
make_unicode dwrite: Add properties for new Unicode 13 scripts. 2021-10-18 16:01:34 +02:00
make_xftmpl.c tools: Avoid using wine/port.h. 2021-10-07 18:03:11 +02:00
makedep.c makefiles: Add support for importing PE system libraries using the -l option. 2021-10-25 11:05:07 +02:00
runtest makefiles: Default to building test modules as PE. 2019-04-09 15:45:59 +02:00
tools.h configure: Don't define _WIN32 for Cygwin builds. 2021-10-14 11:07:56 +02:00
wineapploader.in tools: Allow running installed builtin apps even when the 32-bit loader is missing. 2015-12-04 21:56:20 +09:00
winewrapper winewrapper: Add dlls/ntdll to the library path so macOS can find ntdll.so. 2021-08-23 11:54:18 +02:00