[Bug ld/30254] iostream crashes with ld linker for windows targets

2023-05-21 Thread euloanty at live dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=30254

cqwrteur  changed:

   What|Removed |Added

 CC||jakub at redhat dot com

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


[Bug ld/30375] C++ std::cout's rdbuf gives ridiculous address on windows with dynamic linking with ld

2023-05-21 Thread euloanty at live dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=30375

cqwrteur  changed:

   What|Removed |Added

 Resolution|--- |DUPLICATE
 Status|UNCONFIRMED |RESOLVED

--- Comment #2 from cqwrteur  ---
The bug fixed

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

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


[Bug ld/30254] iostream crashes with ld linker for windows targets

2023-05-21 Thread euloanty at live dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=30254

cqwrteur  changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution|--- |FIXED

--- Comment #18 from cqwrteur  ---
(In reply to cqwrteur from comment #17)
> Created attachment 14898 [details]
> English translation

https://sourceware.org/bugzilla/attachment.cgi?id=14656

Looks like I applied the wrong patch the dev proposed and that is how it causes
the problem. Closed

Thank you the old issue fixed now.

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


[Bug ld/29973] x86_64-w64-mingw32-g++ ld: helloworld.exe:.rdata_r: section below image base for windows

2023-05-21 Thread euloanty at live dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=29973

--- Comment #42 from cqwrteur  ---
*** Bug 30375 has been marked as a duplicate of this bug. ***

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


[Bug ld/30254] iostream crashes with ld linker for windows targets

2023-05-21 Thread euloanty at live dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=30254

cqwrteur  changed:

   What|Removed |Added

 CC||amodra at gmail dot com

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


[Bug ld/30254] iostream crashes with ld linker for windows targets

2023-05-21 Thread euloanty at live dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=30254

--- Comment #10 from cqwrteur  ---
Created attachment 14895
  --> https://sourceware.org/bugzilla/attachment.cgi?id=14895=edit
ld no link

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


[Bug ld/30254] iostream crashes with ld linker for windows targets

2023-05-21 Thread euloanty at live dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=30254

--- Comment #12 from cqwrteur  ---
Ida pro result for GNU ld. I do not see jmp instruction here.


.text:000140001540   ; === S U B R
O U T I N E ===
.text:000140001540
.text:000140001540   ; Attributes: bp-based
frame
.text:000140001540
.text:000140001540   ; int __cdecl main()
.text:000140001540   public main
.text:000140001540   main proc near
 ; CODE XREF: __tmainCRTStartup+169↑p
.text:000140001540 
 ; DATA XREF: .pdata:000140006084↓o
.text:000140001540 55pushrbp
.text:000140001541 48 89 E5  mov rbp, rsp
.text:000140001544 48 83 EC 20   sub rsp, 20h
.text:000140001548   ; #line 4
.text:000140001548 E8 F3 00 00 00call__main
.text:000140001548
.text:00014000154D   ; #line 5
.text:00014000154D 48 8D 05 FC 2A 00 00  lea rax, aHelloWorld  
 ; "Hello World\n"
.text:000140001554 48 89 C2  mov rdx, rax
.text:000140001557 48 8B 05 72 2E 00 00  mov rax,
cs:_refptr__ZSt4cout
.text:00014000155E 48 89 C1  mov rcx, rax
.text:000140001561 E8 1A 00 00 00call   
_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc ;
std::operator<<>(std::ostream &,char const*)
.text:000140001561
.text:000140001566   ; #line 6
.text:000140001566 B8 00 00 00 00mov eax, 0
.text:00014000156B 48 83 C4 20   add rsp, 20h
.text:00014000156F 5Dpop rbp
.text:000140001570 C3retn
.text:000140001570
.text:000140001570   main endp
.text:000140001570
.text:000140001570   ;
---
.text:000140001571   ; #line 6
.text:000140001571   algn_140001571:   
 ; DATA XREF: .pdata:000140006084↓o
.text:000140001571 90 90 90 90 90 90 90 90 90 90+align 20h
.text:000140001580   ; [0006 BYTES:
COLLAPSED FUNCTION std::operator<<>(std::ostream &,char
const*). PRESS CTRL-NUMPAD+ TO EXPAND]
.text:000140001586 90 90 align 8
.text:000140001588   ; [0006 BYTES:
COLLAPSED FUNCTION std::ios_base_library_init(void). PRESS CTRL-NUMPAD+ TO
EXPAND]
.text:00014000158E 90 90 align 10h
.text:000140001590   ; #line 21
.text:000140001590
.text:000140001590   ; === S U B R
O U T I N E ===
.text:000140001590

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


[Bug ld/30254] iostream crashes with ld linker for windows targets

2023-05-21 Thread euloanty at live dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=30254

--- Comment #13 from cqwrteur  ---
.text:000140001588   ; === S U B R
O U T I N E ===
.text:000140001588
.text:000140001588   ; Attributes: thunk
.text:000140001588
.text:000140001588   ; _QWORD
std::ios_base_library_init(void)
.text:000140001588   public
_ZSt21ios_base_library_initv
.text:000140001588  
_ZSt21ios_base_library_initv proc near
.text:000140001588 FF 25 62 7D 00 00 jmp
cs:__imp__ZSt21ios_base_library_initv ; std::ios_base_library_init(void)
.text:000140001588
.text:000140001588  
_ZSt21ios_base_library_initv endp

Should this function be in pdata section??

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


[Bug ld/30254] iostream crashes with ld linker for windows targets

2023-05-21 Thread euloanty at live dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=30254

--- Comment #8 from cqwrteur  ---
Created attachment 14893
  --> https://sourceware.org/bugzilla/attachment.cgi?id=14893=edit
lld has link from text section that jmps here while ld does not

lld has link from text section that jmps here while ld does not

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


[Bug ld/30254] iostream crashes with ld linker for windows targets

2023-05-21 Thread euloanty at live dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=30254

--- Comment #9 from cqwrteur  ---
Created attachment 14894
  --> https://sourceware.org/bugzilla/attachment.cgi?id=14894=edit
ld no link

ld no link 1

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


[Bug ld/30254] iostream crashes with ld linker for windows targets

2023-05-21 Thread euloanty at live dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=30254

--- Comment #11 from cqwrteur  ---
Here is the disassembly result from IDA pro.

.text:000140001540   ; === S U B R
O U T I N E ===
.text:000140001540
.text:000140001540   ; Attributes: bp-based
frame
.text:000140001540
.text:000140001540   ; int __cdecl main()
.text:000140001540   main proc near
 ; CODE XREF: __tmainCRTStartup+169↑p
.text:000140001540 
 ; DATA XREF: .pdata:000140007084↓o
.text:000140001540 55pushrbp
.text:000140001541 48 89 E5  mov rbp, rsp
.text:000140001544 48 83 EC 20   sub rsp, 20h
.text:000140001548   ; #line 4
.text:000140001548 E8 F3 00 00 00call__main
.text:000140001548
.text:00014000154D   ; #line 5
.text:00014000154D 48 8D 05 4C 1C 00 00  lea rax, aHelloWorld  
 ; "Hello World\n"
.text:000140001554 48 89 C2  mov rdx, rax
.text:000140001557 48 8B 05 52 1C 00 00  mov rax,
cs:off_1400031B0
.text:00014000155E 48 89 C1  mov rcx, rax
.text:000140001561 E8 1A 00 00 00call   
_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc ;
std::operator<<>(std::ostream &,char const*)
.text:000140001561
.text:000140001566   ; #line 6
.text:000140001566 B8 00 00 00 00mov eax, 0
.text:00014000156B 48 83 C4 20   add rsp, 20h
.text:00014000156F 5Dpop rbp
.text:000140001570 C3retn
.text:000140001570
.text:000140001570   main endp
.text:000140001570
.text:000140001570   ;
---
.text:000140001571   ; #line 6
.text:000140001571   algn_140001571:   
 ; DATA XREF: .pdata:000140007084↓o
.text:000140001571 90 90 90 90 90 90 90 90 90 90+align 20h
.text:000140001580   ; [0006 BYTES:
COLLAPSED FUNCTION std::operator<<>(std::ostream &,char
const*). PRESS CTRL-NUMPAD+ TO EXPAND]
.text:000140001586 90 90 align 8
.text:000140001588 FF 25 D2 28 00 00 jmp
cs:_ZSt21ios_base_library_initv ; std::ios_base_library_init(void)
.text:000140001588
.text:000140001588   ;
---
.text:00014000158E 90 90 align 10h
.text:000140001590   ; #line 21

We can see .pdata:000140007084 has a link to std::ios_base_library_init in
libstdc++-6.dll for LLVM lld. However, GNU ld does not do the right thing at
here. It looks like a serious bug in the linker.

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


[Bug ld/30254] iostream crashes with ld linker for windows targets

2023-05-21 Thread euloanty at live dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=30254

--- Comment #14 from cqwrteur  ---
Some one tries this program:
#include 
#include 
#include 
#include 

typedef void* (__cdecl* fn_type_t)(void* self, char const* string);

int main()
{
MessageBoxA(nullptr,"pause",nullptr,0);
auto hModule = GetModuleHandleA("libstdc++-6.dll");
auto cout = reinterpret_cast(GetProcAddress(hModule,
"_ZSt4cout"));
auto fn = reinterpret_cast(GetProcAddress(hModule,
"_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc"));
fn(cout, "Hello World!\n");
std::cout << "Hello World!\n";
return 0;
}

He found std::cout binds to the wrong address for ld.

Here is a variable inside the PE file.
void * address = ::cout;

Now, we want to make this = address, but GNU LD gives you this = 

This pointer is incorrect,
so it will definitely result in an error.

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


[Bug ld/30254] iostream crashes with ld linker for windows targets

2023-05-21 Thread euloanty at live dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=30254

--- Comment #15 from cqwrteur  ---
Created attachment 14896
  --> https://sourceware.org/bugzilla/attachment.cgi?id=14896=edit
He found that ld binds std::cout to the address of std::cout in the dll

Why is this .refptr?? It should be just bound to _ZSt4cout

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


[Bug ld/30254] iostream crashes with ld linker for windows targets

2023-05-21 Thread euloanty at live dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=30254

--- Comment #7 from cqwrteur  ---
Created attachment 14892
  --> https://sourceware.org/bugzilla/attachment.cgi?id=14892=edit
executable

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


[Bug ld/30254] iostream crashes with ld linker for windows targets

2023-05-21 Thread euloanty at live dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=30254

--- Comment #6 from cqwrteur  ---
Created attachment 14891
  --> https://sourceware.org/bugzilla/attachment.cgi?id=14891=edit
ld missing import of ios_base_library_init

I use lld and it imports one more symbol than ld. 
I guess it is the reason since libstdc++ does this:
#ifdef _GLIBCXX_SYMVER_GNU
#pragma GCC diagnostic ignored "-Wattribute-alias"

  void ios_base_library_init (void)
  __attribute__((alias ("_ZNSt8ios_base4InitC1Ev")));
#endif


https://github.com/gcc-mirror/gcc/blob/master/libstdc%2B%2B-v3/src/c%2B%2B98/ios_init.cc

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


[Bug ld/30254] iostream crashes with ld linker for windows targets

2023-05-21 Thread euloanty at live dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=30254

--- Comment #16 from cqwrteur  ---
Created attachment 14897
  --> https://sourceware.org/bugzilla/attachment.cgi?id=14897=edit
Someone has found the problem here

Someone has found the problem here.

std::cout does not bind correctly for ld

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


[Bug ld/30254] iostream crashes with ld linker for windows targets

2023-05-21 Thread euloanty at live dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=30254

--- Comment #17 from cqwrteur  ---
Created attachment 14898
  --> https://sourceware.org/bugzilla/attachment.cgi?id=14898=edit
English translation

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


Issue 59148 in oss-fuzz: binutils:fuzz_addr2line: Heap-buffer-overflow in bfd_getl32

2023-05-21 Thread sheriffbot via monorail
Updates:
Labels: -restrict-view-commit

Comment #3 on issue 59148 by sheriffbot: binutils:fuzz_addr2line: 
Heap-buffer-overflow in bfd_getl32
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=59148#c3

This bug has been fixed. It has been opened to the public.

- Your friendly Sheriffbot

-- 
You received this message because:
  1. You were specifically CC'd on the issue

You may adjust your notification preferences at:
https://bugs.chromium.org/hosting/settings

Reply to this email to add a comment.

[Bug binutils/30479] New: bfd.info build failure on centos 8

2023-05-21 Thread nightstrike at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=30479

Bug ID: 30479
   Summary: bfd.info build failure on centos 8
   Product: binutils
   Version: unspecified
Status: UNCONFIRMED
  Severity: normal
  Priority: P2
 Component: binutils
  Assignee: unassigned at sourceware dot org
  Reporter: nightstrike at gmail dot com
  Target Milestone: ---

See https://sourceware.org/bugzilla/show_bug.cgi?id=29476 for related problems.

The 2.40 tar release requires makeinfo as well.  So while gprof was fixed, bfd
is still a problem.  I am assuming that building the documentation for a
release tar is not supposed to be required.  In this case, I am trying it on a
system that doesn't have makeinfo installed at all.

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


[Bug binutils/30479] bfd.info build failure on centos 8

2023-05-21 Thread nightstrike at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=30479

--- Comment #2 from nightstrike  ---
Renaming the included texinfo directory to test configure's ability to build
texinfo shows that that doesn't even work anymore:

/bin/sh: line 7:
/tmp/src/binutils-2.40/_/build-x86_64-pc-linux-gnu/texinfo/makeinfo/makeinfo:
No such file or directory
/bin/sh: line 7:
/tmp/src/binutils-2.40/_/build-x86_64-pc-linux-gnu/texinfo/makeinfo/makeinfo:
No such file or directory
make[5]: *** [Makefile:1564: texinfo.info] Error 127


The build-x86_64-pc-linux-gnu dir is never created, let alone anything else.

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


[Bug binutils/30479] bfd.info build failure on centos 8

2023-05-21 Thread nightstrike at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=30479

nightstrike  changed:

   What|Removed |Added

Version|unspecified |2.40

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


[Bug binutils/30481] New: bfd version inconsistencies

2023-05-21 Thread nightstrike at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=30481

Bug ID: 30481
   Summary: bfd version inconsistencies
   Product: binutils
   Version: 2.40
Status: UNCONFIRMED
  Severity: normal
  Priority: P2
 Component: binutils
  Assignee: unassigned at sourceware dot org
  Reporter: nightstrike at gmail dot com
  Target Milestone: ---

The following warnings are emitted during the build, many times each:

In file included from ../../gprof/../bfd/sysdep.h:29,
 from ../../gprof/gprof.h:33:
../bfd/config.h:327: note: this is the location of the previous definition
  327 | #define VERSION "2.40"
  |
In file included from ../../gprof/gprof.h:41,
 from ../../gprof/corefile.c:22:
./gconfig.h:104: warning: "VERSION" redefined
  104 | #define VERSION "2.40.00"
  |


There is an inconsistency in naming convention regarding 2.40 and 2.40.00.

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


[Bug binutils/30479] bfd.info build failure on centos 8

2023-05-21 Thread nightstrike at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=30479

--- Comment #1 from nightstrike  ---
It looks like adding texinfo to top level to be built automatically (like isl,
gmp, mpfr, mpc, dejagnu, and a bunch of other stuff) doesn't work OOTB, because
the binutils tarball include a texinfo directory containing a texinfo.tex file.
 That invalidates all of the top level configure rules, such as
"maybe-configure-texinfo", etc.

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


[Bug binutils/30481] bfd version inconsistencies

2023-05-21 Thread amodra at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=30481

Alan Modra  changed:

   What|Removed |Added

 Resolution|--- |FIXED
 Status|UNCONFIRMED |RESOLVED

--- Comment #1 from Alan Modra  ---
This has already been fixed on the 2.40 branch.

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


[Bug binutils/30479] bfd.info build failure on centos 8

2023-05-21 Thread nightstrike at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=30479

--- Comment #3 from nightstrike  ---
Ok, I worked around it for now by touching bfd/doc/bfd.info and gas/doc/as.info
(which also exhibited the problem) in the source dir.  I had to do this
individually, and before each rebuild.  I think the build system can be
improved here, though.  And certainly, texinfo should be buildable.

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