Bug 89166 - -static prevents liblto_plugin to be created
Summary: -static prevents liblto_plugin to be created
Status: UNCONFIRMED
Alias: None
Product: gcc
Classification: Unclassified
Component: lto (show other bugs)
Version: 8.2.1
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-02-03 10:26 UTC by Liviu Ionescu
Modified: 2019-02-04 09:29 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Liviu Ionescu 2019-02-03 10:26:23 UTC
Passing -static to the GCC configure/make prevents the LTO plugin to be properly created; the build is successful, but, for example for the Windows build, the file liblto_plugin-0.dll is not created, instead a warning is issued.

For GCC executables this is not a problem, but some binutils executables also need this plugin (like ar).


I think that the configure/make code for the LTO plugin should ignore the -static option (even when passed via LDFLAGS) and always build the dll/so.
Comment 1 Liviu Ionescu 2019-02-03 17:46:52 UTC
a related bug is https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84995
Comment 2 Andrew Pinski 2019-02-03 17:53:22 UTC
If you use -static in LDFLAGS, you will have other issues.
What are you trying to do?

This is like telling the doctor it hurts when I bend my arm the wrong way and then the doctor tells you stop doing that.
Comment 3 Liviu Ionescu 2019-02-03 19:43:52 UTC
I tried all sort of configurations to build static executables, but I could not find one that works while building Windows binaries (with mingw) and still allow the liblto_plugin-0.dll to be created.

If the subject is not appropriate, please suggest a better one, but that is the idea, building static binaries had the side effect of disabling the plugin.

The current workaround I used in my build script was to make the binaries 'almost' static, except libwinpthread.dll, which I had to copy in the distribution. Far from perfect, but apparently functional.

If there is a better way to do this, I'm ready to give it a try.
Comment 4 Richard Biener 2019-02-04 09:29:35 UTC
You could try BOOT_LDFLAGS=-static, not sure if that also applies to the (also host) lto-plugin.