[PATCH v2 0/4] MR6922: Improve clang configuration.
This MR improves configuration scheme when using clang as cross compiler: - it fixes test for dwarf (-4) support (current test is failing as ldd emits a warning when generating the long section names for the dwarf section, that configure.ac treats as an error), - it fixes --enable-build-id option with clang (clang linker uses -build-id option, while gcc uses --build-id /mind the extra '-'/) - it adds support in winegcc for a generic build-id linker option. (extracted from draft MR!6715) -- v2: configure.ac: Don't add -Wl,--build-id linker option to CFLAGS. configure.ac: Properly detect build-id support for clang. winegcc: Remap build-id linker option for clang. configure.ac: Properly test clang for dwarf support. https://gitlab.winehq.org/wine/wine/-/merge_requests/6922
From: Eric Pouech <epouech(a)codeweavers.com> clang emits a warning when linking the dwarf's long sections names, which lets the configuration test fail. Signed-off-by: Eric Pouech <epouech(a)codeweavers.com> --- configure.ac | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index de80d65b240..1f01e5380c0 100644 --- a/configure.ac +++ b/configure.ac @@ -1004,7 +1004,10 @@ This is an error since --enable-archs=$wine_arch was requested.])]) if test "x$ac_debug_format_seen" = x then case $wine_crossdebug in - *dwarf) WINE_TRY_PE_CFLAGS([-gdwarf-4]) ;; + *dwarf) dnl clang emits a warning without -Wl,-debug:dwarf, so ensure linker option is present + WINE_TRY_PE_CFLAGS([-Wl,-debug:dwarf],[AS_VAR_APPEND([${wine_arch}_LDFLAGS],[" -Wl,-debug:dwarf"]) + CFLAGS="$CFLAGS -Wl,-debug:dwarf"]) + WINE_TRY_PE_CFLAGS([-gdwarf-4]) ;; pdb) WINE_TRY_PE_CFLAGS([-gcodeview]) ;; esac fi -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/6922
From: Eric Pouech <epouech(a)codeweavers.com> Signed-off-by: Eric Pouech <epouech(a)codeweavers.com> --- tools/winegcc/winegcc.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tools/winegcc/winegcc.c b/tools/winegcc/winegcc.c index 60cc6148158..62a03db53a0 100644 --- a/tools/winegcc/winegcc.c +++ b/tools/winegcc/winegcc.c @@ -178,6 +178,7 @@ struct options int strip; int pic; int no_default_config; + int build_id; const char* wine_objdir; const char* winebuild; const char* output_name; @@ -427,6 +428,9 @@ static struct strarray get_link_args( struct options *opts, const char *output_n if (opts->debug_file && strendswith(opts->debug_file, ".pdb")) strarray_add(&link_args, strmake("-Wl,--pdb=%s", opts->debug_file)); + if (opts->build_id) + strarray_add( &link_args, "-Wl,--build-id"); + if (opts->out_implib) strarray_add(&link_args, strmake("-Wl,--out-implib,%s", opts->out_implib)); @@ -466,6 +470,9 @@ static struct strarray get_link_args( struct options *opts, const char *output_n else if (!opts->strip) strarray_add(&link_args, "-Wl,-debug:dwarf"); + if (opts->build_id) + strarray_add( &link_args, "-Wl,-build-id"); + if (opts->out_implib) strarray_add(&link_args, strmake("-Wl,-implib:%s", opts->out_implib)); else @@ -1843,6 +1850,11 @@ int main(int argc, char **argv) opts.out_implib = xstrdup( Wl.str[++j] ); continue; } + if (!strcmp( Wl.str[j], "--build-id" )) + { + opts.build_id = 1; + continue; + } if (!strcmp(Wl.str[j], "-static")) linking = -1; strarray_add(&opts.linker_args, strmake("-Wl,%s",Wl.str[j])); } -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/6922
From: Eric Pouech <epouech(a)codeweavers.com> Signed-off-by: Eric Pouech <epouech(a)codeweavers.com> --- configure.ac | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index 1f01e5380c0..53f195e5ea0 100644 --- a/configure.ac +++ b/configure.ac @@ -1014,9 +1014,9 @@ This is an error since --enable-archs=$wine_arch was requested.])]) AS_VAR_SET([${wine_arch}_DEBUG],[$wine_crossdebug]) test "x$enable_werror" != xyes || WINE_TRY_PE_CFLAGS([-Werror]) - test "x$enable_build_id" != xyes || WINE_TRY_PE_CFLAGS([-Wl,--build-id], - [AS_VAR_APPEND([${wine_arch}_CFLAGS],[" -Wl,--build-id"]) - AS_VAR_APPEND([${wine_arch}_LDFLAGS],[" -Wl,--build-id"])]) + dnl clang for PE target wants -build-id (and not --build-id as gcc/mingw or clang in unix target) + dnl don't bother testing flags, compilation will fail afterwards + test "x$enable_build_id" != xyes || AS_VAR_APPEND([${wine_arch}_LDFLAGS],[" -Wl,--build-id"]) done -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/6922
From: Eric Pouech <epouech(a)codeweavers.com> Signed-off-by: Eric Pouech <epouech(a)codeweavers.com> --- configure.ac | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/configure.ac b/configure.ac index 53f195e5ea0..ac710721ae6 100644 --- a/configure.ac +++ b/configure.ac @@ -1997,11 +1997,7 @@ int a(int b, ...) { __builtin_ms_va_list list; __builtin_ms_va_start(list,b); }] then WINE_TRY_CFLAGS([-Werror]) fi - if test "x$enable_build_id" = "xyes" - then - WINE_TRY_CFLAGS([-Wl,--build-id], [CFLAGS="$CFLAGS -Wl,--build-id" - LDFLAGS="$LDFLAGS -Wl,--build-id"]) - fi + test "x$enable_build_id" != xyes || WINE_TRY_CFLAGS([-Wl,--build-id], [LDFLAGS="$LDFLAGS -Wl,--build-id"]) fi dnl **** Disable Fortify, it has too many false positives -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/6922
Hi, It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated. The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details: The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=150141 Your paranoid android. === debian11b (64 bit WoW report) === user32: input.c:4305: Test succeeded inside todo block: button_down_hwnd_todo 1: got MSG_TEST_WIN hwnd 00000000011300EA, msg WM_LBUTTONDOWN, wparam 0x1, lparam 0x320032
V3 pushed: - simplify build-id settings on PE (just force LDFLAGS) - removed -Wl,--build-id from CFLAGS on unix side @jacek: didn't change winegcc for linux platform as -Wl,--build-id seems to work fine (just removed the option from CFLAGS as clang complains about it) -- https://gitlab.winehq.org/wine/wine/-/merge_requests/6922#note_89458
On Mon Dec 2 18:22:40 2024 +0000, eric pouech wrote:
V3 pushed: - simplify build-id settings on PE (just force LDFLAGS) - removed -Wl,--build-id from CFLAGS on unix side @jacek: didn't change winegcc for linux platform as -Wl,--build-id seems to work fine (just removed the option from CFLAGS as clang complains about it) Unless I'm missing something, with your change to command line parser, we no longer store it in `linker_args`, so we don't pass it to the linker.
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/6922#note_89460
On Mon Dec 2 16:59:09 2024 +0000, eric pouech wrote:
actually, clang in generic Unix compilation happily accepts -Wl,--build-id (just warns about the flag being added to CFLAGS, which can remove IMO) so winegcc adaptation for Unix target doesn't seem needed, and I'd rather call all of this a clang bug to not accept --build-id for windows's target while it does for unix It's not a bug. `-Wl,...` options are not interpreted by the compiler, they are just passed to the linker. In MSVC mode, it's raw `lld-link` (in mingw it's wrapped to provide arguments translation), so it uses MSVC link.exe's syntax.
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/6922#note_89461
participants (4)
-
Eric Pouech -
eric pouech (@epo) -
Jacek Caban (@jacek) -
Marvin