Commit Graph

256 Commits

Author SHA1 Message Date
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
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
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
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
Alexandre Julliard 7c909489b4 winegcc: Pass the same winebuild args to all winebuild invocations.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-01-22 17:34:36 +01:00
Alexandre Julliard 4e9f855be5 winegcc: Look for ntdll.so instead of libwine.so to find the library directory.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-12-08 22:25:59 +01:00
Kevin Puetz a1078d4770 winebuild: Select all __wine_spec_exe* entry inside winebuild.
Override --entry in winegcc only when it applies to any compiler
(e.g. kernel drivers or msvcrt) but leave spec details to winebuild.

Forward -municode so winebuild will know which to use.

Signed-off-by: Kevin Puetz <PuetzKevinA@JohnDeere.com>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-11-30 22:18:20 +01:00
Kevin Puetz 9faa5eeddd winegcc: Implement -Wl,--out-implib.
This allows a CMake toolchain (or other caller) to treat winegcc like MinGW,
specifying that it produce a separate file for imports, e.g.

set(CMAKE_IMPORT_LIBRARY_PREFIX lib)
set(CMAKE_IMPORT_LIBRARY_SUFFIX .a)
string(APPEND CMAKE_C_CREATE_SHARED_LIBRARY " -Wl,--out-implib,<TARGET_IMPLIB>")

Signed-off-by: Kevin Puetz <PuetzKevinA@JohnDeere.com>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-11-26 23:25:38 +01:00
Alexandre Julliard 27b20c1db5 makefiles: Don't add a default crt lib for msvcrt dlls.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-11-19 21:23:21 +01:00
Alexandre Julliard c670df976c makefiles: Don't use default imports for Unix libraries.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-09-18 15:03:08 +02:00
Jacek Caban fd71ffb44a winegcc: Try using msvc file align syntax if mingw-style is not supported.
Allows setting file alignment on LLD 10.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-08-01 10:00:18 +02:00
Jacek Caban 5e4ca097be winegcc: Support file alignment on msvc target.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-08-01 10:00:18 +02:00
Alexandre Julliard 0e4d22bd8d winegc: Support overriding the default PE file alignment.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-23 22:30:49 +02:00
Rémi Bernon e36bed4f37 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>
2020-07-23 22:30:49 +02:00
Alexandre Julliard cbc35152c4 winegcc: Pass -mno-cygwin and -munix flags directly to winebuild.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-01 10:59:35 +02:00
Jacek Caban 0db5f6cf1b winegcc: Add support for -Wl,--whole-archive option.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-26 10:00:30 +02:00
Jacek Caban c5ee64a101 winegcc: Add support for @file arguments.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-26 10:00:29 +02:00
Jacek Caban f42e4431fb winegcc: Store main arguments in strarray.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-26 10:00:26 +02:00
Jacek Caban e9de7761cd winegcc: Pass only raw compiler and linker arguments in forward mode.
Fixes use case like:
CC=winegcc -b i686-w64-mingw32
$CC --version

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-20 20:12:02 +02:00
Jacek Caban 14d97456a9 winegcc: Default to ucrtbase.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-18 19:48:56 +02:00
Alexandre Julliard 469058acc1 winegcc: Allow the output file to end in .so.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-14 23:12:31 +02:00
Jacek Caban 942e298308 winegcc: Introduce --debug-file option for generating separated symbol files.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-14 23:12:31 +02:00
Jacek Caban d784de82c8 winegcc: Use --safeseh winebuild option on msvc target.
lld-link requires all x86 object files to be SEH compatible unless it's
explicitly disabled.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-06 19:02:58 +02:00
Jacek Caban 35a7ed0c78 winegcc: Add support for msvc target.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-04 17:33:52 +02:00
Jacek Caban 66aa39d959 winegcc: Use libgcc only on mingw target.
It's not available for msvc, but we get all we need from importlibs there.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-04 17:33:35 +02:00
Jacek Caban 2dee9b9874 winegcc: Make mingw a separated platform from msvc.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-04 17:33:28 +02:00
Jacek Caban 78ce43f017 winegcc: Explicitly pass DLL crt entry point to PE linker when Wine crt is used.
Linkers don't agree on its default.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-04 17:33:00 +02:00