[Verifier] Allow dllexport protected after D133267

I have noticed that this combo makes sense (D133266) but rejected it for
simplicity. It turns out to be used by PlayStation, so let's allow it.
This commit is contained in:
Fangrui Song 2022-09-06 15:28:29 -07:00
parent 93600eb50c
commit 97d00b72a2
2 changed files with 6 additions and 7 deletions

View File

@ -664,8 +664,9 @@ void Verifier::visitGlobalValue(const GlobalValue &GV) {
Check(!GV.hasComdat(), "Declaration may not be in a Comdat!", &GV);
if (GV.hasDLLExportStorageClass()) {
Check(GV.hasDefaultVisibility(),
"dllexport GlobalValue must have default visibility", &GV);
Check(!GV.hasHiddenVisibility(),
"dllexport GlobalValue must have default or protected visibility",
&GV);
}
if (GV.hasDLLImportStorageClass()) {
Check(GV.hasDefaultVisibility(),

View File

@ -3,16 +3,14 @@
target datalayout = "e-m:w-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-windows-gnu"
; CHECK: dllexport GlobalValue must have default visibility
; CHECK: dllexport GlobalValue must have default or protected visibility
; CHECK-NEXT: ptr @dllexport_hidden
declare hidden dllexport i32 @dllexport_hidden()
; CHECK: dllexport GlobalValue must have default visibility
; CHECK-NEXT: ptr @dllexport_protected
declare protected dllexport i32 @dllexport_protected()
; CHECK: dllimport GlobalValue must have default visibility
; CHECK-NEXT: dllimport GlobalValue must have default visibility
; CHECK-NEXT: ptr @dllimport_hidden
declare hidden dllimport i32 @dllimport_hidden()
; CHECK: dllimport GlobalValue must have default visibility
; CHECK-NEXT: dllimport GlobalValue must have default visibility
; CHECK-NEXT: ptr @dllimport_protected
declare protected dllimport i32 @dllimport_protected()