http://sourceware.org/bugzilla/show_bug.cgi?id=12835

           Summary: crossbinutils produces broken mingw64 binaries.
           Product: binutils
           Version: 2.21
            Status: NEW
          Severity: normal
          Priority: P2
         Component: ld
        AssignedTo: unassig...@sources.redhat.com
        ReportedBy: pl...@agmk.net


Created attachment 5762
  --> http://sourceware.org/bugzilla/attachment.cgi?id=5762
testcase

Hi,

during investigating the http://gcc.gnu.org/PR47308 i've discovered that
executable linked by toolchain hosted on windows looks/works fine while
executable linked by crossmingw64 toolchain (host:linux, target:mingw64)
is corrupted in some way.

attached testcase contains objects compiled on linux crosstoolchain
and executables linked on both platforms.

loading both execs to gdb on windows shows difference:

D:\>mingw64\bin\gdb main-dw3-linked-on-linux.exe

Breakpoint 1, 0x0000000000401550 in main ()
(gdb) disassemble
Dump of assembler code for function main():
=> 0x0000000000401550 <+0>:     push   %rbp
   0x0000000000401551 <+1>:     push   %r15
   0x0000000000401553 <+3>:     push   %r14
   0x0000000000401555 <+5>:     push   %r13
   0x0000000000401557 <+7>:     push   %r12
   0x0000000000401559 <+9>:     push   %rdi
   0x000000000040155a <+10>:    push   %rsi
   0x000000000040155b <+11>:    push   %rbx
   0x000000000040155c <+12>:    sub    $0x158,%rsp
   0x0000000000401563 <+19>:    lea    0x80(%rsp),%rbp
   0x000000000040156b <+27>:    movaps %xmm6,0x30(%rbp)
   0x000000000040156f <+31>:    movaps %xmm7,0x40(%rbp)
   0x0000000000401573 <+35>:    movaps %xmm8,0x50(%rbp)
   0x0000000000401578 <+40>:    movaps %xmm9,0x60(%rbp)
   0x000000000040157d <+45>:    movaps %xmm10,0x70(%rbp)
   0x0000000000401582 <+50>:    movaps %xmm11,0x80(%rbp)
   0x000000000040158a <+58>:    movaps %xmm12,0x90(%rbp)
   0x0000000000401592 <+66>:    movaps %xmm13,0xa0(%rbp)
   0x000000000040159a <+74>:    movaps %xmm14,0xb0(%rbp)
   0x00000000004015a2 <+82>:    movaps %xmm15,0xc0(%rbp)
   0x00000000004015aa <+90>:    Dwarf Error: Cannot find signatured DIE
referenced from DIE at 0x20c [in module D:\main-dw3-linked-on-linux.exe]


D:\>mingw64\bin\gdb main-dw3-linked-on-windows.exe

Breakpoint 1, 0x0000000000401550 in main ()
(gdb) disassemble
Dump of assembler code for function main():
=> 0x0000000000401550 <+0>:     push   %rbp
   0x0000000000401551 <+1>:     push   %r15
   0x0000000000401553 <+3>:     push   %r14
   0x0000000000401555 <+5>:     push   %r13
   0x0000000000401557 <+7>:     push   %r12
   0x0000000000401559 <+9>:     push   %rdi
   0x000000000040155a <+10>:    push   %rsi
   0x000000000040155b <+11>:    push   %rbx
   0x000000000040155c <+12>:    sub    $0x158,%rsp
   0x0000000000401563 <+19>:    lea    0x80(%rsp),%rbp
   0x000000000040156b <+27>:    movaps %xmm6,0x30(%rbp)
   0x000000000040156f <+31>:    movaps %xmm7,0x40(%rbp)
   0x0000000000401573 <+35>:    movaps %xmm8,0x50(%rbp)
   0x0000000000401578 <+40>:    movaps %xmm9,0x60(%rbp)
   0x000000000040157d <+45>:    movaps %xmm10,0x70(%rbp)
   0x0000000000401582 <+50>:    movaps %xmm11,0x80(%rbp)
   0x000000000040158a <+58>:    movaps %xmm12,0x90(%rbp)
   0x0000000000401592 <+66>:    movaps %xmm13,0xa0(%rbp)
   0x000000000040159a <+74>:    movaps %xmm14,0xb0(%rbp)
   0x00000000004015a2 <+82>:    movaps %xmm15,0xc0(%rbp)
   0x00000000004015aa <+90>:
    lea    0xadbf(%rip),%rax        # 0x40c370
<__cxxabiv1::__gxx_personality_sj0(int, _Unwind_Action,
_Unwind_Exception_Class, _Unwind_Exception*, _U
nwind_Context*)>
   0x00000000004015b1 <+97>:    mov    %rax,-0x20(%rbp)
   0x00000000004015b5 <+101>:   lea    0xb564(%rip),%rax        # 0x40cb20
<___DTOR_LIST__+16>
   0x00000000004015bc <+108>:   mov    %rax,-0x18(%rbp)
   0x00000000004015c0 <+112>:   lea    -0x10(%rbp),%rax
   (...)

to reproduce the bug you need to compile and link testcase
on linux (runme.sh) and later relink on windows (runme.cmd).

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

_______________________________________________
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils

Reply via email to