Bug 89183 - GCC 8 LTO fails on Windows with -g/-g3
Summary: GCC 8 LTO fails on Windows with -g/-g3
Status: RESOLVED DUPLICATE of bug 88422
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-04 07:11 UTC by Liviu Ionescu
Modified: 2019-02-04 09:27 UTC (History)
1 user (show)

See Also:
Host: *-*-mingw*
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-04 07:11:09 UTC
I encountered the problem while using arm-none-eabi-gcc 8-2018-q4 on a Windows 10 64-bit.

To reproduce it, create an empty main.c and try to compile it with -g or -g3:


C:\Users\ilg\tmp>"C:\Users\ilg\AppData\Roaming\GNU Tools ARM Embedded\8-2018-q4\bin\arm-none-eabi-gcc.exe" -flto -g main.c
c:/users/ilg/appdata/roaming/gnu tools arm embedded/8-2018-q4/bin/../lib/gcc/arm-none-eabi/8.2.1/../../../../arm-none-eabi/bin/ld.exe: C:\Users\ilg\AppData\Local\Temp\cck5e5XRdebugobjtem: file not recognized: file truncated
collect2.exe: error: ld returned 1 exit status
lto-wrapper.exe: fatal error: C:\Users\ilg\AppData\Roaming\GNU Tools ARM Embedded\8-2018-q4\bin\arm-none-eabi-gcc.exe returned 1 exit status
compilation terminated.
c:/users/ilg/appdata/roaming/gnu tools arm embedded/8-2018-q4/bin/../lib/gcc/arm-none-eabi/8.2.1/../../../../arm-none-eabi/bin/ld.exe: error: lto-wrapper failed
collect2.exe: error: ld returned 1 exit status


C:\Users\ilg\tmp>"C:\Users\ilg\AppData\Roaming\GNU Tools ARM Embedded\8-2018-q4\bin\arm-none-eabi-gcc.exe" -flto -g3 main.c
c:/users/ilg/appdata/roaming/gnu tools arm embedded/8-2018-q4/bin/../lib/gcc/arm-none-eabi/8.2.1/../../../../arm-none-eabi/bin/ld.exe: warning: C:\Users\ilg\AppData\Local\Temp\ccg9waOldebugobjtem has a corrupt section with a size (a0d66) larger than the file size
c:/users/ilg/appdata/roaming/gnu tools arm embedded/8-2018-q4/bin/../lib/gcc/arm-none-eabi/8.2.1/../../../../arm-none-eabi/bin/ld.exe: C:\Users\ilg\AppData\Local\Temp\ccg9waOldebugobjtem: invalid string offset 2048 >= 22975072851460187 for section `(null)'
c:/users/ilg/appdata/roaming/gnu tools arm embedded/8-2018-q4/bin/../lib/gcc/arm-none-eabi/8.2.1/../../../../arm-none-eabi/bin/ld.exe: C:\Users\ilg\AppData\Local\Temp\ccg9waOldebugobjtem: invalid string offset 2048 >= 22975072851460187 for section `(null)'
c:/users/ilg/appdata/roaming/gnu tools arm embedded/8-2018-q4/bin/../lib/gcc/arm-none-eabi/8.2.1/../../../../arm-none-eabi/bin/ld.exe: C:\Users\ilg\AppData\Local\Temp\ccg9waOldebugobjtem: invalid string offset 12032 >= 22975072851460187 for section `(null)'
c:/users/ilg/appdata/roaming/gnu tools arm embedded/8-2018-q4/bin/../lib/gcc/arm-none-eabi/8.2.1/../../../../arm-none-eabi/bin/ld.exe: C:\Users\ilg\AppData\Local\Temp\ccg9waOldebugobjtem: invalid string offset 16640 >= 22975072851460187 for section `(null)'
c:/users/ilg/appdata/roaming/gnu tools arm embedded/8-2018-q4/bin/../lib/gcc/arm-none-eabi/8.2.1/../../../../arm-none-eabi/bin/ld.exe: C:\Users\ilg\AppData\Local\Temp\ccg9waOldebugobjtem: invalid string offset 16640 >= 22975072851460187 for section `(null)'
collect2.exe: error: ld returned 5 exit status
lto-wrapper.exe: fatal error: C:\Users\ilg\AppData\Roaming\GNU Tools ARM Embedded\8-2018-q4\bin\arm-none-eabi-gcc.exe returned 1 exit status
compilation terminated.
c:/users/ilg/appdata/roaming/gnu tools arm embedded/8-2018-q4/bin/../lib/gcc/arm-none-eabi/8.2.1/../../../../arm-none-eabi/bin/ld.exe: error: lto-wrapper failed
collect2.exe: error: ld returned 1 exit status


Linux and macOS builds seem ok, only the mingw-w64 build is affected. Previous Arm releases, using GCC 7, were ok on Windows too, the problem occured after switching to GCC 8.
Comment 1 Andrew Pinski 2019-02-04 07:52:53 UTC
Dup.

*** This bug has been marked as a duplicate of bug 88422 ***
Comment 2 Andrew Pinski 2019-02-04 07:54:31 UTC
This is already fixed in the sources and will be included for GCC 8.3.  You should ask ARM to backport the fix and have them release a new toolchain since that is where you got the binaries from.
Comment 3 Liviu Ionescu 2019-02-04 09:27:32 UTC
Thank you Andrew for your quick reply.

Yes, I'll notify Arm that a fix is available, I already registered a bug at https://bugs.launchpad.net/gcc-arm-embedded/+bug/1814397.

In the mean time I already created a patch for the GNU MCU Eclipse ARM Embedded GCC distribution that I maintain (based on the Arm distribution), and plan to make a new release which will include this fix.