Bug 108332 - dynamic link libstdc++ with win32 thread model's gcc for windows native toolchain would cause .rdata_r: section below image base
Summary: dynamic link libstdc++ with win32 thread model's gcc for windows native toolc...
Status: UNCONFIRMED
Alias: None
Product: gcc
Classification: Unclassified
Component: libstdc++ (show other bugs)
Version: 13.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-01-07 22:45 UTC by cqwrteur
Modified: 2023-01-27 04:21 UTC (History)
5 users (show)

See Also:
Host: x86_64-w64-mingw32
Target: x86_64-w64-mingw32
Build: x86_64-pc-linux-gnu
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 cqwrteur 2023-01-07 22:45:09 UTC
g++ -o helloworld helloworld.cc -Ofast -std=c++23 -s -flto -march=native -I../../include -static

//ok no issue

g++ -o helloworld helloworld.cc -Ofast -std=c++23 -s -flto -march=native -I../../include
d:/x86_64-windows-gnu/x86_64-w64-mingw32/bin/../lib/gcc/x86_64-w64-mingw32/13.0.0/../../../../x86_64-w64-mingw32/bin/ld.exe: helloworld.exe:.rdata_r: section below image base

Do not know whether it is an issue for mingw-w64 or libstdc++
Comment 1 Andrew Pinski 2023-01-07 22:53:09 UTC
This seems like a binutils ld bug rather than a libstdc++ bug ...
Comment 3 Andrew Pinski 2023-01-07 22:55:53 UTC
cygwin was improved here:
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=801120c1f402f9b0f72b5a231bf9e1cf82614cac

It might be the case mingw linker script is broken ....
Comment 4 cqwrteur 2023-01-07 22:56:42 UTC
(In reply to Andrew Pinski from comment #3)
> cygwin was improved here:
> https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;
> h=801120c1f402f9b0f72b5a231bf9e1cf82614cac
> 
> It might be the case mingw linker script is broken ....

This is mingw-w64, not newlib-cygwin
Comment 5 nightstrike 2023-01-09 09:51:02 UTC
(In reply to cqwrteur from comment #4)
> (In reply to Andrew Pinski from comment #3)
> > cygwin was improved here:
> > https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;
> > h=801120c1f402f9b0f72b5a231bf9e1cf82614cac
> > 
> > It might be the case mingw linker script is broken ....
> 
> This is mingw-w64, not newlib-cygwin

I think he's suggesting that we have to apply the same solution to mingw that Corinna applied to Cygwin.
Comment 6 cqwrteur 2023-01-27 04:21:29 UTC
(In reply to Andrew Pinski from comment #2)
> https://sourceware.org/pipermail/binutils-cvs/2021-March/056031.html

https://sourceware.org/bugzilla/show_bug.cgi?id=29973

I doubt this is the issue with ld linker. More likely to be a libstdc++ issue.