2017-07-19 02:40:50 +08:00
|
|
|
# REQUIRES: x86
|
2017-06-03 01:48:06 +08:00
|
|
|
# RUN: llvm-mc -filetype=obj -triple=i686-windows-msvc %s -o %t.obj
|
2017-10-23 17:08:24 +08:00
|
|
|
# RUN: echo -e "LIBRARY foo\nEXPORTS\n stdcall\n fastcall\n vectorcall\n _underscored" > %t.def
|
[COFF] Implement /safeseh:no and check @feat.00 flags by default
Summary:
Fixes PR41828. Before this, LLD always emitted SafeSEH chunks and
defined __safe_se_handler_table & size. Now, /safeseh:no leaves those
undefined.
Additionally, we were checking for the safeseh @feat.00 flag in two
places: once to emit errors, and once during safeseh table construction.
The error was set up to be off by default, but safeseh is supposed to be
on by default. I combined the two checks, so now LLD emits an error if
an input object lacks @feat.00 and safeseh is enabled. This caused the
majority of 32-bit LLD tests to fail, since many test input object files
lack @feat.00 symbols. I explicitly added -safeseh:no to those tests to
preserve behavior.
Finally, LLD no longer sets IMAGE_DLL_CHARACTERISTICS_NO_SEH if any
input file wasn't compiled for safeseh.
Reviewers: mstorsjo, ruiu, thakis
Reviewed By: ruiu, thakis
Subscribers: llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D63570
llvm-svn: 366238
2019-07-17 02:17:33 +08:00
|
|
|
# RUN: lld-link -safeseh:no -entry:dllmain -dll -def:%t.def %t.obj -out:%t.dll -implib:%t.lib
|
2017-10-23 17:08:24 +08:00
|
|
|
# RUN: llvm-readobj %t.lib | FileCheck -check-prefix UNDECORATED-IMPLIB %s
|
2019-05-01 13:49:01 +08:00
|
|
|
# RUN: llvm-readobj --coff-exports %t.dll | FileCheck -check-prefix UNDECORATED-EXPORTS %s
|
2017-10-23 17:08:24 +08:00
|
|
|
|
|
|
|
# UNDECORATED-IMPLIB: Name type: noprefix
|
|
|
|
# UNDECORATED-IMPLIB-NEXT: __imp___underscored
|
|
|
|
# UNDECORATED-IMPLIB-NEXT: __underscored
|
|
|
|
# UNDECORATED-IMPLIB: Name type: undecorate
|
|
|
|
# UNDECORATED-IMPLIB-NEXT: __imp_@fastcall@8
|
|
|
|
# UNDECORATED-IMPLIB-NEXT: fastcall@8
|
|
|
|
# UNDECORATED-IMPLIB: Name type: undecorate
|
|
|
|
# UNDECORATED-IMPLIB-NEXT: __imp__stdcall@8
|
|
|
|
# UNDECORATED-IMPLIB-NEXT: _stdcall@8
|
|
|
|
# UNDECORATED-IMPLIB: Name type: undecorate
|
|
|
|
# UNDECORATED-IMPLIB-NEXT: __imp_vectorcall@@8
|
|
|
|
# UNDECORATED-IMPLIB-NEXT: vectorcall@@8
|
|
|
|
|
|
|
|
# UNDECORATED-EXPORTS: Name: _underscored
|
|
|
|
# UNDECORATED-EXPORTS: Name: fastcall
|
|
|
|
# UNDECORATED-EXPORTS: Name: stdcall
|
|
|
|
# UNDECORATED-EXPORTS: Name: vectorcall
|
|
|
|
|
|
|
|
|
|
|
|
# RUN: echo -e "LIBRARY foo\nEXPORTS\n _stdcall@8\n @fastcall@8\n vectorcall@@8" > %t.def
|
[COFF] Implement /safeseh:no and check @feat.00 flags by default
Summary:
Fixes PR41828. Before this, LLD always emitted SafeSEH chunks and
defined __safe_se_handler_table & size. Now, /safeseh:no leaves those
undefined.
Additionally, we were checking for the safeseh @feat.00 flag in two
places: once to emit errors, and once during safeseh table construction.
The error was set up to be off by default, but safeseh is supposed to be
on by default. I combined the two checks, so now LLD emits an error if
an input object lacks @feat.00 and safeseh is enabled. This caused the
majority of 32-bit LLD tests to fail, since many test input object files
lack @feat.00 symbols. I explicitly added -safeseh:no to those tests to
preserve behavior.
Finally, LLD no longer sets IMAGE_DLL_CHARACTERISTICS_NO_SEH if any
input file wasn't compiled for safeseh.
Reviewers: mstorsjo, ruiu, thakis
Reviewed By: ruiu, thakis
Subscribers: llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D63570
llvm-svn: 366238
2019-07-17 02:17:33 +08:00
|
|
|
# RUN: lld-link -safeseh:no -entry:dllmain -dll -def:%t.def %t.obj -out:%t.dll -implib:%t.lib
|
2017-10-23 17:08:24 +08:00
|
|
|
# RUN: llvm-readobj %t.lib | FileCheck -check-prefix DECORATED-IMPLIB %s
|
2019-05-01 13:49:01 +08:00
|
|
|
# RUN: llvm-readobj --coff-exports %t.dll | FileCheck -check-prefix DECORATED-EXPORTS %s
|
2017-10-23 17:08:24 +08:00
|
|
|
|
|
|
|
# DECORATED-IMPLIB: Name type: name
|
|
|
|
# DECORATED-IMPLIB-NEXT: __imp_@fastcall@8
|
|
|
|
# DECORATED-IMPLIB-NEXT: @fastcall@8
|
2018-01-20 19:44:42 +08:00
|
|
|
# DECORATED-IMPLIB: Name type: name
|
2017-10-23 17:08:24 +08:00
|
|
|
# DECORATED-IMPLIB-NEXT: __imp__stdcall@8
|
|
|
|
# DECORATED-IMPLIB-NEXT: _stdcall@8
|
|
|
|
# DECORATED-IMPLIB: Name type: name
|
|
|
|
# DECORATED-IMPLIB-NEXT: __imp_vectorcall@@8
|
|
|
|
# DECORATED-IMPLIB-NEXT: vectorcall@@8
|
|
|
|
|
|
|
|
# DECORATED-EXPORTS: Name: @fastcall@8
|
2018-01-20 19:44:42 +08:00
|
|
|
# DECORATED-EXPORTS: Name: _stdcall@8
|
2017-10-23 17:08:24 +08:00
|
|
|
# DECORATED-EXPORTS: Name: vectorcall@@8
|
|
|
|
|
|
|
|
|
2018-03-15 04:17:16 +08:00
|
|
|
# GNU tools don't support vectorcall at the moment, but test it for completeness.
|
|
|
|
# RUN: echo -e "LIBRARY foo\nEXPORTS\n stdcall@8\n @fastcall@8\n vectorcall@@8" > %t.def
|
2017-10-23 17:08:24 +08:00
|
|
|
# RUN: lld-link -lldmingw -entry:dllmain -dll -def:%t.def %t.obj -out:%t.dll -implib:%t.lib
|
|
|
|
# RUN: llvm-readobj %t.lib | FileCheck -check-prefix DECORATED-MINGW-IMPLIB %s
|
2019-05-01 13:49:01 +08:00
|
|
|
# RUN: llvm-readobj --coff-exports %t.dll | FileCheck -check-prefix DECORATED-MINGW-EXPORTS %s
|
2017-10-23 17:08:24 +08:00
|
|
|
|
|
|
|
# DECORATED-MINGW-IMPLIB: Name type: name
|
|
|
|
# DECORATED-MINGW-IMPLIB-NEXT: __imp_@fastcall@8
|
|
|
|
# DECORATED-MINGW-IMPLIB-NEXT: fastcall@8
|
|
|
|
# DECORATED-MINGW-IMPLIB: Name type: noprefix
|
|
|
|
# DECORATED-MINGW-IMPLIB-NEXT: __imp__stdcall@8
|
|
|
|
# DECORATED-MINGW-IMPLIB-NEXT: _stdcall@8
|
2018-03-15 04:17:16 +08:00
|
|
|
# GNU tools don't support vectorcall, but this test is just to track that
|
|
|
|
# lld's behaviour remains consistent over time.
|
|
|
|
# DECORATED-MINGW-IMPLIB: Name type: name
|
|
|
|
# DECORATED-MINGW-IMPLIB-NEXT: __imp_vectorcall@@8
|
|
|
|
# DECORATED-MINGW-IMPLIB-NEXT: vectorcall@@8
|
2017-10-23 17:08:24 +08:00
|
|
|
|
|
|
|
# DECORATED-MINGW-EXPORTS: Name: @fastcall@8
|
|
|
|
# DECORATED-MINGW-EXPORTS: Name: stdcall@8
|
2018-03-15 04:17:16 +08:00
|
|
|
# DECORATED-MINGW-EXPORTS: Name: vectorcall@@8
|
|
|
|
|
2018-03-15 04:31:31 +08:00
|
|
|
# RUN: lld-link -lldmingw -kill-at -entry:dllmain -dll -def:%t.def %t.obj -out:%t.dll -implib:%t.lib
|
2018-03-15 04:17:16 +08:00
|
|
|
# RUN: llvm-readobj %t.lib | FileCheck -check-prefix MINGW-KILL-AT-IMPLIB %s
|
2019-05-01 13:49:01 +08:00
|
|
|
# RUN: llvm-readobj --coff-exports %t.dll | FileCheck -check-prefix MINGW-KILL-AT-EXPORTS %s
|
2018-03-15 04:17:16 +08:00
|
|
|
|
|
|
|
# RUN: lld-link -lldmingw -kill-at -entry:dllmain -dll %t.obj -out:%t.dll -implib:%t.lib
|
|
|
|
# RUN: llvm-readobj %t.lib | FileCheck -check-prefix MINGW-KILL-AT-IMPLIB %s
|
2019-05-01 13:49:01 +08:00
|
|
|
# RUN: llvm-readobj --coff-exports %t.dll | FileCheck -check-prefix MINGW-KILL-AT-EXPORTS %s
|
2018-03-15 04:17:16 +08:00
|
|
|
|
|
|
|
# MINGW-KILL-AT-IMPLIB: Name type: noprefix
|
|
|
|
# MINGW-KILL-AT-IMPLIB: __imp__fastcall
|
|
|
|
# MINGW-KILL-AT-IMPLIB-NEXT: _fastcall
|
|
|
|
# MINGW-KILL-AT-IMPLIB: Name type: noprefix
|
|
|
|
# MINGW-KILL-AT-IMPLIB-NEXT: __imp__stdcall
|
|
|
|
# MINGW-KILL-AT-IMPLIB-NEXT: _stdcall
|
|
|
|
# GNU tools don't support vectorcall, but this test is just to track that
|
|
|
|
# lld's behaviour remains consistent over time.
|
|
|
|
# MINGW-KILL-AT-IMPLIB: Name type: noprefix
|
|
|
|
# MINGW-KILL-AT-IMPLIB-NEXT: __imp__vectorcall
|
|
|
|
# MINGW-KILL-AT-IMPLIB-NEXT: _vectorcall
|
|
|
|
|
|
|
|
# MINGW-KILL-AT-EXPORTS: Name: fastcall
|
|
|
|
# MINGW-KILL-AT-EXPORTS: Name: stdcall
|
|
|
|
# MINGW-KILL-AT-EXPORTS: Name: vectorcall
|
2017-10-23 17:08:24 +08:00
|
|
|
|
2017-06-03 01:48:06 +08:00
|
|
|
|
|
|
|
.def _stdcall@8;
|
|
|
|
.scl 2;
|
|
|
|
.type 32;
|
|
|
|
.endef
|
|
|
|
.globl _stdcall@8
|
2017-10-23 17:08:24 +08:00
|
|
|
.globl @fastcall@8
|
|
|
|
.globl vectorcall@@8
|
|
|
|
.globl __underscored
|
2017-06-03 01:48:06 +08:00
|
|
|
_stdcall@8:
|
|
|
|
movl 8(%esp), %eax
|
|
|
|
addl 4(%esp), %eax
|
|
|
|
retl $8
|
2017-10-23 17:08:24 +08:00
|
|
|
@fastcall@8:
|
|
|
|
movl 8(%esp), %eax
|
|
|
|
addl 4(%esp), %eax
|
|
|
|
retl $8
|
|
|
|
vectorcall@@8:
|
|
|
|
movl 8(%esp), %eax
|
|
|
|
addl 4(%esp), %eax
|
|
|
|
retl $8
|
|
|
|
__underscored:
|
|
|
|
ret
|
2017-06-03 01:48:06 +08:00
|
|
|
|
|
|
|
.def _dllmain;
|
|
|
|
.scl 2;
|
|
|
|
.type 32;
|
|
|
|
.endef
|
|
|
|
.globl _dllmain
|
|
|
|
_dllmain:
|
|
|
|
retl
|
|
|
|
|