summaryrefslogtreecommitdiffstats
path: root/lld/test
diff options
context:
space:
mode:
authorRui Ueyama <ruiu@google.com>2014-03-18 19:37:50 +0000
committerRui Ueyama <ruiu@google.com>2014-03-18 19:37:50 +0000
commit7ad72ebc5e1429c3a337f7b51d01c6f292bdacdc (patch)
tree82073eb16db3be54a74a6e46fb63278c3d7a4ca1 /lld/test
parent4e39f717fffda8f41c54f17d6af336f604bce8af (diff)
downloadbcm5719-llvm-7ad72ebc5e1429c3a337f7b51d01c6f292bdacdc.tar.gz
bcm5719-llvm-7ad72ebc5e1429c3a337f7b51d01c6f292bdacdc.zip
[PECOFF] Support yet another new type of weak symbol.
COMDAT_SELECT_LARGEST is a COMDAT type that make linker to choose the largest definition from among all of the definition of a symbol. If the size is the same, the choice is arbitrary. Differential Revision: http://llvm-reviews.chandlerc.com/D3011 llvm-svn: 204172
Diffstat (limited to 'lld/test')
-rw-r--r--lld/test/pecoff/Inputs/merge-largest1.obj.yaml25
-rw-r--r--lld/test/pecoff/Inputs/merge-largest2.obj.yaml25
-rw-r--r--lld/test/pecoff/merge-largest.test24
3 files changed, 74 insertions, 0 deletions
diff --git a/lld/test/pecoff/Inputs/merge-largest1.obj.yaml b/lld/test/pecoff/Inputs/merge-largest1.obj.yaml
new file mode 100644
index 00000000000..40ba41f3672
--- /dev/null
+++ b/lld/test/pecoff/Inputs/merge-largest1.obj.yaml
@@ -0,0 +1,25 @@
+---
+header:
+ Machine: IMAGE_FILE_MACHINE_I386
+ Characteristics: [ ]
+sections:
+ - Name: .text
+ Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_LNK_COMDAT, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
+ Alignment: 16
+ SectionData: 00112233
+symbols:
+ - Name: .text
+ Value: 0
+ SectionNumber: 1
+ SimpleType: IMAGE_SYM_TYPE_NULL
+ ComplexType: IMAGE_SYM_DTYPE_NULL
+ StorageClass: IMAGE_SYM_CLASS_STATIC
+ NumberOfAuxSymbols: 1
+ AuxiliaryData: 0700000000000000C979F796000006000000
+ - Name: "_foo"
+ Value: 0
+ SectionNumber: 1
+ SimpleType: IMAGE_SYM_TYPE_NULL
+ ComplexType: IMAGE_SYM_DTYPE_FUNCTION
+ StorageClass: IMAGE_SYM_CLASS_EXTERNAL
+...
diff --git a/lld/test/pecoff/Inputs/merge-largest2.obj.yaml b/lld/test/pecoff/Inputs/merge-largest2.obj.yaml
new file mode 100644
index 00000000000..962489a20a1
--- /dev/null
+++ b/lld/test/pecoff/Inputs/merge-largest2.obj.yaml
@@ -0,0 +1,25 @@
+---
+header:
+ Machine: IMAGE_FILE_MACHINE_I386
+ Characteristics: [ ]
+sections:
+ - Name: .text
+ Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_LNK_COMDAT, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
+ Alignment: 16
+ SectionData: 0011223344556677
+symbols:
+ - Name: .text
+ Value: 0
+ SectionNumber: 1
+ SimpleType: IMAGE_SYM_TYPE_NULL
+ ComplexType: IMAGE_SYM_DTYPE_NULL
+ StorageClass: IMAGE_SYM_CLASS_STATIC
+ NumberOfAuxSymbols: 1
+ AuxiliaryData: 0700000000000000C979F796000006000000
+ - Name: "_foo"
+ Value: 6
+ SectionNumber: 1
+ SimpleType: IMAGE_SYM_TYPE_NULL
+ ComplexType: IMAGE_SYM_DTYPE_FUNCTION
+ StorageClass: IMAGE_SYM_CLASS_EXTERNAL
+...
diff --git a/lld/test/pecoff/merge-largest.test b/lld/test/pecoff/merge-largest.test
new file mode 100644
index 00000000000..73d2d940660
--- /dev/null
+++ b/lld/test/pecoff/merge-largest.test
@@ -0,0 +1,24 @@
+# RUN: yaml2obj %p/Inputs/merge-largest1.obj.yaml > %t1.obj
+# RUN: yaml2obj %p/Inputs/merge-largest2.obj.yaml > %t2.obj
+#
+# RUN: lld -flavor link /out:%t.exe /subsystem:console /opt:noref /force \
+# RUN: -- %t1.obj %t2.obj 2>&1 > %t.log
+#
+# FileCheck complains if the input files is empty, so add a dummy line.
+# RUN: echo foo >> %t.log
+# RUN: FileCheck -check-prefix=STDERR %s < %t.log
+#
+# RUN: llvm-readobj -sections %t.exe | FileCheck -check-prefix=READOBJ %s
+
+STDERR-NOT: duplicate symbol error
+
+READOBJ: Format: COFF-i386
+READOBJ-NEXT: Arch: i386
+READOBJ-NEXT: AddressSize: 32bit
+READOBJ-NEXT: Sections [
+READOBJ-NEXT: Section {
+READOBJ-NEXT: Number: 1
+READOBJ-NEXT: Name: .text (2E 74 65 78 74 00 00 00)
+READOBJ-NEXT: VirtualSize: 0x8
+READOBJ-NEXT: VirtualAddress: 0x1000
+READOBJ-NEXT: RawDataSize: 8
OpenPOWER on IntegriCloud