From a6ffc9c8df8f8bb7ec36d011e0aed6e1e808916c Mon Sep 17 00:00:00 2001 From: Martin Storsjo Date: Fri, 20 Jul 2018 20:48:29 +0000 Subject: [COFF] Adjust how we flag weak externals This fixes PR36096. Originally based on a patch by Martell Malone. Differential Revision: https://reviews.llvm.org/D44357 llvm-svn: 337613 --- llvm/test/tools/llvm-ar/coff-weak.yaml | 53 ++++++++++++++++++++++ llvm/test/tools/llvm-dlltool/coff-decorated.def | 2 +- llvm/test/tools/llvm-dlltool/coff-weak-exports.def | 8 ++-- 3 files changed, 58 insertions(+), 5 deletions(-) create mode 100644 llvm/test/tools/llvm-ar/coff-weak.yaml (limited to 'llvm/test/tools') diff --git a/llvm/test/tools/llvm-ar/coff-weak.yaml b/llvm/test/tools/llvm-ar/coff-weak.yaml new file mode 100644 index 00000000000..c66271dc8a7 --- /dev/null +++ b/llvm/test/tools/llvm-ar/coff-weak.yaml @@ -0,0 +1,53 @@ +# RUN: yaml2obj %s -o %t.obj +# +# RUN: rm -f %t.ar +# RUN: llvm-ar crs %t.a %t.obj +# RUN: llvm-nm -print-armap %t.a | FileCheck %s + +# CHECK: Archive map +# CHECK-NEXT: WeakSearchAlias in coff-weak.yaml.tmp.obj +# CHECK-EMPTY: + +--- !COFF +header: + Machine: IMAGE_FILE_MACHINE_UNKNOWN + Characteristics: [ ] +sections: + - Name: .drectve + Characteristics: [ IMAGE_SCN_LNK_INFO, IMAGE_SCN_LNK_REMOVE ] + SectionData: '' +symbols: + - Name: NormalUndefined + Value: 0 + SectionNumber: 0 + SimpleType: IMAGE_SYM_TYPE_NULL + ComplexType: IMAGE_SYM_DTYPE_NULL + StorageClass: IMAGE_SYM_CLASS_EXTERNAL + - Name: WeakSearchAlias + Value: 0 + SectionNumber: 0 + SimpleType: IMAGE_SYM_TYPE_NULL + ComplexType: IMAGE_SYM_DTYPE_NULL + StorageClass: IMAGE_SYM_CLASS_WEAK_EXTERNAL + WeakExternal: + TagIndex: 0 + Characteristics: IMAGE_WEAK_EXTERN_SEARCH_ALIAS + - Name: WeakSearchLibrary + Value: 0 + SectionNumber: 0 + SimpleType: IMAGE_SYM_TYPE_NULL + ComplexType: IMAGE_SYM_DTYPE_NULL + StorageClass: IMAGE_SYM_CLASS_WEAK_EXTERNAL + WeakExternal: + TagIndex: 0 + Characteristics: IMAGE_WEAK_EXTERN_SEARCH_LIBRARY + - Name: WeakSearchNolibrary + Value: 0 + SectionNumber: 0 + SimpleType: IMAGE_SYM_TYPE_NULL + ComplexType: IMAGE_SYM_DTYPE_NULL + StorageClass: IMAGE_SYM_CLASS_WEAK_EXTERNAL + WeakExternal: + TagIndex: 0 + Characteristics: IMAGE_WEAK_EXTERN_SEARCH_NOLIBRARY +... diff --git a/llvm/test/tools/llvm-dlltool/coff-decorated.def b/llvm/test/tools/llvm-dlltool/coff-decorated.def index d6496b098f9..3885abca836 100644 --- a/llvm/test/tools/llvm-dlltool/coff-decorated.def +++ b/llvm/test/tools/llvm-dlltool/coff-decorated.def @@ -22,5 +22,5 @@ StdcallAlias@4==StdcallFunction@4 ; CHECK: Name type: name ; CHECK: Symbol: __imp_??_7exception@@6B@ ; CHECK: Symbol: ??_7exception@@6B@ -; CHECK-NM: w _StdcallAlias@4 +; CHECK-NM: W _StdcallAlias@4 ; CHECK-NM: U _StdcallFunction@4 diff --git a/llvm/test/tools/llvm-dlltool/coff-weak-exports.def b/llvm/test/tools/llvm-dlltool/coff-weak-exports.def index 693a03a445a..dbc59be8ae1 100644 --- a/llvm/test/tools/llvm-dlltool/coff-weak-exports.def +++ b/llvm/test/tools/llvm-dlltool/coff-weak-exports.def @@ -15,14 +15,14 @@ ImpLibName2 = Implementation2 == AltTestFunction2 ImpLibName3 = kernel32.Sleep ; CHECK: U AltTestFunction -; CHECK-NEXT: w TestFunction +; CHECK-NEXT: W TestFunction ; CHECK: U __imp_AltTestFunction -; CHECK-NEXT: w __imp_TestFunction +; CHECK-NEXT: W __imp_TestFunction ; CHECK: T ImpLibName ; CHECK-NEXT: T __imp_ImpLibName ; CHECK: U AltTestFunction2 -; CHECK-NEXT: w ImpLibName2 +; CHECK-NEXT: W ImpLibName2 ; CHECK: U __imp_AltTestFunction2 -; CHECK-NEXT: w __imp_ImpLibName2 +; CHECK-NEXT: W __imp_ImpLibName2 ; CHECK: T ImpLibName3 ; CHECK-NEXT: T __imp_ImpLibName3 -- cgit v1.2.3