aboutsummaryrefslogtreecommitdiff
path: root/test/NaCl/PNaClABI/global-attributes.ll
blob: 6697d9515cd9f4ac81c469ae7b540fef43bf0d83 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
; RUN: pnacl-abicheck < %s | FileCheck %s

; Global variable attributes

; CHECK: Variable var_with_section has disallowed "section" attribute
@var_with_section = global [1 x i8] zeroinitializer, section ".some_section"

; PNaCl programs can depend on data alignments in general, so we allow
; "align" on global variables.
; CHECK-NOT: var_with_alignment
@var_with_alignment = global [4 x i8] zeroinitializer, align 8

; TLS variables must be expanded out by ExpandTls.
; CHECK-NEXT: Variable tls_var has disallowed "thread_local" attribute
@tls_var = thread_local global [4 x i8] zeroinitializer


; Function attributes

; CHECK-NEXT: Function func_with_attrs has disallowed attributes: noreturn nounwind
define void @func_with_attrs() noreturn nounwind {
  ret void
}

; CHECK-NEXT: Function func_with_arg_attrs has disallowed attributes: inreg zeroext
define void @func_with_arg_attrs(i32 inreg zeroext) {
  ret void
}

; CHECK-NEXT: Function func_with_callingconv has disallowed calling convention: 8
define fastcc void @func_with_callingconv() {
  ret void
}

; CHECK-NEXT: Function func_with_section has disallowed "section" attribute
define void @func_with_section() section ".some_section" {
  ret void
}

; TODO(mseaborn): PNaCl programs don't know what alignment is
; reasonable for a function, so we should disallow this.
; CHECK-NOT: func_with_alignment
define void @func_with_alignment() align 1 {
  ret void
}

; CHECK-NEXT: Function func_with_gc has disallowed "gc" attribute
define void @func_with_gc() gc "my_gc_func" {
  ret void
}

; CHECK-NOT: disallowed
; If another check is added, there should be a check-not in between each check