• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; REQUIRES: x86
2
3; RUN: echo -e ".global variable\n.global DllMainCRTStartup\n.text\nDllMainCRTStartup:\nret\n.data\nvariable:\n.long 42" > %t-lib.s
4; RUN: llvm-mc -triple=x86_64-windows-gnu %t-lib.s -filetype=obj -o %t-lib.obj
5; RUN: lld-link -out:%t-lib.dll -dll -entry:DllMainCRTStartup %t-lib.obj -lldmingw -implib:%t-lib.lib
6
7; RUN: llvm-as -o %t.obj %s
8; RUN: lld-link -lldmingw -out:%t.exe -entry:entry %t.obj %t-lib.lib
9
10; RUN: llvm-readobj --coff-imports %t.exe | FileCheck -check-prefix=IMPORTS %s
11
12; IMPORTS: Import {
13; IMPORTS-NEXT: Name: autoimport-lto.ll.tmp-lib.dll
14; IMPORTS-NEXT: ImportLookupTableRVA:
15; IMPORTS-NEXT: ImportAddressTableRVA:
16; IMPORTS-NEXT: Symbol: variable (0)
17; IMPORTS-NEXT: }
18
19target datalayout = "e-m:w-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
20target triple = "x86_64-w64-windows-gnu"
21
22@variable = external global i32
23
24define i32 @entry() {
25entry:
26  %0 = load i32, i32* @variable
27  ret i32 %0
28}
29