Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.
Bug 1455137 - Lost relocation using LTO option
Summary: Lost relocation using LTO option
Keywords:
Status: CLOSED DUPLICATE of bug 1475237
Alias: None
Product: Fedora
Classification: Fedora
Component: mingw-binutils
Version: 31
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Kalev Lember
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-05-24 10:29 UTC by Frediano Ziglio
Modified: 2019-11-20 10:09 UTC (History)
8 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-11-20 10:08:37 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Frediano Ziglio 2017-05-24 10:29:42 UTC
Description of problem:
We are having some really weird issue linking a project.
It all started with someone reporting a crash calling sprintf. The code appeared correct and not causing any possible overflow but compiling from a Fedora 26 system (also reported using Fedora 27) instead of a Fedora 25 (so cross compiling from a x64 Linux system for a 64 bit Windows) start causing the crash.
I spent quite some time digging the issue and I realized that the resulting executable has a missing relocation. Basically the sprintf call is compiled as "call next" instruction (e8 00 00 00 00) like the relocation to sprintf (in our environment sprintf is redirected to a function calling __mingw_vsprintf so there should be a relative call).
It turned out that removing -flto -fwhole-program from the C++ compiler option make the problem disappear.
More digging during the linking ld create a .s file from all LTO modules and pass to as, the .s file (I used -save-temp) have the sprintf call, the resulting object file has the correct relocation but the final .exe do not have this relocation. I tried to use the resulting object and call ld removing plugin options and the resulting executable is fine; not sure however if this demonstrate that the problem is in the lto plugin.
The program is an agent for Windows you can find at https://cgit.freedesktop.org/spice/win32/vd_agent/. I tried to remove some code to get a minimal version but the problem disappeared. Not sure what I can post for this report.


Version-Release number of selected component (if applicable):
mingw64-binutils-2.27
mingw64-gcc-c++-7.0.1
mingw64-headers-5.0.1


How reproducible:
Always


Steps to Reproduce:
1. download spice guest agent from git (commit 241425b7da80626f0d3bc471202e753f0f1dd178)
2. compile it from Fedora 64 targeting 64 bit system
3. check handle_start for sprintf call


Actual results:
The code calls sprintf


Expected results:
Code call next instruction

Comment 1 Kalev Lember 2017-07-26 09:27:57 UTC
Sorry, I don't think we have anyone with compiler internals knowledge looking at mingw bugs. Can you file this upstream where it is likely to get more attention, please? I'm happy to backport fixes once it's resolved upstream.

Comment 2 Frediano Ziglio 2017-09-06 14:44:11 UTC
Opened a bug at https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81879

Comment 3 Fedora End Of Life 2018-05-03 08:22:22 UTC
This message is a reminder that Fedora 26 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 26. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '26'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version'
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not
able to fix it before Fedora 26 is end of life. If you would still like
to see this bug fixed and are able to reproduce it against a later version
of Fedora, you are encouraged  change the 'version' to a later Fedora
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's
lifetime, sometimes those efforts are overtaken by events. Often a
more recent Fedora release includes newer upstream software that fixes
bugs or makes them obsolete.

Comment 4 Fedora End Of Life 2018-05-29 11:44:19 UTC
Fedora 26 changed to end-of-life (EOL) status on 2018-05-29. Fedora 26
is no longer maintained, which means that it will not receive any
further security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.

Comment 5 Frediano Ziglio 2018-05-29 12:06:00 UTC
This happens again in Fedora 28

Comment 6 Ben Cotton 2019-05-02 21:41:16 UTC
This message is a reminder that Fedora 28 is nearing its end of life.
On 2019-May-28 Fedora will stop maintaining and issuing updates for
Fedora 28. It is Fedora's policy to close all bug reports from releases
that are no longer maintained. At that time this bug will be closed as
EOL if it remains open with a Fedora 'version' of '28'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 28 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 7 Frediano Ziglio 2019-07-18 09:24:00 UTC
Still present in Fedora 30.
This was fixed after upstream binutils 2.32, but Fedora still uses binutils 2.30 for MingW.
The upstream patch is https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commit;h=2219ae0b0ebe14373850b000c2abaa31dab1d741.

Comment 8 Frediano Ziglio 2019-11-20 10:08:37 UTC
This was duplicated of rhbz#1475237

*** This bug has been marked as a duplicate of bug 1475237 ***


Note You need to log in before you can comment on or make changes to this bug.