Commit graph

346 commits

Author SHA1 Message Date
Jacek Caban
cc91a2f933 winegcc: Use -nostdlib instead of -nostartfiles on Clang MSVC targets.
-nostartfiles is not enough if clang is configured with explicit default rtlib.
2022-11-28 21:01:55 +01:00
Alexandre Julliard
c1a00d4b5a winegcc: Default to msvcrt mode for all PE builds. 2022-11-16 21:24:19 +01:00
Alexandre Julliard
f57c8d68bd winegcc: Remove support for "hybrid" Unix libraries. 2022-11-11 12:07:13 +01:00
Martin Storsjö
6705a71045 winegcc: Prefer -Wl,--pdb=<file> over -Wl,-pdb,<file>.
The previously used syntax, -Wl,-pdb,<file>, was the originally
supported one in lld (since 2018). Later (in 2019) the second
syntax was added, allowing both -Wl,-pdb=<file> and -Wl,-pdb,<file>.
(This other parameter syntax allows easier distinguishing an empty
argument, for letting the linker implicitly pick the file name.)

Move over to using the more modern syntax - reducing the usage of
the old form of the option. This potentially allows deprecating
the original syntax and maybe allows using --pdb as a boolean
flag for implying an automatically named PDB file (which currently
requires using the awkward syntax "--pdb=").

Also prefer the long two dashes form, i.e. --pdb instead of -pdb;
the single dash form is only allowed by getopt when there
are no conflicts with single-letter options, while the form with
two dashes is unambiguous.
2022-11-01 20:46:22 +01:00
Alexandre Julliard
6a91264918 makefiles: Store PE objects in subdirectories in the build tree.
This will make it possible to build multiple PE architectures.
2022-10-26 15:03:05 +02:00
Michael Stefaniuc
b46eef7e2a winegcc: Use ARRAY_SIZE instead of open coding it. 2022-10-25 10:59:05 +02:00
Tatsuyuki Ishi
510cfd2762 winegcc: Identify ar files through signature.
Rust uses the ".rlib" extension for intermediate libraries which it
passes to the linker. Detect them through signature so that winegcc will
not try to compile it.

Signed-off-by: Tatsuyuki Ishi <ishitatsuyuki@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-03-24 09:53:59 +01:00
Brendan Shanks
7b27e60e67 makefiles: On macOS, use @rpath instead of @loader_path when building Unix libs.
Fixes launching 32-bit EXEs from a WOW64 build dir.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52618
Signed-off-by: Brendan Shanks <bshanks@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-03-08 09:32:37 +01:00
Alexandre Julliard
1662af11a4 winegcc: Add support for winebuild --data-only option.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-02-16 22:05:33 +01:00
Alexandre Julliard
62f9bd39a2 tools: Consistently use xmalloc/xrealloc/xstrdup everywhere.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-02-08 20:24:14 +01:00
Kevin Puetz
ccf7b4459b winegcc: --out-implib needs to propagate -m32/-m64 to winebuild.
This was already passed through for linking, and for spec.o files,
but was overlooked when implementing -Wl,--out-implib

Signed-off-by: Kevin Puetz <PuetzKevinA@JohnDeere.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-02-04 09:48:05 +01:00
Jacek Caban
099ba1b410 winegcc: Use libgcc on Cygwin target.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52328
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-01-05 17:16:45 +01:00
Alexandre Julliard
9ac2eecbba winegcc: Support an explicit --fake-module option.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-18 20:15:19 +01:00
Alexandre Julliard
d969d02e21 tools: Move target CPU and platform handling to the common tools.h header.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-18 11:50:30 +01:00
Alexandre Julliard
8cd3679848 winegcc: Get rid of PowerPC support.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-18 11:16:17 +01:00
Alexandre Julliard
a7074ea2a3 winegcc: Don't link directly to ntdll or ntoskrnl import libraries.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-17 15:19:33 +01:00
Alexandre Julliard
6ebcc54a5c makefiles: Explicitly import all the needed libraries.
Don't rely on winegcc adding any default libraries.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-11 13:28:19 +01:00
Damjan Jovanovic
c1e83ae9fb winegcc: 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
f9ee0d2f05 tools: Avoid using wine/port.h.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-07 18:03:11 +02:00
Alexandre Julliard
9e3959bd9b tools: Add a few helper functions for file names and extensions.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-29 21:38:11 +02:00
Alexandre Julliard
55701c6672 tools: Add a helper function to create temp files.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-29 21:38:11 +02:00
Alexandre Julliard
2a08d6ce80 tools: Add helper functions to spawn a command from an strarray.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-28 18:18:49 +02:00
Alexandre Julliard
97ca9f8a3d tools: Add a shared header for common helper functions.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-28 17:38:06 +02:00
Chip Davis
9e133a9a22 winegcc: Only add -static-libgcc if -nodefaultlibs weren't given. (Clang).
The flag does nothing if -nodefaultlibs or -nostdlib were given, because
the driver does not automatically link to libgcc/compiler-rt in that
case. Clang will warn about this, which is annoying, which clutters up
the output, and which makes it impossible to use -Werror when building
with Clang.

