bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug ld/29973] x86_64-w64-mingw32-g++ ld: helloworld.exe:.rdata_r: secti


From: euloanty at live dot com
Subject: [Bug ld/29973] x86_64-w64-mingw32-g++ ld: helloworld.exe:.rdata_r: section below image base for windows
Date: Mon, 06 Feb 2023 13:20:24 +0000

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

--- Comment #23 from cqwrteur <euloanty at live dot com> ---
(In reply to cqwrteur from comment #22)
> (In reply to cqwrteur from comment #21)
> > (In reply to cqwrteur from comment #20)
> > > (In reply to Nick Clifton from comment #18)
> > > > Created attachment 14652 [details]
> > > > Proposed patch
> > > > 
> > > > Interesting.  The issue is the section itself: .rdata_r.  This is not a
> > > > normal PE section name, and it is missing from the default script used 
> > > > by
> > > > the linker.  So instead the orphan section handling code is activated, 
> > > > and
> > > > this places the section into the .rdata section.  But in doing so, it 
> > > > also
> > > > sets the vaddr for the .rdata section to 0.
> > > > 
> > > > The .rdata_r section is being created by the LTO plugin when it 
> > > > recompiles
> > > > helloworld.cc.  I am not sure why this is happening.  But there is an 
> > > > easy
> > > > fix - add the .rdata_r section to the default linker map.  So that is 
> > > > what
> > > > this patch does.
> > > > 
> > > > Please try out the patch and let me know if it works for you.
> > > 
> > > Please merge the patch. It is important for me
> > 
> > The code compiles but it crashes for dynamically linking libstdc++-6.dll
> 
> #include<iostream>
> 
> int main()
> {
>         std::cout<<"Hello World\n";
> }
> 
> cqwrteur@HOME-SERVER:~/Libraries/fast_io/.tmp$ x86_64-w64-mingw32-g++ -o
> iostream iostream.cc -Ofast -std=c++23
> cqwrteur@HOME-SERVER:~/Libraries/fast_io/.tmp$ wine ./iostream.exe
> wine: Unhandled page fault on read access to 00000004FEAABE98 at address
> 00000003BE9ED6CD (thread 00d8), starting debugger...
> Unhandled exception: page fault on read access to 0x4feaabe98 in 64-bit code
> (0x000
> 00003be9ed6cd).
> .... ignore
> 
> x86_64-w64-mingw32-g++ -o iostream iostream.cc -Ofast -std=c++23 -fuse-ld=lld
> cqwrteur@HOME-SERVER:~/Libraries/fast_io/.tmp$ ./iostream.exe ^C
> cqwrteur@HOME-SERVER:~/Libraries/fast_io/.tmp$ wine ./iostream.exe
> Hello World

The ld linker is still buggy.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]