1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 20:51:52 +01:00

[llvm-dlltool] Set a proper machine type for weak symbol object files

This makes GNU binutils not reject the libraries outright.

GNU ld handles weak externals slightly differently though, so it
can't use them for aliases in import libraries, but this makes GNU
ld able to use the rest of the import libraries.

LLD accepted object files with machine type 0 aka
IMAGE_FILE_MACHINE_UNKNOWN.

Differential Revision: https://reviews.llvm.org/D59742

llvm-svn: 356982
This commit is contained in:
Martin Storsjo 2019-03-26 09:02:44 +00:00
parent 6799203cd2
commit 408fe055df
2 changed files with 4 additions and 1 deletions

View File

@ -495,7 +495,7 @@ NewArchiveMember ObjectFactory::createWeakExternal(StringRef Sym,
// COFF Header
coff_file_header Header{
u16(0),
u16(Machine),
u16(NumberOfSections),
u32(0),
u32(sizeof(Header) + (NumberOfSections * sizeof(coff_section))),

View File

@ -1,5 +1,6 @@
; RUN: llvm-dlltool -m i386:x86-64 --input-def %s --output-lib %t.a
; RUN: llvm-nm %t.a | FileCheck %s
; RUN: llvm-readobj %t.a | FileCheck -check-prefix=ARCH %s
LIBRARY test.dll
EXPORTS
@ -26,3 +27,5 @@ ImpLibName3 = kernel32.Sleep
; CHECK-NEXT: W __imp_ImpLibName2
; CHECK: T ImpLibName3
; CHECK-NEXT: T __imp_ImpLibName3
; ARCH-NOT: unknown arch