Bug 106118 - lto-plugin/lto-plugin.c: -pthread not passed to AM_LDFLAGS
Summary: lto-plugin/lto-plugin.c: -pthread not passed to AM_LDFLAGS
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: lto (show other bugs)
Version: 13.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks: 106170
  Show dependency treegraph
 
Reported: 2022-06-28 13:25 UTC by Pekka S
Modified: 2022-07-03 06:24 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2022-06-28 00:00:00


Attachments
move -pthread from LDFLAGS to AM_LDFLAGS (prior autoreconf) (700 bytes, patch)
2022-06-28 13:25 UTC, Pekka S
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Pekka S 2022-06-28 13:25:44 UTC
Created attachment 53216 [details]
move -pthread from LDFLAGS to AM_LDFLAGS (prior autoreconf)

Hi.

"lto-plugin: make claim_file_handler thread-safe" [1] uses LDFLAGS="-pthread" at configure.ac.  Unfortunately, LDFLAGS is not passed from configure to the Makefile recipe that links liblto_plugin.la.

Perhaps just move -pthread to AM_LDFLAGS at Makefile.in?  AC_CHECK_HEADER does not use LDFLAGS anyway.  It is implicitly used by other checks but I wonder if that just makes things more misleading (a missing pthread library, that is).

Also, it seems that pretty much every library has a different way of checking and setting -pthread, -lpthread et. al.

[1] https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=2669cae081c852bc8bde1647d671aa66930cc556
Comment 1 Martin Liška 2022-06-28 13:29:17 UTC
Thanks for the fix, please send the patch to gcc-patches mailing list.
Comment 2 GCC Commits 2022-07-01 07:02:01 UTC
The master branch has been updated by Martin Liska <marxin@gcc.gnu.org>:

https://gcc.gnu.org/g:51debf7f857dddfb4dd2493867d2648041e7d8de

commit r13-1377-g51debf7f857dddfb4dd2493867d2648041e7d8de
Author: Pekka Seppänen <pexu@gcc.mail.kapsi.fi>
Date:   Tue Jun 28 17:14:09 2022 +0300

    lto: pass -pthread to AM_LDFLAGS [PR 106118]
    
    Move -pthread from configure.ac to Makefile.in so that it is passed to AM_LDFLAGS.
    
            PR lto/106118
    
    lto-plugin/ChangeLog:
    
            * configure.ac: Move -pthread from here...
            * Makefile.am: ...to here.
            * configure: Regenerate.
            * Makefile.in: Likewise.
Comment 3 Martin Liška 2022-07-01 07:02:36 UTC
Should be fixed now.
Comment 4 cqwrteur 2022-07-03 05:27:39 UTC
(In reply to Martin Liška from comment #3)
> Should be fixed now.

This patch is just wrong. Since windows simply does not provide libpthread.a

you have win32, posix, and mcf 3 kinds of threads.

Plus a lot of single-thread targets.

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106170