Skip to content

Commit 74cfa7a

Browse files
committed
Merging r356982:
------------------------------------------------------------------------ r356982 | mstorsjo | 2019-03-26 02:02:44 -0700 (Tue, 26 Mar 2019) | 12 lines [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: 360750
1 parent 0203f70 commit 74cfa7a

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

llvm/lib/Object/COFFImportFile.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,7 @@ NewArchiveMember ObjectFactory::createWeakExternal(StringRef Sym,
496496

497497
// COFF Header
498498
coff_file_header Header{
499-
u16(0),
499+
u16(Machine),
500500
u16(NumberOfSections),
501501
u32(0),
502502
u32(sizeof(Header) + (NumberOfSections * sizeof(coff_section))),

llvm/test/tools/llvm-dlltool/coff-weak-exports.def

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
; RUN: llvm-dlltool -m i386:x86-64 --input-def %s --output-lib %t.a
22
; RUN: llvm-nm %t.a | FileCheck %s
3+
; RUN: llvm-readobj %t.a | FileCheck -check-prefix=ARCH %s
34

45
LIBRARY test.dll
56
EXPORTS
@@ -26,3 +27,5 @@ ImpLibName3 = kernel32.Sleep
2627
; CHECK-NEXT: W __imp_ImpLibName2
2728
; CHECK: T ImpLibName3
2829
; CHECK-NEXT: T __imp_ImpLibName3
30+
31+
; ARCH-NOT: unknown arch

0 commit comments

Comments
 (0)