Signed-off-by: Chip Davis <cdavis@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-27 17:40:15 +02:00
Rémi Bernon
6db01bcbbc winegcc: Add missing strarray initialization.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-24 21:55:19 +02:00
Alexandre Julliard
2064181c1f winegcc: Unify the strarray implementation with the one from makedep.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-23 14:45:39 +02:00
Alexandre Julliard
ab5664a5e6 makefiles: Explicitly name the Unix library in the makefile instead of using --subsystem unixlib.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-21 17:49:48 +02:00
Zebediah Figura
37ceea6451 winegcc: Correctly put the -munix manual section in its own paragraph.
Use a style consistent with the rest of the file.

Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-20 22:45:48 +02:00
Alexandre Julliard
20830b6c70 winegcc: Skip the post-link steps for Unix libraries.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-20 22:45:48 +02:00
Alexandre Julliard
6ba7773121 makefiles: Add a -mcygwin flag to specify the inverse of -mno-cygwin.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-20 22:45:48 +02:00
Alexandre Julliard
a7076690b1 winegcc: Fix subsystem check to avoid running winebuild on Unix libraries.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-27 18:06:29 +02:00
Huw Davies
9af226c826 winegcc: Add a @loader_path to help the macOS loader find ntdll.so.
On macOS unixlibs that link to ntdll.so currently fail to load.
It appears the macOS loader needs to be able to locate the file
even if the library is already loaded.

This patch changes the LC_ID_DYLIB name of ntdll.so to
"@loader_path/ntdll.so" so that when other unixlibs link against this
they will insert that name into their LC_LOAD_DYLIB entry for
ntdll.so.

While changing only ntdll.so is necessary, for simplicity this patch
changes all unixlibs.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51632
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-23 11:54:16 +02:00
Alexandre Julliard
7d60d0d7bb winegcc: Use custom subsystem 'unixlib' instead of 'native' for Unix libraries.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-12 11:33:57 +02:00
Alexandre Julliard
ada8bf034a winegcc: Build Unix libraries as dynamic libs on macOS.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-12 11:25:12 +02:00
Alexandre Julliard
6688367046 winegcc: Don't build the .spec.o file for native Unix libraries.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-11 22:59:21 +02:00
Alexandre Julliard
c697ee728b winegcc: Add a helper function to build the .spec.o file.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-11 22:59:21 +02:00
Alexandre Julliard
de4c91e0a1 Revert "winegcc: Support -Wl,foo=... style linker options."
This reverts commit fcda0afdd4.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51413
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-07-26 11:33:43 +02:00
Connor Abbott
fcda0afdd4 winegcc: Support -Wl,foo=... style linker options.
In particular meson uses -Wl,--out-implib=...

Signed-off-by: Connor Abbott <cwabbott0@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-07-02 16:53:51 +02:00
Connor Abbott
b1fb07e188 winegcc: Support -Wl,--start-group and -Wl,--end-group.
These arguments need to be in the correct position so they need to go in
the files array.

Signed-off-by: Connor Abbott <cwabbott0@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-07-02 16:53:51 +02:00
Connor Abbott
d209d9feb6 winegcc: Pass through -pthread.
While you could get 90% of the way with "-lpthread", supporting -pthread
should be more reliable and is required for build systems like meson
that have special handling for the threads dependency.

Since this is both a compiler (really preprocessor) and linker option,
we can't just add it to is_linker_arg().

Signed-off-by: Connor Abbott <cwabbott0@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-07-02 16:53:51 +02:00
Connor Abbott
f1ab3c8d76 winegcc: Recognize .obj files as objects.
For more compatibility with mingw-gcc. Since meson always names object
files with a .obj extension when using mingw, this improves
compatibility with meson.

Signed-off-by: Connor Abbott <cwabbott0@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-07-02 16:53:51 +02:00
Jacek Caban
69ef7374b4 winegcc: Link unix libs directly to native libraries.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-06-01 17:59:46 +02:00
Jacek Caban
388c91042c winegcc: Use -soname for unix libs.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-06-01 17:59:44 +02:00
Jacek Caban
87e1e43506 winegcc: Use msvcrt by default for PE targets.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-14 20:56:54 +02:00
Alexandre Julliard
0aa335b106 winegcc: Look for libraries in the architecture-specific directory.
Based on patches by Jacek Caban.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-04-28 16:25:48 +02:00
Jacek Caban
5a1d836def winegcc: Use -idirafter for system include paths.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50996
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-04-22 21:12:57 +02:00
Jacek Caban
4f78781299 winegcc: Add Wine include directories before standard directories on search list.
This is especially important for msvcrt headers, which need to be used
instead of system ones.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-04-06 22:46:12 +02:00
Jacek Caban
c7a210bc2f winegcc: Use paths for found libraries on PE targets when using msvcrt.
We use -nodefaultlibs now, so we don't need to worry about GCC additions.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-04-06 22:46:12 +02:00
Francois Gouget
5d80ee4b60 winegcc: Add a trailing linefeed to an error() message.
Signed-off-by: Francois Gouget <fgouget@free.fr>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-03-02 20:42:33 +01:00
Jacek Caban
d281c90c4b winegcc: Properly set debug info type on msvc targets.
Fixes a typo from 9faa5eeddd.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-02-17 22:21:13 +01:00