[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug binutils/23348] New: binutils strip corrupts binaries produced by c
From: |
jacek at codeweavers dot com |
Subject: |
[Bug binutils/23348] New: binutils strip corrupts binaries produced by clang+lld+mingw-w64 toolchain |
Date: |
Wed, 27 Jun 2018 19:19:18 +0000 |
https://sourceware.org/bugzilla/show_bug.cgi?id=23348
Bug ID: 23348
Summary: binutils strip corrupts binaries produced by
clang+lld+mingw-w64 toolchain
Product: binutils
Version: 2.32 (HEAD)
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: binutils
Assignee: unassigned at sourceware dot org
Reporter: jacek at codeweavers dot com
Target Milestone: ---
Created attachment 11103
--> https://sourceware.org/bugzilla/attachment.cgi?id=11103&action=edit
test.exe
The problem can be reproduced by toolchains using mingw-w64 with clang and lld
such as:
https://github.com/mstorsjo/llvm-mingw
or attempts to build Mozilla with similar config:
https://bugzilla.mozilla.org/show_bug.cgi?id=1465798
Stripped binaries can't be ran on Windows and instead I get "is not a valid
win32 application" error. Experimenting a bit, I found if we use -Wl,-s to let
linker strip the binaries and then strip again with binutils, the resulting
file is fine.
To reproduce:
$ cat test.c
#include <stdio.h>
int main() {
printf("hello world\n");
return 0;
}
$ x86_64-w64-mingw32-clang test.c -o test.exe
# test.exe works fine
$ x86_64-w64-mingw32-strip test.exe -o test-stripped-by-binutils.exe
# test-stripped-by-binutils.exe is corrupted
I will attach test.exe and test-stripped-by-binutils.exe.
--
You are receiving this mail because:
You are on the CC list for the bug.
- [Bug binutils/23348] New: binutils strip corrupts binaries produced by clang+lld+mingw-w64 toolchain,
jacek at codeweavers dot com <=