zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

blob 96c7dca5 (2968B) - Raw


      1 # REQEUIRES: x86
      2 
      3 # RUN: llvm-mc -triple=i686-windows-gnu %s -filetype=obj -o %t.obj
      4 
      5 # RUN: lld-link -lldmingw -dll -out:%t.dll -entry:DllMainCRTStartup@12 %t.obj -implib:%t.lib
      6 # RUN: llvm-readobj -coff-exports %t.dll | FileCheck %s
      7 # RUN: llvm-readobj %t.lib | FileCheck -check-prefix=IMPLIB %s
      8 
      9 # CHECK-NOT: Name: DllMainCRTStartup
     10 # CHECK-NOT: Name: _imp__unexported
     11 # CHECK: Name: dataSym
     12 # CHECK: Name: foobar
     13 # CHECK-NOT: Name: unexported
     14 
     15 # IMPLIB: Symbol: __imp__dataSym
     16 # IMPLIB-NOT: Symbol: _dataSym
     17 # IMPLIB: Symbol: __imp__foobar
     18 # IMPLIB: Symbol: _foobar
     19 
     20 .global _foobar
     21 .global _DllMainCRTStartup@12
     22 .global _dataSym
     23 .global _unexported
     24 .global __imp__unexported
     25 .text
     26 _DllMainCRTStartup@12:
     27   ret
     28 _foobar:
     29   ret
     30 _unexported:
     31   ret
     32 .data
     33 _dataSym:
     34   .int 4
     35 __imp__unexported:
     36   .int _unexported
     37 
     38 # Test specifying -export-all-symbols, on an object file that contains
     39 # dllexport directive for some of the symbols.
     40 
     41 # RUN: yaml2obj < %p/Inputs/export.yaml > %t.obj
     42 #
     43 # RUN: lld-link -out:%t.dll -dll %t.obj -lldmingw -export-all-symbols -output-def:%t.def
     44 # RUN: llvm-readobj -coff-exports %t.dll | FileCheck -check-prefix=CHECK2 %s
     45 # RUN: cat %t.def | FileCheck -check-prefix=CHECK2-DEF %s
     46 
     47 # Note, this will actually export _DllMainCRTStartup as well, since
     48 # it uses the standard spelling in this object file, not the MinGW one.
     49 
     50 # CHECK2: Name: exportfn1
     51 # CHECK2: Name: exportfn2
     52 # CHECK2: Name: exportfn3
     53 
     54 # CHECK2-DEF: EXPORTS
     55 # CHECK2-DEF: exportfn1 @3
     56 # CHECK2-DEF: exportfn2 @4
     57 # CHECK2-DEF: exportfn3 @5
     58 
     59 # Test ignoring certain object files and libs.
     60 
     61 # RUN: echo -e ".global foobar\n.global DllMainCRTStartup\n.text\nDllMainCRTStartup:\nret\nfoobar:\ncall mingwfunc\ncall crtfunc\nret\n" > %t.main.s
     62 # RUN: llvm-mc -triple=x86_64-windows-gnu %t.main.s -filetype=obj -o %t.main.obj
     63 # RUN: mkdir -p %T/libs
     64 # RUN: echo -e ".global mingwfunc\n.text\nmingwfunc:\nret\n" > %T/libs/mingwfunc.s
     65 # RUN: llvm-mc -triple=x86_64-windows-gnu %T/libs/mingwfunc.s -filetype=obj -o %T/libs/mingwfunc.o
     66 # RUN: llvm-ar rcs %T/libs/libmingwex.a %T/libs/mingwfunc.o
     67 # RUN: echo -e ".global crtfunc\n.text\ncrtfunc:\nret\n" > %T/libs/crtfunc.s
     68 # RUN: llvm-mc -triple=x86_64-windows-gnu %T/libs/crtfunc.s -filetype=obj -o %T/libs/crt2.o
     69 # 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
     70 # RUN: echo "EOF" >> %t.def
     71 # RUN: cat %t.def | FileCheck -check-prefix=CHECK-EXCLUDE %s
     72 
     73 # CHECK-EXCLUDE: EXPORTS
     74 # CHECK-EXCLUDE-NEXT: foobar @1
     75 # CHECK-EXCLUDE-NEXT: EOF
     76 
     77 # Test that we handle import libraries together with -opt:noref.
     78 
     79 # RUN: yaml2obj < %p/Inputs/hello32.yaml > %t.obj
     80 # RUN: lld-link -lldmingw -dll -out:%t.dll -entry:main@0 %t.obj -implib:%t.lib -opt:noref %p/Inputs/std32.lib -output-def:%t.def
     81 # RUN: echo "EOF" >> %t.def
     82 # RUN: cat %t.def | FileCheck -check-prefix=CHECK-IMPLIB %s
     83 
     84 # CHECK-IMPLIB: EXPORTS
     85 # CHECK-IMPLIB-NEXT: main@0 @1
     86 # CHECK-IMPLIB-NEXT: EOF