bug-binutils
[Top][All Lists]
Advanced

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

[Bug binutils/29810] New: objcopy to pe-i386 corrupts relocations


From: stsp at users dot sourceforge.net
Subject: [Bug binutils/29810] New: objcopy to pe-i386 corrupts relocations
Date: Sat, 19 Nov 2022 19:40:51 +0000

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

            Bug ID: 29810
           Summary: objcopy to pe-i386 corrupts relocations
           Product: binutils
           Version: 2.39
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: binutils
          Assignee: unassigned at sourceware dot org
          Reporter: stsp at users dot sourceforge.net
  Target Milestone: ---

Created attachment 14468
  --> https://sourceware.org/bugzilla/attachment.cgi?id=14468&action=edit
test case

Attached test-case shows that the
program can be compiled correctly
directly to PE - use "make good"
for that.
To demonstrate the bug, use "make bad" -
in that case an extra step is added,
such as the source is compiled to elf
first and then converted to PE with
objcopy.
The test-case manages to avoid the linker crash
https://sourceware.org/bugzilla/show_bug.cgi?id=29807
by using strip, and it manages to avoid
https://sourceware.org/bugzilla/show_bug.cgi?id=29809
by using "strip --strip-debug".
At the end, linking fails complaining to
the "0-bit reloc in dll":

i686-w64-mingw32-gcc hel.o prnt.o -o bad.exe
/usr/bin/i686-w64-mingw32-ld: error: 0-bit reloc in dll
/usr/bin/i686-w64-mingw32-ld: error: 0-bit reloc in dll
/usr/bin/i686-w64-mingw32-ld: error: 0-bit reloc in dll
/usr/bin/i686-w64-mingw32-ld: error: 0-bit reloc in dll
collect2: error: ld returned 1 exit status
make: *** [Makefile:14: bad.exe] Error 1

The test case uses mingw for convenience, but
the same error happens invoking ld directly:

$ ld -mi386pe hel.o prnt.o -o bad.exe
ld: error: 0-bit reloc in dll
ld: error: 0-bit reloc in dll
ld: error: 0-bit reloc in dll
ld: error: 0-bit reloc in dll

-- 
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]