[lld] r334095 - [lld] Add REQUIRES: x86 where needed to tests
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 6 13:48:36 PDT 2018
Joel,
Your commit contains an unrelated text file `lld/lld-2018June4`. I'll
remove that file for you.
On Wed, Jun 6, 2018 at 7:01 AM Joel Jones via llvm-commits <
llvm-commits at lists.llvm.org> wrote:
> Author: joel_k_jones
> Date: Wed Jun 6 06:56:51 2018
> New Revision: 334095
>
> URL: http://llvm.org/viewvc/llvm-project?rev=334095&view=rev
> Log:
> [lld] Add REQUIRES: x86 where needed to tests
>
> If building lld without x86 support, tests that require that support should
> be treated as unsupported, not errors.
>
> Tested using:
> 1. cmake '-DLLVM_TARGETS_TO_BUILD=AArch64;X86'
> make check-lld
> =>
> Expected Passes : 1406
> Unsupported Tests : 287
>
> 2. cmake '-DLLVM_TARGETS_TO_BUILD=AArch64'
> make check-lld
> =>
> Expected Passes : 410
> Unsupported Tests : 1283
>
> Patch by Joel Jones
>
> Differential Revision: https://reviews.llvm.org/D47748
>
> Added:
> lld/trunk/lld-2018June4
> Modified:
> lld/trunk/test/COFF/associative-comdat.s
> lld/trunk/test/COFF/dll.test
> lld/trunk/test/COFF/dllexport-mingw.s
> lld/trunk/test/COFF/duplicate.test
> lld/trunk/test/COFF/export-all.s
> lld/trunk/test/COFF/gfids-corrupt.s
> lld/trunk/test/COFF/gfids-fallback.s
> lld/trunk/test/COFF/gfids-gc.s
> lld/trunk/test/COFF/gfids-icf.s
> lld/trunk/test/COFF/guard-longjmp.s
> lld/trunk/test/COFF/guardcf-lto.ll
> lld/trunk/test/COFF/icf-executable.s
> lld/trunk/test/COFF/icf-pdata.s
> lld/trunk/test/COFF/icf-xdata.s
> lld/trunk/test/COFF/implib-name.test
> lld/trunk/test/COFF/loadcfg.ll
> lld/trunk/test/COFF/lto-chkstk.ll
> lld/trunk/test/COFF/lto-comdat.ll
> lld/trunk/test/COFF/lto-icf.ll
> lld/trunk/test/COFF/lto-lazy-reference.ll
> lld/trunk/test/COFF/lto-linker-opts.ll
> lld/trunk/test/COFF/lto-new-symbol.ll
> lld/trunk/test/COFF/lto-opt-level.ll
> lld/trunk/test/COFF/lto-parallel.ll
> lld/trunk/test/COFF/lto-reloc-model.ll
> lld/trunk/test/COFF/lto.ll
> lld/trunk/test/COFF/pdb-global-gc.yaml
> lld/trunk/test/COFF/reloc-discarded-dwarf.s
> lld/trunk/test/COFF/reloc-discarded-early.s
> lld/trunk/test/COFF/reloc-discarded-early2.s
> lld/trunk/test/COFF/reloc-discarded.s
> lld/trunk/test/COFF/reloc-x64.test
> lld/trunk/test/COFF/reloc-x86.test
> lld/trunk/test/COFF/safeseh-md.s
> lld/trunk/test/COFF/safeseh-notable.s
> lld/trunk/test/COFF/safeseh.s
> lld/trunk/test/COFF/secidx-absolute.s
> lld/trunk/test/COFF/secrel-absolute.s
> lld/trunk/test/COFF/secrel-common.s
> lld/trunk/test/COFF/undefined-symbol-cv.s
> lld/trunk/test/COFF/undefined-symbol.s
> lld/trunk/test/COFF/weak-external.test
> lld/trunk/test/COFF/weak-external2.test
> lld/trunk/test/COFF/weak-external3.test
> lld/trunk/test/COFF/wholearchive.s
> lld/trunk/test/ELF/bsymbolic-undef.s
> lld/trunk/test/ELF/bsymbolic.s
> lld/trunk/test/ELF/comdat-linkonce.s
> lld/trunk/test/ELF/compatible-section-types.s
> lld/trunk/test/ELF/conflict-debug-variable.s
> lld/trunk/test/ELF/conflict-debug-variable2.s
> lld/trunk/test/ELF/conflict-variable-linkage-name.s
> lld/trunk/test/ELF/copy-rel-corrupted.s
> lld/trunk/test/ELF/copy-rel-pie-error.s
> lld/trunk/test/ELF/copy-rel-pie.s
> lld/trunk/test/ELF/defined-tls_get_addr.s
> lld/trunk/test/ELF/dont-export-hidden.s
> lld/trunk/test/ELF/duplicated-synthetic-sym.s
> lld/trunk/test/ELF/dynamic-reloc-index.s
> lld/trunk/test/ELF/eh-frame-marker.s
> lld/trunk/test/ELF/eh-frame-multilpe-cie.s
> lld/trunk/test/ELF/empty-archive.s
> lld/trunk/test/ELF/entry.s
> lld/trunk/test/ELF/filter.s
> lld/trunk/test/ELF/gc-debuginfo-tls.s
> lld/trunk/test/ELF/gc-merge-local-sym.s
> lld/trunk/test/ELF/gc-sections-merge-addend.s
> lld/trunk/test/ELF/gc-sections-merge-implicit-addend.s
> lld/trunk/test/ELF/gc-sections-merge.s
> lld/trunk/test/ELF/gc-sections-protected.s
> lld/trunk/test/ELF/global_offset_table.s
> lld/trunk/test/ELF/global_offset_table_shared.s
> lld/trunk/test/ELF/got-plt-header.s
> lld/trunk/test/ELF/gotpcrelx.s
> lld/trunk/test/ELF/i386-got-value.s
> lld/trunk/test/ELF/i386-tls-ie-shared.s
> lld/trunk/test/ELF/incompatible-section-flags.s
> lld/trunk/test/ELF/incompatible-section-types2.s
> lld/trunk/test/ELF/invalid/invalid-elf.test
> lld/trunk/test/ELF/linkerscript/discard-interp.test
> lld/trunk/test/ELF/linkerscript/openbsd-bootdata.test
> lld/trunk/test/ELF/linkerscript/openbsd-randomize.s
> lld/trunk/test/ELF/linkerscript/openbsd-wxneeded.test
> lld/trunk/test/ELF/local-got-pie.s
> lld/trunk/test/ELF/local-got-shared.s
> lld/trunk/test/ELF/local-got.s
> lld/trunk/test/ELF/map-gc-sections.s
> lld/trunk/test/ELF/pr34872.s
> lld/trunk/test/ELF/pr36475.s
> lld/trunk/test/ELF/relocation-size-shared.s
> lld/trunk/test/ELF/relocation-size.s
> lld/trunk/test/ELF/relro-omagic.s
> lld/trunk/test/ELF/rodynamic.s
> lld/trunk/test/ELF/section-symbol.s
> lld/trunk/test/ELF/shared-lazy.s
> lld/trunk/test/ELF/sht-group-gold-r.test
> lld/trunk/test/ELF/soname.s
> lld/trunk/test/ELF/soname2.s
> lld/trunk/test/ELF/string-gc.s
> lld/trunk/test/ELF/symbol-override.s
> lld/trunk/test/ELF/text-section-prefix.s
> lld/trunk/test/ELF/tls-got.s
> lld/trunk/test/ELF/tls-opt-gdie.s
> lld/trunk/test/ELF/tls-opt-gdiele-i686.s
> lld/trunk/test/ELF/tls-opt-i686.s
> lld/trunk/test/ELF/tls-opt-iele-i686-nopic.s
> lld/trunk/test/ELF/tls-opt-local.s
> lld/trunk/test/ELF/tls-opt-no-plt.s
> lld/trunk/test/ELF/tls-opt.s
> lld/trunk/test/ELF/trace-symbols.s
> lld/trunk/test/ELF/undef-shared.s
> lld/trunk/test/ELF/undef-shared2.s
> lld/trunk/test/ELF/undef-version-script.s
> lld/trunk/test/ELF/user_def_init_array_start.s
> lld/trunk/test/ELF/version-script-no-warn2.s
> lld/trunk/test/ELF/x86-64-reloc-range.s
> lld/trunk/test/ELF/zdefs.s
>
> Added: lld/trunk/lld-2018June4
> URL:
> http://llvm.org/viewvc/llvm-project/lld/trunk/lld-2018June4?rev=334095&view=auto
>
> ==============================================================================
> --- lld/trunk/lld-2018June4 (added)
> +++ lld/trunk/lld-2018June4 Wed Jun 6 06:56:51 2018
> @@ -0,0 +1,5797 @@
> +Index: test/COFF/associative-comdat.s
> +===================================================================
> +--- test/COFF/associative-comdat.s (revision 333896)
> ++++ test/COFF/associative-comdat.s (working copy)
> +@@ -1,47 +1,48 @@
> ++# REQUIRES: x86
> + # RUN: llvm-mc -triple=x86_64-windows-msvc %s -filetype=obj -o %t1.obj
> + # RUN: llvm-mc -triple=x86_64-windows-msvc
> %S/Inputs/associative-comdat-2.s -filetype=obj -o %t2.obj
> +
> + # RUN: lld-link -entry:main %t1.obj %t2.obj -out:%t.gc.exe
> + # RUN: llvm-readobj -sections %t.gc.exe | FileCheck %s
> +
> + # RUN: lld-link -entry:main %t1.obj %t2.obj -opt:noref -out:%t.nogc.exe
> + # RUN: llvm-readobj -sections %t.nogc.exe | FileCheck %s
> +
> + # CHECK: Sections [
> + # CHECK: Section {
> + # CHECK: Number: 2
> + # CHECK-LABEL: Name: .rdata (2E 72 64 61 74 61 00 00)
> + # This is the critical check to show that only *one*
> definition of
> + # foo_assoc was retained. This *must* be 8, not 16.
> + # CHECK-NEXT: VirtualSize: 0x8
> + # CHECK: Section {
> + # CHECK: Number: 3
> + # CHECK-LABEL: Name: .data (2E 64 61 74 61 00 00 00)
> + # CHECK-NEXT: VirtualSize: 0x4
> +
> + .text
> + .def main;
> + .scl 2;
> + .type 32;
> + .endef
> + .globl main # -- Begin function main
> + .p2align 4, 0x90
> + main: # @main
> + # BB#0:
> + movl foo(%rip), %eax
> + retq
> + # -- End function
> +
> + # Defines foo and foo_assoc globals. foo is comdat, and foo_assoc is
> comdat
> + # associative with it. foo_assoc should be discarded iff foo is
> discarded,
> + # either by linker GC or normal comdat merging.
> +
> + .section .rdata,"dr",associative,foo
> + .p2align 3
> + .quad foo
> +
> + .section .data,"dw",discard,foo
> + .globl foo # @foo
> + .p2align 2
> + foo:
> + .long 42
> +Index: test/COFF/dll.test
> +===================================================================
> +--- test/COFF/dll.test (revision 333896)
> ++++ test/COFF/dll.test (working copy)
> +@@ -1,50 +1,51 @@
> ++# REQUIRES: x86
> + # RUN: yaml2obj < %p/Inputs/export.yaml > %t.obj
> + # RUN: lld-link /out:%t.dll /dll %t.obj /export:exportfn1
> /export:exportfn2 \
> + # RUN: /export:mangled
> + # RUN: llvm-objdump -p %t.dll | FileCheck -check-prefix=EXPORT %s
> +
> + EXPORT: Export Table:
> + EXPORT: DLL name: dll.test.tmp.dll
> + EXPORT: Ordinal RVA Name
> + EXPORT-NEXT: 0 0
> + EXPORT-NEXT: 1 0x1008 exportfn1
> + EXPORT-NEXT: 2 0x1010 exportfn2
> + EXPORT-NEXT: 3 0x1010 exportfn3
> + EXPORT-NEXT: 4 0x1010 mangled
> +
> + # RUN: yaml2obj < %p/Inputs/export2.yaml > %t5.obj
> + # RUN: rm -f %t5.lib
> + # RUN: llvm-ar cru %t5.lib %t5.obj
> + # RUN: lld-link /out:%t5.dll /dll %t.obj %t5.lib /export:mangled2
> + # RUN: llvm-objdump -p %t5.dll | FileCheck -check-prefix=EXPORT2 %s
> +
> + EXPORT2: Export Table:
> + EXPORT2: DLL name: dll.test.tmp5.dll
> + EXPORT2: Ordinal RVA Name
> + EXPORT2-NEXT: 0 0
> + EXPORT2-NEXT: 1 0x1010 exportfn3
> + EXPORT2-NEXT: 2 0x101c mangled2
> +
> + # RUN: llvm-as -o %t.lto.obj %p/Inputs/export.ll
> + # RUN: lld-link -opt:noicf /out:%t.lto.dll /dll %t.lto.obj
> /export:exportfn1 /export:exportfn2
> + # RUN: llvm-objdump -p %t.lto.dll | FileCheck -check-prefix=EXPORT-LTO %s
> +
> + EXPORT-LTO: Export Table:
> + EXPORT-LTO: DLL name: dll.test.tmp.lto.dll
> + EXPORT-LTO: Ordinal RVA Name
> + EXPORT-LTO-NEXT: 0 0
> + EXPORT-LTO-NEXT: 1 0x1010 exportfn1
> + EXPORT-LTO-NEXT: 2 0x1020 exportfn2
> + EXPORT-LTO-NEXT: 3 0x1030 exportfn3
> +
> + # RUN: lld-link /out:%t.dll /dll %t.obj /implib:%t2.lib \
> + # RUN: /export:exportfn1 /export:exportfn2
> + # RUN: yaml2obj < %p/Inputs/import.yaml > %t2.obj
> + # RUN: lld-link /out:%t2.exe /entry:main %t2.obj %t2.lib
> + # RUN: llvm-readobj -coff-imports %t2.exe | FileCheck
> -check-prefix=IMPORT %s
> +
> + # RUN: lld-link /out:%t2.lto.exe /entry:main %t2.obj %t.lto.lib
> + # RUN: llvm-readobj -coff-imports %t2.lto.exe | FileCheck
> -check-prefix=IMPORT %s
> +
> + IMPORT: Symbol: exportfn1
> + IMPORT: Symbol: exportfn2
> +Index: test/COFF/dllexport-mingw.s
> +===================================================================
> +--- test/COFF/dllexport-mingw.s (revision 333896)
> ++++ test/COFF/dllexport-mingw.s (working copy)
> +@@ -1,24 +1,24 @@
> +-# REQEUIRES: x86
> ++# REQUIRES: x86
> +
> + # RUN: llvm-mc -triple=i686-windows-gnu %s -filetype=obj -o %t.obj
> +
> + # RUN: lld-link -lldmingw -dll -out:%t.dll -entry:main %t.obj
> -implib:%t.lib
> + # RUN: llvm-readobj %t.lib | FileCheck %s
> +
> + # CHECK: Symbol: __imp___underscoredFunc
> + # CHECK: Symbol: __underscoredFunc
> + # CHECK: Symbol: __imp__func
> + # CHECK: Symbol: _func
> +
> + .global _main
> + .global _func
> + .global __underscoredFunc
> + .text
> + _main:
> + ret
> + _func:
> + ret
> + __underscoredFunc:
> + ret
> + .section .drectve
> + .ascii "-export:func -export:_underscoredFunc"
> +Index: test/COFF/duplicate.test
> +===================================================================
> +--- test/COFF/duplicate.test (revision 333896)
> ++++ test/COFF/duplicate.test (working copy)
> +@@ -1,12 +1,13 @@
> ++# REQUIRES: x86
> + RUN: llc -mtriple x86_64-windows-msvc -filetype obj -o alpha.obj
> %S/Inputs/alpha.ll
> + RUN: llc -mtriple x86_64-windows-msvc -filetype obj -o beta.obj
> %S/Inputs/beta.ll
> + RUN: lld-link /out:alpha.dll /dll alpha.obj /implib:alpha.lib
> + RUN: not lld-link /out:beta.dll /dll alpha.obj beta.obj alpha.lib 2>&1 |
> FileCheck %s -check-prefix CHECK-ALPHA
> +
> + CHECK-ALPHA: error: duplicate symbol: f in {{.*}}alpha.obj and in
> alpha.dll
> +
> + RUN: llc -mtriple x86_64-windows-msvc -filetype obj -o gamma.obj
> %S/Inputs/gamma.ll
> + RUN: not lld-link /out:gamma.exe /subsystem:console
> /entry:mainCRTStartup gamma.obj alpha.lib 2>&1 | FileCheck %s -check-prefix
> CHECK-GAMMA
> +
> + CHECK-GAMMA: error: duplicate symbol: __imp_f in {{.*}}gamma.obj and in
> alpha.dll
> +
> +Index: test/COFF/export-all.s
> +===================================================================
> +--- test/COFF/export-all.s (revision 333896)
> ++++ test/COFF/export-all.s (working copy)
> +@@ -1,86 +1,86 @@
> +-# REQEUIRES: x86
> ++# REQUIRES: x86
> +
> + # RUN: llvm-mc -triple=i686-windows-gnu %s -filetype=obj -o %t.obj
> +
> + # RUN: lld-link -lldmingw -dll -out:%t.dll -entry:DllMainCRTStartup at 12
> %t.obj -implib:%t.lib
> + # RUN: llvm-readobj -coff-exports %t.dll | FileCheck %s
> + # RUN: llvm-readobj %t.lib | FileCheck -check-prefix=IMPLIB %s
> +
> + # CHECK-NOT: Name: DllMainCRTStartup
> + # CHECK-NOT: Name: _imp__unexported
> + # CHECK: Name: dataSym
> + # CHECK: Name: foobar
> + # CHECK-NOT: Name: unexported
> +
> + # IMPLIB: Symbol: __imp__dataSym
> + # IMPLIB-NOT: Symbol: _dataSym
> + # IMPLIB: Symbol: __imp__foobar
> + # IMPLIB: Symbol: _foobar
> +
> + .global _foobar
> + .global _DllMainCRTStartup at 12
> + .global _dataSym
> + .global _unexported
> + .global __imp__unexported
> + .text
> + _DllMainCRTStartup at 12:
> + ret
> + _foobar:
> + ret
> + _unexported:
> + ret
> + .data
> + _dataSym:
> + .int 4
> + __imp__unexported:
> + .int _unexported
> +
> + # Test specifying -export-all-symbols, on an object file that contains
> + # dllexport directive for some of the symbols.
> +
> + # RUN: yaml2obj < %p/Inputs/export.yaml > %t.obj
> + #
> + # RUN: lld-link -out:%t.dll -dll %t.obj -lldmingw -export-all-symbols
> -output-def:%t.def
> + # RUN: llvm-readobj -coff-exports %t.dll | FileCheck
> -check-prefix=CHECK2 %s
> + # RUN: cat %t.def | FileCheck -check-prefix=CHECK2-DEF %s
> +
> + # Note, this will actually export _DllMainCRTStartup as well, since
> + # it uses the standard spelling in this object file, not the MinGW one.
> +
> + # CHECK2: Name: exportfn1
> + # CHECK2: Name: exportfn2
> + # CHECK2: Name: exportfn3
> +
> + # CHECK2-DEF: EXPORTS
> + # CHECK2-DEF: exportfn1 @3
> + # CHECK2-DEF: exportfn2 @4
> + # CHECK2-DEF: exportfn3 @5
> +
> + # Test ignoring certain object files and libs.
> +
> + # RUN: echo -e ".global foobar\n.global
> DllMainCRTStartup\n.text\nDllMainCRTStartup:\nret\nfoobar:\ncall
> mingwfunc\ncall crtfunc\nret\n" > %t.main.s
> + # RUN: llvm-mc -triple=x86_64-windows-gnu %t.main.s -filetype=obj -o
> %t.main.obj
> + # RUN: mkdir -p %T/libs
> + # RUN: echo -e ".global mingwfunc\n.text\nmingwfunc:\nret\n" >
> %T/libs/mingwfunc.s
> + # RUN: llvm-mc -triple=x86_64-windows-gnu %T/libs/mingwfunc.s
> -filetype=obj -o %T/libs/mingwfunc.o
> + # RUN: llvm-ar rcs %T/libs/libmingwex.a %T/libs/mingwfunc.o
> + # RUN: echo -e ".global crtfunc\n.text\ncrtfunc:\nret\n" >
> %T/libs/crtfunc.s
> + # RUN: llvm-mc -triple=x86_64-windows-gnu %T/libs/crtfunc.s
> -filetype=obj -o %T/libs/crt2.o
> + # RUN: lld-link -out:%t.dll -dll -entry:DllMainCRTStartup %t.main.obj
> -lldmingw %T/libs/crt2.o %T/libs/libmingwex.a -output-def:%t.def
> + # RUN: echo "EOF" >> %t.def
> + # RUN: cat %t.def | FileCheck -check-prefix=CHECK-EXCLUDE %s
> +
> + # CHECK-EXCLUDE: EXPORTS
> + # CHECK-EXCLUDE-NEXT: foobar @1
> + # CHECK-EXCLUDE-NEXT: EOF
> +
> + # Test that we handle import libraries together with -opt:noref.
> +
> + # RUN: yaml2obj < %p/Inputs/hello32.yaml > %t.obj
> + # RUN: lld-link -lldmingw -dll -out:%t.dll -entry:main at 0 %t.obj
> -implib:%t.lib -opt:noref %p/Inputs/std32.lib -output-def:%t.def
> + # RUN: echo "EOF" >> %t.def
> + # RUN: cat %t.def | FileCheck -check-prefix=CHECK-IMPLIB %s
> +
> + # CHECK-IMPLIB: EXPORTS
> + # CHECK-IMPLIB-NEXT: main at 0 @1
> + # CHECK-IMPLIB-NEXT: EOF
> +Index: test/COFF/gfids-corrupt.s
> +===================================================================
> +--- test/COFF/gfids-corrupt.s (revision 333896)
> ++++ test/COFF/gfids-corrupt.s (working copy)
> +@@ -1,83 +1,84 @@
> ++# REQUIRES: x86
> + # RUN: llvm-mc -triple x86_64-windows-msvc %s -filetype=obj -o %t.obj
> + # RUN: lld-link %t.obj -opt:noref -guard:nolongjmp -out:%t.exe
> -entry:main 2>&1 | FileCheck %s --check-prefix=ERRS
> + # RUN: llvm-readobj -file-headers -coff-load-config %t.exe | FileCheck %s
> +
> + # ERRS: warning: ignoring .gfids$y symbol table index section in object
> {{.*}}gfids-corrupt{{.*}}
> + # ERRS: warning: ignoring invalid symbol table index in section .gfids$y
> in object {{.*}}gfids-corrupt{{.*}}
> +
> + # The table is arbitrary, really.
> + # CHECK: ImageBase: 0x140000000
> + # CHECK: LoadConfig [
> + # CHECK: SEHandlerTable: 0x0
> + # CHECK: SEHandlerCount: 0
> + # CHECK: GuardCFCheckFunction: 0x0
> + # CHECK: GuardCFCheckDispatch: 0x0
> + # CHECK: GuardCFFunctionTable: 0x14000{{.*}}
> + # CHECK: GuardCFFunctionCount: 2
> + # CHECK: GuardFlags: 0x500
> + # CHECK: GuardAddressTakenIatEntryTable: 0x0
> + # CHECK: GuardAddressTakenIatEntryCount: 0
> + # CHECK: GuardLongJumpTargetTable: 0x0
> + # CHECK: GuardLongJumpTargetCount: 0
> + # CHECK: ]
> + # CHECK: GuardFidTable [
> + # CHECK-NEXT: 0x14000{{.*}}
> + # CHECK-NEXT: 0x14000{{.*}}
> + # CHECK-NEXT: ]
> +
> +
> + # Indicate that gfids are present.
> + .def @feat.00; .scl 3; .type 0; .endef
> + .globl @feat.00
> + @feat.00 = 0x800
> +
> + .def f1; .scl 2; .type 32; .endef
> + .section .text,"xr",one_only,f1
> + .global f1
> + f1:
> + movl $42, %eax
> + retq
> +
> + .def f2; .scl 2; .type 32; .endef
> + .section .text,"xr",one_only,f2
> + .global f2
> + f2:
> + movl $13, %eax
> + retq
> +
> + .section .data,"dw",one_only,fp1
> + .globl fp1
> + fp1:
> + .quad f1
> +
> + .section .data,"dw",one_only,fp2
> + .globl fp2
> + fp2:
> + .quad f2
> +
> + .section .gfids$y,"dr",associative,fp1
> + .symidx f1
> + .byte 0
> +
> + .section .gfids$y,"dr",associative,fp2
> + .symidx f2
> + .long 0x400
> +
> + .def main; .scl 2; .type 32; .endef
> + .section .text,"xr",one_only,main
> + .globl main
> + main:
> + callq *fp1(%rip)
> + callq *fp2(%rip)
> + xor %eax, %eax
> + retq
> +
> + .section .rdata,"dr"
> + .globl _load_config_used
> + _load_config_used:
> + .long 256
> + .fill 124, 1, 0
> + .quad __guard_fids_table
> + .quad __guard_fids_count
> + .long __guard_flags
> + .fill 128, 1, 0
> +Index: test/COFF/gfids-fallback.s
> +===================================================================
> +--- test/COFF/gfids-fallback.s (revision 333896)
> ++++ test/COFF/gfids-fallback.s (working copy)
> +@@ -1,96 +1,97 @@
> ++# REQUIRES: x86
> + # RUN: grep -B99999 [S]PLITMARKER %s | llvm-mc -triple
> x86_64-windows-msvc -filetype=obj -o %t1.obj
> + # RUN: grep -A99999 [S]PLITMARKER %s | llvm-mc -triple
> x86_64-windows-msvc -filetype=obj -o %t2.obj
> + # RUN: lld-link %t1.obj %t2.obj -guard:nolongjmp -out:%t.exe -entry:main
> -opt:noref
> + # RUN: llvm-readobj -file-headers -coff-load-config %t.exe | FileCheck %s
> +
> + # CHECK: ImageBase: 0x140000000
> + # CHECK: LoadConfig [
> + # CHECK: SEHandlerTable: 0x0
> + # CHECK: SEHandlerCount: 0
> + # CHECK: GuardCFCheckFunction: 0x0
> + # CHECK: GuardCFCheckDispatch: 0x0
> + # CHECK: GuardCFFunctionTable: 0x14000{{.*}}
> + # CHECK: GuardCFFunctionCount: 3
> + # CHECK: GuardFlags: 0x500
> + # CHECK: GuardAddressTakenIatEntryTable: 0x0
> + # CHECK: GuardAddressTakenIatEntryCount: 0
> + # CHECK: GuardLongJumpTargetTable: 0x0
> + # CHECK: GuardLongJumpTargetCount: 0
> + # CHECK: ]
> + # CHECK: GuardFidTable [
> + # CHECK-NEXT: 0x14000{{.*}}
> + # CHECK-NEXT: 0x14000{{.*}}
> + # CHECK-NEXT: 0x14000{{.*}}
> + # CHECK-NEXT: ]
> +
> +
> + # Indicate that no gfids are present. All symbols used by relocations in
> this
> + # file will be considered address-taken.
> + .def @feat.00; .scl 3; .type 0; .endef
> + .globl @feat.00
> + @feat.00 = 0
> +
> + .def main; .scl 2; .type 32; .endef
> + .section .text,"xr",one_only,main
> + .globl main
> + main:
> + subq $8, %rsp
> + leaq foo(%rip), %rdx
> + callq bar
> + movl $0, %eax
> + addq $8, %rsp
> + retq
> +
> + # Should not appear in gfids table.
> + .def baz; .scl 2; .type 32; .endef
> + .section .text,"xr",one_only,baz
> + .globl baz
> + baz:
> + mov $1, %eax
> + retq
> +
> + .def qux; .scl 2; .type 32; .endef
> + .section .text,"xr",one_only,qux
> + .globl qux
> + qux:
> + mov $2, %eax
> + retq
> +
> + .def quxx; .scl 2; .type 32; .endef
> + .section .text,"xr",one_only,quxx
> + .globl quxx
> + quxx:
> + mov $3, %eax
> + retq
> +
> + # Load config.
> + .section .rdata,"dr"
> + .globl _load_config_used
> + _load_config_used:
> + .long 256
> + .fill 124, 1, 0
> + .quad __guard_fids_table
> + .quad __guard_fids_count
> + .long __guard_flags
> + .fill 128, 1, 0
> +
> + # SPLITMARKER
> +
> + # Indicate that gfids are present. This file does not take any addresses.
> + .def @feat.00; .scl 3; .type 0; .endef
> + .globl @feat.00
> + @feat.00 = 0x800
> +
> + .def foo; .scl 2; .type 32; .endef
> + .section .text,"xr",one_only,foo
> + .global foo
> + foo:
> + movl $42, %eax
> + retq
> +
> + .def bar; .scl 2; .type 32; .endef
> + .section .text,"xr",one_only,bar
> + .global bar
> + bar:
> + movl $13, %eax
> + retq
> +Index: test/COFF/gfids-gc.s
> +===================================================================
> +--- test/COFF/gfids-gc.s (revision 333896)
> ++++ test/COFF/gfids-gc.s (working copy)
> +@@ -1,130 +1,131 @@
> ++# REQUIRES: x86
> + # RUN: llvm-mc -triple x86_64-windows-msvc %s -filetype=obj -o %t.obj
> + # RUN: lld-link %t.obj -guard:nolongjmp -out:%t.exe -opt:noref
> -entry:main
> + # RUN: llvm-readobj -file-headers -coff-load-config %t.exe | FileCheck
> %s --check-prefix=CHECK-NOGC
> + # RUN: lld-link %t.obj -guard:nolongjmp -out:%t.exe -opt:noref
> -entry:main -debug:dwarf
> + # RUN: llvm-readobj -file-headers -coff-load-config %t.exe | FileCheck
> %s --check-prefix=CHECK-NOGC
> + # RUN: lld-link %t.obj -guard:nolongjmp -out:%t.exe -opt:ref -entry:main
> + # RUN: llvm-readobj -file-headers -coff-load-config %t.exe | FileCheck
> %s --check-prefix=CHECK-GC
> +
> + # This assembly is meant to mimic what CL emits for this kind of C code
> when
> + # /Gw (-fdata-sections) is enabled:
> + # int f() { return 42; }
> + # int g() { return 13; }
> + # int (*fp1)() = &f;
> + # int (*fp2)() = &g;
> + # int main() {
> + # return fp1();
> + # }
> + # Compile with 'cl -c -guard:cf -Gw -O1' and note the two associative
> .gfids$y
> + # sections.
> +
> + # Expect 3 entries: main, f, and g.
> +
> + # CHECK-NOGC: ImageBase: 0x140000000
> + # CHECK-NOGC: LoadConfig [
> + # CHECK-NOGC: SEHandlerTable: 0x0
> + # CHECK-NOGC: SEHandlerCount: 0
> + # CHECK-NOGC: GuardCFCheckFunction: 0x0
> + # CHECK-NOGC: GuardCFCheckDispatch: 0x0
> + # CHECK-NOGC: GuardCFFunctionTable: 0x14000{{.*}}
> + # CHECK-NOGC: GuardCFFunctionCount: 3
> + # CHECK-NOGC: GuardFlags: 0x500
> + # CHECK-NOGC: GuardAddressTakenIatEntryTable: 0x0
> + # CHECK-NOGC: GuardAddressTakenIatEntryCount: 0
> + # CHECK-NOGC: GuardLongJumpTargetTable: 0x0
> + # CHECK-NOGC: GuardLongJumpTargetCount: 0
> + # CHECK-NOGC: ]
> + # CHECK-NOGC: GuardFidTable [
> + # CHECK-NOGC-NEXT: 0x14000{{.*}}
> + # CHECK-NOGC-NEXT: 0x14000{{.*}}
> + # CHECK-NOGC-NEXT: 0x14000{{.*}}
> + # CHECK-NOGC-NEXT: ]
> +
> + # Expect 2 entries: main and f. fp2 was discarded, so g was only used as
> a
> + # direct call target.
> +
> + # CHECK-GC: ImageBase: 0x140000000
> + # CHECK-GC: LoadConfig [
> + # CHECK-GC: SEHandlerTable: 0x0
> + # CHECK-GC: SEHandlerCount: 0
> + # CHECK-GC: GuardCFCheckFunction: 0x0
> + # CHECK-GC: GuardCFCheckDispatch: 0x0
> + # CHECK-GC: GuardCFFunctionTable: 0x14000{{.*}}
> + # CHECK-GC: GuardCFFunctionCount: 2
> + # CHECK-GC: GuardFlags: 0x500
> + # CHECK-GC: GuardAddressTakenIatEntryTable: 0x0
> + # CHECK-GC: GuardAddressTakenIatEntryCount: 0
> + # CHECK-GC: GuardLongJumpTargetTable: 0x0
> + # CHECK-GC: GuardLongJumpTargetCount: 0
> + # CHECK-GC: ]
> + # CHECK-GC: GuardFidTable [
> + # CHECK-GC-NEXT: 0x14000{{.*}}
> + # CHECK-GC-NEXT: 0x14000{{.*}}
> + # CHECK-GC-NEXT: ]
> +
> +
> + # We need @feat.00 to have 0x800 to indicate .gfids are present.
> + .def @feat.00;
> + .scl 3;
> + .type 0;
> + .endef
> + .globl @feat.00
> + @feat.00 = 0x801
> +
> + .def main;
> + .scl 2;
> + .type 32;
> + .endef
> + .section .text,"xr",one_only,main
> + .globl main
> + main:
> + # Call g directly so that it is not dead stripped.
> + callq g
> + rex64 jmpq *fp1(%rip)
> +
> + .def f;
> + .scl 3;
> + .type 32;
> + .endef
> + .section .text,"xr",one_only,f
> + f:
> + movl $42, %eax
> + retq
> +
> + .section .data,"dw",one_only,fp1
> + .globl fp1
> + fp1:
> + .quad f
> +
> + .section .gfids$y,"dr",associative,fp1
> + .symidx f
> +
> + # Section GC will remove the following, so 'g' should not be present in
> the
> + # guard fid table.
> +
> + .def g;
> + .scl 3;
> + .type 32;
> + .endef
> + .section .text,"xr",one_only,g
> + g:
> + movl $13, %eax
> + retq
> +
> + .section .data,"dw",one_only,fp2
> + .globl fp2
> + fp2:
> + .quad g
> +
> + .section .gfids$y,"dr",associative,fp2
> + .symidx g
> +
> + .section .rdata,"dr"
> + .globl _load_config_used
> + _load_config_used:
> + .long 256
> + .fill 124, 1, 0
> + .quad __guard_fids_table
> + .quad __guard_fids_count
> + .long __guard_flags
> + .fill 128, 1, 0
> +Index: test/COFF/gfids-icf.s
> +===================================================================
> +--- test/COFF/gfids-icf.s (revision 333896)
> ++++ test/COFF/gfids-icf.s (working copy)
> +@@ -1,87 +1,88 @@
> ++# REQUIRES: x86
> + # RUN: llvm-mc -triple x86_64-windows-msvc %s -filetype=obj -o %t.obj
> + # RUN: lld-link %t.obj -guard:nolongjmp -out:%t.exe -opt:icf -entry:main
> + # RUN: llvm-readobj -file-headers -coff-load-config %t.exe | FileCheck
> %s --check-prefix=CHECK
> +
> + # This assembly is meant to mimic what CL emits for this kind of C code:
> + # int icf1() { return 42; }
> + # int icf2() { return 42; }
> + # int (*fp1)() = &icf1;
> + # int (*fp2)() = &icf2;
> + # int main() {
> + # return fp1();
> + # return fp2();
> + # }
> +
> + # 'icf1' and 'icf2' are address taken, but should be merged into one
> entry.
> + # There are two entries in the table because 'main' is included.
> +
> + # CHECK: ImageBase: 0x140000000
> + # CHECK: LoadConfig [
> + # CHECK: SEHandlerTable: 0x0
> + # CHECK: SEHandlerCount: 0
> + # CHECK: GuardCFCheckFunction: 0x0
> + # CHECK: GuardCFCheckDispatch: 0x0
> + # CHECK: GuardCFFunctionTable: 0x14000{{.*}}
> + # CHECK: GuardCFFunctionCount: 2
> + # CHECK: GuardFlags: 0x500
> + # CHECK: GuardAddressTakenIatEntryTable: 0x0
> + # CHECK: GuardAddressTakenIatEntryCount: 0
> + # CHECK: GuardLongJumpTargetTable: 0x0
> + # CHECK: GuardLongJumpTargetCount: 0
> + # CHECK: ]
> + # CHECK: GuardFidTable [
> + # CHECK-NEXT: 0x14000{{.*}}
> + # CHECK-NEXT: 0x14000{{.*}}
> + # CHECK-NEXT: ]
> +
> +
> + # Indicate that gfids are present.
> + .def @feat.00; .scl 3; .type 0; .endef
> + .globl @feat.00
> + @feat.00 = 0x800
> +
> + .def icf1; .scl 2; .type 32; .endef
> + .section .text,"xr",one_only,icf1
> + .global icf1
> + icf1:
> + movl $42, %eax
> + retq
> +
> + .def icf2; .scl 2; .type 32; .endef
> + .section .text,"xr",one_only,icf2
> + .global icf2
> + icf2:
> + movl $42, %eax
> + retq
> +
> + # Take their two addresses.
> + .data
> + .globl fp1
> + fp1:
> + .quad icf1
> + .globl fp2
> + fp2:
> + .quad icf2
> +
> + .section .gfids$y,"dr"
> + .symidx icf1
> + .symidx icf2
> +
> + .def main; .scl 2; .type 32; .endef
> + .section .text,"xr",one_only,main
> + .globl main
> + main:
> + callq *fp1(%rip)
> + callq *fp2(%rip)
> + xor %eax, %eax
> + retq
> +
> + .section .rdata,"dr"
> + .globl _load_config_used
> + _load_config_used:
> + .long 256
> + .fill 124, 1, 0
> + .quad __guard_fids_table
> + .quad __guard_fids_count
> + .long __guard_flags
> + .fill 128, 1, 0
> +Index: test/COFF/guard-longjmp.s
> +===================================================================
> +--- test/COFF/guard-longjmp.s (revision 333896)
> ++++ test/COFF/guard-longjmp.s (working copy)
> +@@ -1,103 +1,104 @@
> ++# REQUIRES: x86
> + # RUN: llvm-mc -triple x86_64-windows-msvc %s -filetype=obj -o %t.obj
> + # RUN: lld-link %t.obj -guard:cf -out:%t.exe -entry:main
> + # RUN: llvm-readobj -file-headers -coff-load-config %t.exe | FileCheck %s
> +
> + # CHECK: ImageBase: 0x140000000
> + # CHECK: LoadConfig [
> + # CHECK: SEHandlerTable: 0x0
> + # CHECK: SEHandlerCount: 0
> + # CHECK: GuardCFCheckFunction: 0x0
> + # CHECK: GuardCFCheckDispatch: 0x0
> + # CHECK: GuardCFFunctionTable: 0x14000{{.*}}
> + # CHECK: GuardCFFunctionCount: 1
> + # CHECK: GuardFlags: 0x10500
> + # CHECK: GuardAddressTakenIatEntryTable: 0x0
> + # CHECK: GuardAddressTakenIatEntryCount: 0
> + # CHECK: GuardLongJumpTargetTable: 0x14000{{.*}}
> + # CHECK: GuardLongJumpTargetCount: 1
> + # CHECK: ]
> + # CHECK: GuardLJmpTable [
> + # CHECK-NEXT: 0x14000{{.*}}
> + # CHECK-NEXT: ]
> +
> +
> + # This assembly is reduced from C code like:
> + # #include <setjmp.h>
> + # jmp_buf buf;
> + # void g() { longjmp(buf, 1); }
> + # void f() {
> + # if (setjmp(buf))
> + # return;
> + # g();
> + # }
> + # int main() { f(); }
> +
> + # We need @feat.00 to have 0x800 to indicate /guard:cf.
> + .def @feat.00;
> + .scl 3;
> + .type 0;
> + .endef
> + .globl @feat.00
> + @feat.00 = 0x801
> + .def f; .scl 2; .type 32; .endef
> + .globl f
> + f:
> + pushq %rbp
> + subq $32, %rsp
> + leaq 32(%rsp), %rbp
> + leaq buf(%rip), %rcx
> + leaq -32(%rbp), %rdx
> + callq _setjmp
> + .Lljmp1:
> + testl %eax, %eax
> + je .LBB1_1
> + addq $32, %rsp
> + popq %rbp
> + retq
> + .LBB1_1: # %if.end
> + leaq buf(%rip), %rcx
> + movl $1, %edx
> + callq longjmp
> + ud2
> +
> + # Record the longjmp target.
> + .section .gljmp$y,"dr"
> + .symidx .Lljmp1
> + .text
> +
> + # Provide setjmp/longjmp stubs.
> + .def _setjmp; .scl 2; .type 32; .endef
> + .globl _setjmp
> + _setjmp:
> + retq
> +
> + .def longjmp; .scl 2; .type 32; .endef
> + .globl longjmp
> + longjmp:
> + retq
> +
> + .def main; .scl 2; .type 32; .endef
> + .globl main # -- Begin function main
> + main: # @main
> + subq $40, %rsp
> + callq f
> + xorl %eax, %eax
> + addq $40, %rsp
> + retq
> +
> + .comm buf,256,4 # @buf
> +
> + .section .rdata,"dr"
> + .globl _load_config_used
> + _load_config_used:
> + .long 256
> + .fill 124, 1, 0
> + .quad __guard_fids_table
> + .quad __guard_fids_count
> + .long __guard_flags
> + .fill 12, 1, 0
> + .quad __guard_iat_table
> + .quad __guard_iat_count
> + .quad __guard_longjmp_table
> + .quad __guard_fids_count
> + .fill 84, 1, 0
> +Index: test/COFF/guardcf-lto.ll
> +===================================================================
> +--- test/COFF/guardcf-lto.ll (revision 333896)
> ++++ test/COFF/guardcf-lto.ll (working copy)
> +@@ -1,39 +1,40 @@
> ++; REQUIRES: x86
> + ; Set up an import library for a DLL that will do the indirect call.
> + ; RUN: echo -e 'LIBRARY library\nEXPORTS\n do_indirect_call\n' > %t.def
> + ; RUN: lld-link -lib -def:%t.def -out:%t.lib -machine:x64
> +
> + ; Generate an object that will have the load configuration normally
> provided by
> + ; the CRT.
> + ; RUN: llvm-mc -triple x86_64-windows-msvc -filetype=obj
> %S/Inputs/loadconfig-cfg-x64.s -o %t.ldcfg.obj
> +
> + ; RUN: llvm-as %s -o %t.bc
> + ; RUN: lld-link -entry:main -guard:cf -dll %t.bc %t.lib %t.ldcfg.obj
> -out:%t.dll
> + ; RUN: llvm-readobj -coff-load-config %t.dll | FileCheck %s
> +
> + ; There must be *two* entries in the table: DLL entry point, and
> my_handler.
> +
> + ; CHECK: LoadConfig [
> + ; CHECK: GuardCFFunctionTable: 0x{{[^0].*}}
> + ; CHECK-NEXT: GuardCFFunctionCount: 2
> + ; CHECK-NEXT: GuardFlags: 0x10500
> + ; CHECK: ]
> + ; CHECK: GuardFidTable [
> + ; CHECK-NEXT: 0x180{{.*}}
> + ; CHECK-NEXT: 0x180{{.*}}
> + ; CHECK-NEXT: ]
> +
> + target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
> + target triple = "x86_64-pc-windows-msvc19.12.25835"
> +
> + declare dllimport void @do_indirect_call(void ()*)
> +
> + define dso_local i32 @main() local_unnamed_addr {
> + entry:
> + tail call void @do_indirect_call(void ()* nonnull @my_handler)
> + ret i32 0
> + }
> +
> + define dso_local void @my_handler() {
> + entry:
> + ret void
> + }
> +Index: test/COFF/icf-executable.s
> +===================================================================
> +--- test/COFF/icf-executable.s (revision 333896)
> ++++ test/COFF/icf-executable.s (working copy)
> +@@ -1,18 +1,19 @@
> ++# REQUIRES: x86
> + # RUN: llvm-mc -triple=x86_64-windows-msvc %s -filetype=obj -o %t.obj
> + # RUN: lld-link -entry:main %t.obj -out:%t.exe -verbose 2>&1 | FileCheck
> %s
> +
> + # CHECK: Selected internal
> + # CHECK: Removed f2
> +
> + .section .text,"xr",one_only,internal
> + internal:
> + .globl main
> + main:
> + call f2
> + ret
> +
> + .section .text,"xr",one_only,f2
> + .globl f2
> + f2:
> + call main
> + ret
> +Index: test/COFF/icf-pdata.s
> +===================================================================
> +--- test/COFF/icf-pdata.s (revision 333896)
> ++++ test/COFF/icf-pdata.s (working copy)
> +@@ -1,97 +1,98 @@
> ++# REQUIRES: x86
> + # RUN: llvm-mc %s -triple x86_64-windows-msvc -filetype=obj -o %t.obj
> + # RUN: lld-link %t.obj -dll -noentry -out:%t.dll -merge:.xdata=.xdata
> + # RUN: llvm-readobj -sections -coff-exports %t.dll | FileCheck %s
> +
> + # CHECK: Name: .pdata
> + # CHECK-NEXT: VirtualSize: 0x18
> + # CHECK: Name: .xdata
> + # CHECK-NEXT: VirtualSize: 0x10
> +
> + # CHECK: Name: xdata1
> + # CHECK-NEXT: RVA: 0x1010
> + # CHECK: Name: xdata1a
> + # CHECK-NEXT: RVA: 0x1010
> + # CHECK: Name: xdata1b
> + # CHECK-NEXT: RVA: 0x1030
> +
> + .text
> + callee:
> + ret
> +
> + .def xdata1;
> + .scl 2;
> + .type 32;
> + .endef
> + .section .text,"xr",one_only,xdata1
> + .globl xdata1 # -- Begin function xdata1
> + .p2align 4, 0x90
> + xdata1: # @xdata1
> + .seh_proc xdata1
> + # BB#0: # %entry
> + subq $40, %rsp
> + .seh_stackalloc 40
> + .seh_endprologue
> + callq callee
> + nop
> + addq $40, %rsp
> + jmp callee # TAILCALL
> + .seh_handlerdata
> + .section .text,"xr",one_only,xdata1
> + .seh_endproc
> + # -- End function
> +
> + # xdata1a is identical to xdata1, so it should be ICFd, and so should
> its pdata.
> + # It also has associative debug and CFG sections which should be ignored
> by ICF.
> + .def xdata1a;
> + .scl 2;
> + .type 32;
> + .endef
> + .section .text,"xr",one_only,xdata1a
> + .globl xdata1a # -- Begin function xdata1a
> + .p2align 4, 0x90
> + xdata1a: # @xdata1a
> + .seh_proc xdata1a
> + # BB#0: # %entry
> + subq $40, %rsp
> + .seh_stackalloc 40
> + .seh_endprologue
> + callq callee
> + nop
> + addq $40, %rsp
> + jmp callee # TAILCALL
> + .seh_handlerdata
> + .section .text,"xr",one_only,xdata1a
> + .seh_endproc
> +
> + .section .debug$S,"r",associative,xdata1a
> + .section .gfids$y,"r",associative,xdata1a
> + .section .gljmp$y,"r",associative,xdata1a
> +
> + # xdata1b's text is identical to xdata1, but its xdata specifies a
> different
> + # stack size, so it cannot be ICFd with xdata1.
> + .def xdata1b;
> + .scl 2;
> + .type 32;
> + .endef
> + .section .text,"xr",one_only,xdata1b
> + .globl xdata1b # -- Begin function xdata1b
> + .p2align 4, 0x90
> + xdata1b: # @xdata1b
> + .seh_proc xdata1b
> + # BB#0: # %entry
> + subq $40, %rsp
> + .seh_stackalloc 48
> + .seh_endprologue
> + callq callee
> + nop
> + addq $40, %rsp
> + jmp callee # TAILCALL
> + .seh_handlerdata
> + .section .text,"xr",one_only,xdata1b
> + .seh_endproc
> + # -- End function
> +
> + .section .drectve,"yn"
> + .ascii " -export:xdata1"
> + .ascii " -export:xdata1a"
> + .ascii " -export:xdata1b"
> +Index: test/COFF/icf-xdata.s
> +===================================================================
> +--- test/COFF/icf-xdata.s (revision 333896)
> ++++ test/COFF/icf-xdata.s (working copy)
> +@@ -1,98 +1,99 @@
> ++# REQUIRES: x86
> + # RUN: llvm-mc %s -triple x86_64-windows-msvc -filetype=obj -o %t.obj
> + # RUN: lld-link %t.obj -dll -noentry -out:%t.dll -merge:.xdata=.xdata
> 2>&1 \
> + # RUN: | FileCheck %s --check-prefix=WARN
> + # RUN: llvm-readobj -sections %t.dll | FileCheck %s --check-prefix=XDATA
> + # RUN: lld-link %t.obj -dll -noentry -out:%t.dll
> + # RUN: llvm-readobj -sections %t.dll | FileCheck %s --check-prefix=RDATA
> +
> + # There shouldn't be much xdata, because all three .pdata entries (12
> bytes
> + # each) should use the same .xdata unwind info.
> + # XDATA: Name: .rdata
> + # XDATA-NEXT: VirtualSize: 0x73
> + # XDATA: Name: .pdata
> + # XDATA-NEXT: VirtualSize: 0x24
> + # XDATA: Name: .xdata
> + # XDATA-NEXT: VirtualSize: 0x8
> + #
> + # WARN: warning: .xdata=.rdata: already merged into .xdata
> + #
> + # RDATA: Name: .rdata
> + # RDATA-NEXT: VirtualSize: 0x7C
> + # RDATA: Name: .pdata
> + # RDATA-NEXT: VirtualSize: 0x24
> +
> + .text
> + callee:
> + ret
> +
> + .def xdata1;
> + .scl 2;
> + .type 32;
> + .endef
> + .section .text,"xr",one_only,xdata1
> + .globl xdata1 # -- Begin function xdata1
> + .p2align 4, 0x90
> + xdata1: # @xdata1
> + .seh_proc xdata1
> + # BB#0: # %entry
> + subq $40, %rsp
> + .seh_stackalloc 40
> + .seh_endprologue
> + callq callee
> + nop
> + addq $40, %rsp
> + jmp callee # TAILCALL
> + .seh_handlerdata
> + .section .text,"xr",one_only,xdata1
> + .seh_endproc
> + # -- End function
> + .def xdata2;
> + .scl 2;
> + .type 32;
> + .endef
> + .section .text,"xr",one_only,xdata2
> + .globl xdata2 # -- Begin function xdata2
> + .p2align 4, 0x90
> + xdata2: # @xdata2
> + .seh_proc xdata2
> + # BB#0: # %entry
> + subq $40, %rsp
> + .seh_stackalloc 40
> + .seh_endprologue
> + callq callee
> + callq callee
> + nop
> + addq $40, %rsp
> + jmp callee # TAILCALL
> + .seh_handlerdata
> + .section .text,"xr",one_only,xdata2
> + .seh_endproc
> + # -- End function
> + .def xdata3;
> + .scl 2;
> + .type 32;
> + .endef
> + .section .text,"xr",one_only,xdata3
> + .globl xdata3 # -- Begin function xdata3
> + .p2align 4, 0x90
> + xdata3: # @xdata3
> + .seh_proc xdata3
> + # BB#0: # %entry
> + subq $40, %rsp
> + .seh_stackalloc 40
> + .seh_endprologue
> + callq callee
> + callq callee
> + callq callee
> + nop
> + addq $40, %rsp
> + jmp callee # TAILCALL
> + .seh_handlerdata
> + .section .text,"xr",one_only,xdata3
> + .seh_endproc
> + # -- End function
> + .section .drectve,"yn"
> + .ascii " -export:xdata1"
> + .ascii " -export:xdata2"
> + .ascii " -export:xdata3"
> +
> +Index: test/COFF/implib-name.test
> +===================================================================
> +--- test/COFF/implib-name.test (revision 333896)
> ++++ test/COFF/implib-name.test (working copy)
> +@@ -1,71 +1,72 @@
> ++# REQUIRES: x86
> + # RUN: mkdir -p %T
> + # RUN: llvm-mc -triple x86_64-unknown-windows-msvc -filetype obj -o
> %T/object.obj %S/Inputs/object.s
> +
> + # RUN: lld-link /dll /machine:x64 /def:%S/Inputs/named.def
> /out:%T/library.dll %T/object.obj /entry:f /subsystem:CONSOLE
> + # RUN: llvm-ar t %T/library.lib | FileCheck %s -check-prefix
> CHECK-DEFAULT-DLL-EXT
> +
> + # RUN: lld-link /machine:x64 /def:%S/Inputs/named.def /out:%T/library.lib
> + # RUN: llvm-ar t %T/library.lib | FileCheck %s -check-prefix
> CHECK-DEFAULT-DLL-EXT
> +
> + CHECK-DEFAULT-DLL-EXT: library.dll
> + CHECK-DEFAULT-DLL-EXT: library.dll
> + CHECK-DEFAULT-DLL-EXT: library.dll
> + CHECK-DEFAULT-DLL-EXT: library.dll
> +
> + # RUN: lld-link /machine:x64 /def:%S/Inputs/named.def
> /out:%T/library.exe %T/object.obj /entry:f /subsystem:CONSOLE
> + # RUN: llvm-ar t %T/library.lib | FileCheck %s -check-prefix
> CHECK-DEFAULT-EXE-EXT
> +
> + CHECK-DEFAULT-EXE-EXT: library.exe
> + CHECK-DEFAULT-EXE-EXT: library.exe
> + CHECK-DEFAULT-EXE-EXT: library.exe
> + CHECK-DEFAULT-EXE-EXT: library.exe
> +
> + # RUN: lld-link /dll /machine:x64 /def:%S/Inputs/extension.def
> /out:%T/extension.dll /entry:f /subsystem:CONSOLE
> + # RUN: llvm-ar t %T/extension.lib | FileCheck %s -check-prefix
> CHECK-EXTENSION
> +
> + # RUN: lld-link /machine:x64 /def:%S/Inputs/extension.def
> /out:%T/extension.exe /entry:f /subsystem:CONSOLE
> + # RUN: llvm-ar t %T/extension.lib | FileCheck %s -check-prefix
> CHECK-EXTENSION
> +
> + # RUN: lld-link /machine:x64 /def:%S/Inputs/extension.def
> /out:%T/extension.lib
> + # RUN: llvm-ar t %T/extension.lib | FileCheck %s -check-prefix
> CHECK-EXTENSION
> +
> + CHECK-EXTENSION: library.ext
> + CHECK-EXTENSION: library.ext
> + CHECK-EXTENSION: library.ext
> + CHECK-EXTENSION: library.ext
> +
> + # RUN: lld-link /dll /machine:x64 /def:%S/Inputs/default.def
> /out:%T/default.dll /entry:f /subsystem:CONSOLE
> + # RUN: llvm-ar t %T/default.lib | FileCheck %s -check-prefix
> CHECK-OUTPUT-NAME-DLL
> +
> + # RUN: lld-link /machine:x64 /def:%S/Inputs/default.def
> /out:%T/default.lib
> + # RUN: llvm-ar t %T/default.lib | FileCheck %s -check-prefix
> CHECK-OUTPUT-NAME-DLL
> +
> + CHECK-OUTPUT-NAME-DLL: default.dll
> + CHECK-OUTPUT-NAME-DLL: default.dll
> + CHECK-OUTPUT-NAME-DLL: default.dll
> + CHECK-OUTPUT-NAME-DLL: default.dll
> +
> + # RUN: lld-link /machine:x64 /def:%S/Inputs/default.def
> /out:%T/default.exe %T/object.obj /entry:f /subsystem:CONSOLE
> + # RUN: llvm-ar t %T/default.lib | FileCheck %s -check-prefix
> CHECK-OUTPUT-NAME-EXE
> +
> + CHECK-OUTPUT-NAME-EXE: default.exe
> + CHECK-OUTPUT-NAME-EXE: default.exe
> + CHECK-OUTPUT-NAME-EXE: default.exe
> + CHECK-OUTPUT-NAME-EXE: default.exe
> +
> + # RUN: lld-link /machine:x64 /out:%T/default.exe %T/object.obj /entry:f
> /subsystem:CONSOLE
> + # RUN: llvm-ar t %T/default.lib | FileCheck %s -check-prefix
> CHECK-NODEF-EXE
> +
> + CHECK-NODEF-EXE: default.exe
> + CHECK-NODEF-EXE: default.exe
> + CHECK-NODEF-EXE: default.exe
> + CHECK-NODEF-EXE: default.exe
> +
> + # RUN: lld-link /machine:x64 /dll /out:%T/default.dll %T/object.obj
> /entry:f /subsystem:CONSOLE
> + # RUN: llvm-ar t %T/default.lib | FileCheck %s -check-prefix
> CHECK-NODEF-DLL
> +
> + CHECK-NODEF-DLL: default.dll
> + CHECK-NODEF-DLL: default.dll
> + CHECK-NODEF-DLL: default.dll
> + CHECK-NODEF-DLL: default.dll
> +
> +Index: test/COFF/loadcfg.ll
> +===================================================================
> +--- test/COFF/loadcfg.ll (revision 333896)
> ++++ test/COFF/loadcfg.ll (working copy)
> +@@ -1,15 +1,16 @@
> ++; REQUIRES: x86
> + ; RUN: llvm-as -o %t.obj %s
> + ; RUN: lld-link /out:%t.exe %t.obj /entry:main /subsystem:console
> + ; RUN: llvm-readobj -file-headers %t.exe | FileCheck %s
> +
> + ; CHECK: LoadConfigTableRVA: 0x2000
> + ; CHECK: LoadConfigTableSize: 0x70
> +
> + target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
> + target triple = "x86_64-pc-windows-msvc"
> +
> + @_load_config_used = constant [28 x i32] [i32 112, i32 0, i32 0, i32 0,
> i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32
> 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0,
> i32 0, i32 0, i32 0]
> +
> + define void @main() {
> + ret void
> + }
> +Index: test/COFF/lto-chkstk.ll
> +===================================================================
> +--- test/COFF/lto-chkstk.ll (revision 333896)
> ++++ test/COFF/lto-chkstk.ll (working copy)
> +@@ -1,17 +1,18 @@
> ++; REQUIRES: x86
> + ; RUN: llvm-as -o %t.obj %s
> + ; RUN: llvm-mc -triple=x86_64-pc-windows-msvc -filetype=obj -o
> %T/lto-chkstk-foo.obj %S/Inputs/lto-chkstk-foo.s
> + ; RUN: llvm-mc -triple=x86_64-pc-windows-msvc -filetype=obj -o
> %T/lto-chkstk-chkstk.obj %S/Inputs/lto-chkstk-chkstk.s
> + ; RUN: llvm-ar cru %t.lib %T/lto-chkstk-chkstk.obj
> + ; RUN: lld-link /out:%t.exe /entry:main /subsystem:console %t.obj
> %T/lto-chkstk-foo.obj %t.lib
> +
> + target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
> + target triple = "x86_64-pc-windows-msvc"
> +
> + define void @main() {
> + entry:
> + %array4096 = alloca [4096 x i8]
> + call void @foo([4096 x i8]* %array4096)
> + ret void
> + }
> +
> + declare void @foo([4096 x i8]*)
> +Index: test/COFF/lto-comdat.ll
> +===================================================================
> +--- test/COFF/lto-comdat.ll (revision 333896)
> ++++ test/COFF/lto-comdat.ll (working copy)
> +@@ -1,107 +1,108 @@
> ++; REQUIRES: x86
> + ; RUN: llvm-as -o %T/comdat-main.lto.obj %s
> + ; RUN: llvm-as -o %T/comdat1.lto.obj %S/Inputs/lto-comdat1.ll
> + ; RUN: llvm-as -o %T/comdat2.lto.obj %S/Inputs/lto-comdat2.ll
> + ; RUN: rm -f %T/comdat.lto.lib
> + ; RUN: llvm-ar cru %T/comdat.lto.lib %T/comdat1.lto.obj
> %T/comdat2.lto.obj
> +
> + ; RUN: llc -filetype=obj -o %T/comdat-main.obj %s
> + ; RUN: llc -filetype=obj -o %T/comdat1.obj %S/Inputs/lto-comdat1.ll
> + ; RUN: llc -filetype=obj -o %T/comdat2.obj %S/Inputs/lto-comdat2.ll
> + ; RUN: rm -f %T/comdat.lib
> + ; RUN: llvm-ar cru %T/comdat.lib %T/comdat1.obj %T/comdat2.obj
> +
> + ; Check that, when we use an LTO main with LTO objects, we optimize away
> all
> + ; of f1, f2, and comdat.
> + ; RUN: lld-link /out:%T/comdat-main.exe /entry:main /subsystem:console
> %T/comdat-main.lto.obj %T/comdat1.lto.obj %T/comdat2.lto.obj
> + ; RUN: llvm-readobj -file-headers %T/comdat-main.exe | FileCheck
> -check-prefix=HEADERS-11 %s
> + ; RUN: llvm-objdump -d %T/comdat-main.exe | FileCheck
> -check-prefix=TEXT-11 %s
> + ; RUN: lld-link /out:%T/comdat-main.exe /entry:main /subsystem:console
> %T/comdat-main.lto.obj %T/comdat.lto.lib
> + ; RUN: llvm-readobj -file-headers %T/comdat-main.exe | FileCheck
> -check-prefix=HEADERS-11 %s
> + ; RUN: llvm-objdump -d %T/comdat-main.exe | FileCheck
> -check-prefix=TEXT-11 %s
> +
> + ; Check that, when we use a non-LTO main with LTO objects, we pick the
> comdat
> + ; implementation in LTO, elide calls to it from inside LTO, and retain
> the
> + ; call to comdat from main.
> + ; RUN: lld-link /out:%T/comdat-main.exe /entry:main /subsystem:console
> %T/comdat-main.obj %T/comdat1.lto.obj %T/comdat2.lto.obj
> + ; RUN: llvm-readobj -file-headers %T/comdat-main.exe | FileCheck
> -check-prefix=HEADERS-01 %s
> + ; RUN: llvm-objdump -d %T/comdat-main.exe | FileCheck
> -check-prefix=TEXT-01 %s
> + ; RUN: lld-link /out:%T/comdat-main.exe /entry:main /subsystem:console
> %T/comdat-main.obj %T/comdat.lto.lib
> + ; RUN: llvm-readobj -file-headers %T/comdat-main.exe | FileCheck
> -check-prefix=HEADERS-01 %s
> + ; RUN: llvm-objdump -d %T/comdat-main.exe | FileCheck
> -check-prefix=TEXT-01 %s
> +
> + ; Check that, when we use an LTO main with non-LTO objects, we pick the
> comdat
> + ; implementation in LTO, elide the call to it from inside LTO, and keep
> the
> + ; calls to comdat from the non-LTO objects.
> + ; RUN: lld-link /out:%T/comdat-main.exe /entry:main /subsystem:console
> %T/comdat-main.lto.obj %T/comdat1.obj %T/comdat2.obj
> + ; RUN: llvm-readobj -file-headers %T/comdat-main.exe | FileCheck
> -check-prefix=HEADERS-10 %s
> + ; RUN: llvm-objdump -d %T/comdat-main.exe | FileCheck
> -check-prefix=TEXT-10 %s
> + ; RUN: lld-link /out:%T/comdat-main.exe /entry:main /subsystem:console
> %T/comdat-main.lto.obj %T/comdat.lib
> + ; RUN: llvm-readobj -file-headers %T/comdat-main.exe | FileCheck
> -check-prefix=HEADERS-10 %s
> + ; RUN: llvm-objdump -d %T/comdat-main.exe | FileCheck
> -check-prefix=TEXT-10 %s
> +
> + ; HEADERS-11: AddressOfEntryPoint: 0x1000
> + ; TEXT-11: Disassembly of section .text:
> + ; TEXT-11-NEXT: .text:
> + ; TEXT-11-NEXT: xorl %eax, %eax
> + ; TEXT-11-NEXT: retq
> +
> + ; HEADERS-01: AddressOfEntryPoint: 0x1000
> + ; TEXT-01: Disassembly of section .text:
> + ; TEXT-01-NEXT: .text:
> + ; TEXT-01-NEXT: subq $40, %rsp
> + ; TEXT-01-NEXT: callq 23
> + ; TEXT-01-NEXT: callq 18
> + ; TEXT-01-NEXT: callq 13
> + ; TEXT-01-NEXT: xorl %eax, %eax
> + ; TEXT-01-NEXT: addq $40, %rsp
> + ; TEXT-01: retq
> + ; TEXT-01-NOT: callq
> + ; TEXT-01: retq
> + ; TEXT-01: int3
> + ; TEXT-01: int3
> + ; TEXT-01: int3
> + ; TEXT-01-NOT: {{.}}
> +
> + ; HEADERS-10: AddressOfEntryPoint: 0x1020
> + ; TEXT-10: Disassembly of section .text:
> + ; TEXT-10-NEXT: .text:
> + ; TEXT-10-NEXT: subq $40, %rsp
> + ; TEXT-10-NEXT: callq 55
> + ; TEXT-10-NEXT: nop
> + ; TEXT-10-NEXT: addq $40, %rsp
> + ; TEXT-10-NEXT: retq
> + ; TEXT-10-NEXT: int3
> + ; TEXT-10-NEXT: subq $40, %rsp
> + ; TEXT-10-NEXT: callq 39
> + ; TEXT-10-NEXT: nop
> + ; TEXT-10-NEXT: addq $40, %rsp
> + ; TEXT-10-NEXT: retq
> + ; TEXT-10-NEXT: int3
> + ; TEXT-10-NEXT: subq $40, %rsp
> + ; TEXT-10-NEXT: callq -41
> + ; TEXT-10-NEXT: callq -30
> + ; TEXT-10-NEXT: xorl %eax, %eax
> + ; TEXT-10-NEXT: addq $40, %rsp
> + ; TEXT-10-NEXT: retq
> + ; TEXT-10-NOT: callq
> + ; TEXT-10: retq
> + ; TEXT-10-NOT: {{.}}
> +
> + target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
> + target triple = "x86_64-pc-windows-msvc"
> +
> + $comdat = comdat any
> +
> + define i32 @main() {
> + call void @f1()
> + call void @f2()
> + call void @comdat()
> + ret i32 0
> + }
> +
> + define linkonce_odr void @comdat() comdat {
> + ret void
> + }
> +
> + declare void @f1()
> + declare void @f2()
> +Index: test/COFF/lto-icf.ll
> +===================================================================
> +--- test/COFF/lto-icf.ll (revision 333896)
> ++++ test/COFF/lto-icf.ll (working copy)
> +@@ -1,26 +1,27 @@
> ++; REQUIRES: x86
> + ; Test that ICF works after LTO, i.e. both functions have the same
> address.
> + ; Previously, when we didn't enable function sections, ICF didn't work.
> +
> + ; RUN: llvm-as %s -o %t.bc
> + ; RUN: lld-link -opt:icf -dll -noentry %t.bc -out:%t.dll
> + ; RUN: llvm-readobj -coff-exports %t.dll | FileCheck %s
> +
> + ; CHECK: Export {
> + ; CHECK: Export {
> + ; CHECK: RVA: 0x[[RVA:.*]]
> + ; CHECK: Export {
> + ; CHECK: RVA: 0x[[RVA]]
> + ; CHECK-NOT: Export
> +
> + target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
> + target triple = "x86_64-pc-windows-msvc19.12.25835"
> +
> + define dllexport i8* @icf_ptr() {
> + entry:
> + ret i8* null
> + }
> +
> + define dllexport i64 @icf_int() {
> + entry:
> + ret i64 0
> + }
> +Index: test/COFF/lto-lazy-reference.ll
> +===================================================================
> +--- test/COFF/lto-lazy-reference.ll (revision 333896)
> ++++ test/COFF/lto-lazy-reference.ll (working copy)
> +@@ -1,21 +1,22 @@
> ++; REQUIRES: x86
> + ; RUN: llc -mtriple=i686-pc-windows-msvc -filetype=obj -o
> %T/lto-lazy-reference-quadruple.obj
> %S/Inputs/lto-lazy-reference-quadruple.ll
> + ; RUN: llvm-as -o %T/lto-lazy-reference-dummy.bc
> %S/Inputs/lto-lazy-reference-dummy.ll
> + ; RUN: rm -f %t.lib
> + ; RUN: llvm-ar cru %t.lib %T/lto-lazy-reference-quadruple.obj
> %T/lto-lazy-reference-dummy.bc
> + ; RUN: llvm-as -o %t.obj %s
> + ; RUN: lld-link /out:%t.exe /entry:main /subsystem:console %t.obj %t.lib
> +
> + target datalayout = "e-m:x-p:32:32-i64:64-f80:32-n8:16:32-a:0:32-S32"
> + target triple = "i686-pc-windows-msvc18.0.0"
> +
> + define double @main(double %x) {
> + entry:
> + ; When compiled, this defines the __real at 40800000 symbol, which
> already has a
> + ; lazy definition in the lib file from
> lto-lazy-reference-quadruple.obj. This
> + ; test makes sure we *don't* try to take the definition from the lazy
> + ; reference, because that can bring in new references to bitcode files
> after
> + ; LTO, such as lto-lazy-reference-dummy.bc in this case.
> + %mul = fmul double %x, 4.0
> +
> + ret double %mul
> + }
> +Index: test/COFF/lto-linker-opts.ll
> +===================================================================
> +--- test/COFF/lto-linker-opts.ll (revision 333896)
> ++++ test/COFF/lto-linker-opts.ll (working copy)
> +@@ -1,8 +1,9 @@
> ++; REQUIRES: x86
> + ; RUN: llvm-as -o %T/lto-linker-opts.obj %s
> + ; RUN: env LIB=%S/Inputs lld-link /out:%T/lto-linker-opts.exe
> /entry:main /subsystem:console %T/lto-linker-opts.obj
> +
> + target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
> + target triple = "x86_64-pc-windows-msvc"
> +
> + !llvm.linker.options = !{!0}
> + !0 = !{!"/DEFAULTLIB:ret42.lib"}
> +Index: test/COFF/lto-new-symbol.ll
> +===================================================================
> +--- test/COFF/lto-new-symbol.ll (revision 333896)
> ++++ test/COFF/lto-new-symbol.ll (working copy)
> +@@ -1,16 +1,17 @@
> ++; REQUIRES: x86
> + ; RUN: llvm-as -o %t.obj %s
> + ; RUN: lld-link /out:%t.exe /entry:foo /subsystem:console %t.obj
> +
> + target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
> + target triple = "x86_64-pc-windows-msvc"
> +
> + define void @foo(<4 x i32>* %p, <4 x float>* %q, i1 %t) nounwind {
> + entry:
> + br label %loop
> + loop:
> + store <4 x i32><i32 1073741824, i32 1073741824, i32 1073741824, i32
> 1073741824>, <4 x i32>* %p
> + store <4 x float><float 2.0, float 2.0, float 2.0, float 2.0>, <4 x
> float>* %q
> + br i1 %t, label %loop, label %ret
> + ret:
> + ret void
> + }
> +Index: test/COFF/lto-opt-level.ll
> +===================================================================
> +--- test/COFF/lto-opt-level.ll (revision 333896)
> ++++ test/COFF/lto-opt-level.ll (working copy)
> +@@ -1,21 +1,22 @@
> ++; REQUIRES: x86
> + ; RUN: llvm-as -o %t.obj %s
> + ; RUN: lld-link /out:%t0.exe /entry:main /subsystem:console
> /opt:lldlto=0 /lldmap:%t0.map %t.obj
> + ; RUN: FileCheck --check-prefix=CHECK-O0 %s < %t0.map
> + ; RUN: lld-link /out:%t2.exe /entry:main /subsystem:console
> /opt:lldlto=2 /lldmap:%t2.map %t.obj
> + ; RUN: FileCheck --check-prefix=CHECK-O2 %s < %t2.map
> + ; RUN: lld-link /out:%t2a.exe /entry:main /subsystem:console
> /lldmap:%t2a.map %t.obj
> + ; RUN: FileCheck --check-prefix=CHECK-O2 %s < %t2a.map
> +
> + target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
> + target triple = "x86_64-pc-windows-msvc"
> +
> + ; CHECK-O0: foo
> + ; CHECK-O2-NOT: foo
> + define internal void @foo() {
> + ret void
> + }
> +
> + define void @main() {
> + call void @foo()
> + ret void
> + }
> +Index: test/COFF/lto-parallel.ll
> +===================================================================
> +--- test/COFF/lto-parallel.ll (revision 333896)
> ++++ test/COFF/lto-parallel.ll (working copy)
> +@@ -1,22 +1,23 @@
> ++; REQUIRES: x86
> + ; RUN: llvm-as -o %t.obj %s
> + ; RUN: lld-link -opt:noicf /out:%t.exe /entry:foo /include:bar
> /opt:lldltopartitions=2 /subsystem:console /lldmap:%t.map %t.obj
> + ; RUN: FileCheck %s < %t.map
> +
> + target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
> + target triple = "x86_64-pc-windows-msvc"
> +
> + ; CHECK: lto.tmp
> + ; CHECK: lto.tmp
> + ; CHECK-NEXT: foo
> + define void @foo() {
> + call void @bar()
> + ret void
> + }
> +
> + ; CHECK: lto.tmp
> + ; CHECK: lto.tmp
> + ; CHECK: bar
> + define void @bar() {
> + call void @foo()
> + ret void
> + }
> +Index: test/COFF/lto-reloc-model.ll
> +===================================================================
> +--- test/COFF/lto-reloc-model.ll (revision 333896)
> ++++ test/COFF/lto-reloc-model.ll (working copy)
> +@@ -1,19 +1,20 @@
> ++; REQUIRES: x86
> + ; RUN: llvm-as -o %t %s
> + ; RUN: lld-link /entry:main /subsystem:console /out:%t.exe %t
> + ; RUN: llvm-objdump -d %t.exe | FileCheck %s
> +
> + target datalayout = "e-m:x-p:32:32-i64:64-f80:32-n8:16:32-a:0:32-S32"
> + target triple = "i686-pc-windows-msvc"
> +
> + @foo = thread_local global i8 0
> +
> + module asm "__tls_index = 1"
> + module asm "__tls_array = 2"
> +
> + define i8* @main() {
> + ; CHECK: movl 1, %eax
> + ; CHECK: movl %fs:2, %ecx
> + ; CHECK: movl (%ecx,%eax,4), %eax
> + ; CHECK: leal (%eax), %eax
> + ret i8* @foo
> + }
> +Index: test/COFF/lto.ll
> +===================================================================
> +--- test/COFF/lto.ll (revision 333896)
> ++++ test/COFF/lto.ll (working copy)
> +@@ -1,144 +1,145 @@
> ++; REQUIRES: x86
> + ; RUN: llvm-as -o %T/main.lto.obj %s
> + ; RUN: llvm-as -o %T/foo.lto.obj %S/Inputs/lto-dep.ll
> + ; RUN: rm -f %T/foo.lto.lib
> + ; RUN: llvm-ar cru %T/foo.lto.lib %T/foo.lto.obj
> +
> + ; RUN: llc -filetype=obj -o %T/main.obj %s
> + ; RUN: llc -filetype=obj -o %T/foo.obj %S/Inputs/lto-dep.ll
> + ; RUN: rm -f %T/foo.lib
> + ; RUN: llvm-ar cru %T/foo.lib %T/foo.obj
> +
> + ; RUN: lld-link /out:%T/main.exe /entry:main /include:f2
> /subsystem:console %T/main.lto.obj %T/foo.lto.obj
> + ; RUN: llvm-readobj -file-headers %T/main.exe | FileCheck
> -check-prefix=HEADERS-11 %s
> + ; RUN: llvm-objdump -d %T/main.exe | FileCheck -check-prefix=TEXT-11 %s
> + ; RUN: lld-link /out:%T/main.exe /entry:main /include:f2
> /subsystem:console %T/main.lto.obj %T/foo.lto.lib /verbose 2>&1 | FileCheck
> -check-prefix=VERBOSE %s
> + ; RUN: llvm-readobj -file-headers %T/main.exe | FileCheck
> -check-prefix=HEADERS-11 %s
> + ; RUN: llvm-objdump -d %T/main.exe | FileCheck -check-prefix=TEXT-11 %s
> +
> + ; RUN: lld-link /out:%T/main.exe /entry:main /subsystem:console
> %T/main.obj %T/foo.lto.obj
> + ; RUN: llvm-readobj -file-headers %T/main.exe | FileCheck
> -check-prefix=HEADERS-01 %s
> + ; RUN: llvm-objdump -d %T/main.exe | FileCheck -check-prefix=TEXT-01 %s
> + ; RUN: lld-link /out:%T/main.exe /entry:main /subsystem:console
> %T/main.obj %T/foo.lto.lib
> + ; RUN: llvm-readobj -file-headers %T/main.exe | FileCheck
> -check-prefix=HEADERS-01 %s
> + ; RUN: llvm-objdump -d %T/main.exe | FileCheck -check-prefix=TEXT-01 %s
> +
> + ; RUN: lld-link /out:%T/main.exe /entry:main /subsystem:console
> %T/main.lto.obj %T/foo.obj
> + ; RUN: llvm-readobj -file-headers %T/main.exe | FileCheck
> -check-prefix=HEADERS-10 %s
> + ; RUN: llvm-objdump -d %T/main.exe | FileCheck -check-prefix=TEXT-10 %s
> + ; RUN: lld-link /out:%T/main.exe /entry:main /subsystem:console
> %T/main.lto.obj %T/foo.lib
> + ; RUN: llvm-readobj -file-headers %T/main.exe | FileCheck
> -check-prefix=HEADERS-10 %s
> + ; RUN: llvm-objdump -d %T/main.exe | FileCheck -check-prefix=TEXT-10 %s
> +
> + ; VERBOSE: foo.lto.lib({{.*}}foo.lto.obj)
> +
> + ; HEADERS-11: AddressOfEntryPoint: 0x1000
> + ; TEXT-11: Disassembly of section .text:
> + ; TEXT-11-NEXT: .text:
> + ; TEXT-11-NEXT: xorl %eax, %eax
> + ; TEXT-11-NEXT: retq
> + ; TEXT-11-NEXT: int3
> + ; TEXT-11-NEXT: int3
> + ; TEXT-11-NEXT: int3
> + ; TEXT-11-NEXT: int3
> + ; TEXT-11-NEXT: int3
> + ; TEXT-11-NEXT: int3
> + ; TEXT-11-NEXT: int3
> + ; TEXT-11-NEXT: int3
> + ; TEXT-11-NEXT: int3
> + ; TEXT-11-NEXT: int3
> + ; TEXT-11-NEXT: int3
> + ; TEXT-11-NEXT: int3
> + ; TEXT-11-NEXT: int3
> + ; TEXT-11-NEXT: movl $2, %eax
> + ; TEXT-11-NEXT: retq
> +
> + ; HEADERS-01: AddressOfEntryPoint: 0x1000
> + ; TEXT-01: Disassembly of section .text:
> + ; TEXT-01-NEXT: .text:
> + ; TEXT-01-NEXT: subq $40, %rsp
> + ; TEXT-01-NEXT: callq 23
> + ; TEXT-01-NEXT: xorl %eax, %eax
> + ; TEXT-01-NEXT: addq $40, %rsp
> + ; TEXT-01-NEXT: retq
> + ; TEXT-01-NEXT: retq
> + ; TEXT-01-NEXT: int3
> + ; TEXT-01-NEXT: int3
> + ; TEXT-01-NEXT: int3
> + ; TEXT-01-NEXT: int3
> + ; TEXT-01-NEXT: int3
> + ; TEXT-01-NEXT: int3
> + ; TEXT-01-NEXT: int3
> + ; TEXT-01-NEXT: int3
> + ; TEXT-01-NEXT: int3
> + ; TEXT-01-NEXT: int3
> + ; TEXT-01-NEXT: int3
> + ; TEXT-01-NEXT: int3
> + ; TEXT-01-NEXT: int3
> + ; TEXT-01-NEXT: int3
> + ; TEXT-01-NEXT: int3
> + ; TEXT-01-NEXT: retq
> +
> + ; HEADERS-10: AddressOfEntryPoint: 0x1020
> + ; TEXT-10: Disassembly of section .text:
> + ; TEXT-10-NEXT: .text:
> + ; TEXT-10-NEXT: retq
> + ; TEXT-10-NEXT: nop
> + ; TEXT-10-NEXT: nop
> + ; TEXT-10-NEXT: nop
> + ; TEXT-10-NEXT: nop
> + ; TEXT-10-NEXT: nop
> + ; TEXT-10-NEXT: nop
> + ; TEXT-10-NEXT: nop
> + ; TEXT-10-NEXT: nop
> + ; TEXT-10-NEXT: nop
> + ; TEXT-10-NEXT: nop
> + ; TEXT-10-NEXT: nop
> + ; TEXT-10-NEXT: nop
> + ; TEXT-10-NEXT: nop
> + ; TEXT-10-NEXT: nop
> + ; TEXT-10-NEXT: nop
> + ; TEXT-10-NEXT: retq
> + ; TEXT-10-NEXT: int3
> + ; TEXT-10-NEXT: int3
> + ; TEXT-10-NEXT: int3
> + ; TEXT-10-NEXT: int3
> + ; TEXT-10-NEXT: int3
> + ; TEXT-10-NEXT: int3
> + ; TEXT-10-NEXT: int3
> + ; TEXT-10-NEXT: int3
> + ; TEXT-10-NEXT: int3
> + ; TEXT-10-NEXT: int3
> + ; TEXT-10-NEXT: int3
> + ; TEXT-10-NEXT: int3
> + ; TEXT-10-NEXT: int3
> + ; TEXT-10-NEXT: int3
> + ; TEXT-10-NEXT: int3
> + ; TEXT-10-NEXT: subq $40, %rsp
> + ; TEXT-10-NEXT: callq -41
> + ; TEXT-10-NEXT: xorl %eax, %eax
> + ; TEXT-10-NEXT: addq $40, %rsp
> + ; TEXT-10-NEXT: retq
> +
> + target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
> + target triple = "x86_64-pc-windows-msvc"
> +
> + define i32 @main() {
> + call void @foo()
> + ret i32 0
> + }
> +
> + declare void @foo()
> +
> + $f1 = comdat any
> + define i32 @f1() comdat($f1) {
> + ret i32 1
> + }
> +
> + $f2 = comdat any
> + define i32 @f2() comdat($f2) {
> + ret i32 2
> + }
> +
> + define internal void @internal() {
> + ret void
> + }
> +Index: test/COFF/pdb-global-gc.yaml
> +===================================================================
> +--- test/COFF/pdb-global-gc.yaml (revision 333896)
> ++++ test/COFF/pdb-global-gc.yaml (working copy)
> +@@ -1,120 +1,121 @@
> ++# REQUIRES: x86
> + # RUN: yaml2obj %s -o %t.obj
> + # RUN: llvm-mc %S/Inputs/pdb-global-gc.s -triple x86_64-windows-msvc
> -filetype=obj -o %t2.obj
> + # RUN: lld-link %t.obj %t2.obj -debug -entry:main \
> + # RUN: -nodefaultlib -opt:ref -out:%t.exe -pdb:%t.pdb -verbose
> + # RUN: llvm-pdbutil dump -symbols -globals %t.pdb | FileCheck %s
> +
> + # This tests the case where an __imp_ chunk is discarded by linker GC.
> The debug
> + # info may refer to the __imp_ symbol still.
> +
> + # Compile this code with MSVC to regenerate the test case:
> + # extern char __declspec(dllimport) __wc_mb_cur;
> + # int discarded() { return __wc_mb_cur; }
> + # int main() { return g2; }
> +
> + # CHECK: Global Symbols
> + # CHECK-NEXT:
> ============================================================
> + # CHECK-NEXT: Records
> + # CHECK-NEXT: 20 | S_GDATA32 [size = 28] `__wc_mb_cur`
> + # CHECK-NEXT: type = 0x0070 (char), addr = 0000:0000
> +
> + # CHECK: Symbols
> + # CHECK:
> ============================================================
> + # CHECK-NEXT: Mod 0000 | `{{.*}}pdb-global-gc.yaml.tmp.obj`:
> + # CHECK-NEXT: Mod 0001 | `{{.*}}pdb-global-gc.yaml.tmp2.obj`:
> + # CHECK-NEXT: Mod 0002 | `* Linker *`:
> +
> + --- !COFF
> + header:
> + Machine: IMAGE_FILE_MACHINE_AMD64
> + Characteristics: [ ]
> + sections:
> + - Name: '.debug$S'
> + Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA,
> IMAGE_SCN_MEM_DISCARDABLE, IMAGE_SCN_MEM_READ ]
> + Alignment: 1
> + Subsections:
> + - !Symbols
> + Records:
> + - Kind: S_GDATA32
> + DataSym:
> + Type: 112
> + DisplayName: __wc_mb_cur
> + - !StringTable
> + Strings:
> + Relocations:
> + - VirtualAddress: 20
> + SymbolName: __wc_mb_cur
> + Type: IMAGE_REL_AMD64_SECREL
> + - VirtualAddress: 24
> + SymbolName: __wc_mb_cur
> + Type: IMAGE_REL_AMD64_SECTION
> + - Name: '.text$mn'
> + Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_LNK_COMDAT,
> IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
> + Alignment: 16
> + SectionData: 0FBE0500000000C3
> + Relocations:
> + - VirtualAddress: 3
> + SymbolName: __wc_mb_cur
> + Type: IMAGE_REL_AMD64_REL32
> + - Name: '.text$mn'
> + Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_LNK_COMDAT,
> IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
> + Alignment: 16
> + SectionData: B82A000000C3
> + symbols:
> + - Name: '.debug$S'
> + Value: 0
> + SectionNumber: 1
> + SimpleType: IMAGE_SYM_TYPE_NULL
> + ComplexType: IMAGE_SYM_DTYPE_NULL
> + StorageClass: IMAGE_SYM_CLASS_STATIC
> + SectionDefinition:
> + Length: 240
> + NumberOfRelocations: 2
> + NumberOfLinenumbers: 0
> + CheckSum: 0
> + Number: 0
> + - Name: '.text$mn'
> + Value: 0
> + SectionNumber: 2
> + SimpleType: IMAGE_SYM_TYPE_NULL
> + ComplexType: IMAGE_SYM_DTYPE_NULL
> + StorageClass: IMAGE_SYM_CLASS_STATIC
> + SectionDefinition:
> + Length: 11
> + NumberOfRelocations: 1
> + NumberOfLinenumbers: 0
> + CheckSum: 2906070869
> + Number: 0
> + Selection: IMAGE_COMDAT_SELECT_NODUPLICATES
> + - Name: '.text$mn'
> + Value: 0
> + SectionNumber: 3
> + SimpleType: IMAGE_SYM_TYPE_NULL
> + ComplexType: IMAGE_SYM_DTYPE_NULL
> + StorageClass: IMAGE_SYM_CLASS_STATIC
> + SectionDefinition:
> + Length: 6
> + NumberOfRelocations: 0
> + NumberOfLinenumbers: 0
> + CheckSum: 2139436471
> + Number: 0
> + Selection: IMAGE_COMDAT_SELECT_NODUPLICATES
> + - Name: discarded
> + Value: 0
> + SectionNumber: 2
> + SimpleType: IMAGE_SYM_TYPE_NULL
> + ComplexType: IMAGE_SYM_DTYPE_FUNCTION
> + StorageClass: IMAGE_SYM_CLASS_EXTERNAL
> + - Name: main
> + Value: 0
> + SectionNumber: 3
> + SimpleType: IMAGE_SYM_TYPE_NULL
> + ComplexType: IMAGE_SYM_DTYPE_FUNCTION
> + StorageClass: IMAGE_SYM_CLASS_EXTERNAL
> + - Name:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180606/525397ef/attachment-0001.html>
More information about the llvm-commits
mailing list