File: ptrauth-sign-personality.ll

package info (click to toggle)
llvm-toolchain-20 1%3A20.1.8-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 2,111,696 kB
  • sloc: cpp: 7,438,781; ansic: 1,393,871; asm: 1,012,926; python: 241,771; f90: 86,635; objc: 75,411; lisp: 42,144; pascal: 17,286; sh: 8,596; ml: 5,082; perl: 4,730; makefile: 3,591; awk: 3,523; javascript: 2,251; xml: 892; fortran: 672
file content (73 lines) | stat: -rw-r--r-- 3,022 bytes parent folder | download | duplicates (6)
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
; RUN: rm -rf %t && split-file %s %t && cd %t
; RUN: cat common.ll authflag.ll   > auth.ll
; RUN: cat common.ll noauthflag.ll > noauth1.ll
; RUN: cat common.ll               > noauth2.ll

; RUN: llc -mtriple=aarch64-linux -filetype=asm auth.ll -o - | \
; RUN:   FileCheck --check-prefix=AUTH-ASM %s
; RUN: llc -mtriple=aarch64-linux -filetype=obj auth.ll -o - | \
; RUN:   llvm-readelf -r -x .data.DW.ref.__gxx_personality_v0 - | \
; RUN:   FileCheck --check-prefix=AUTH-RELOC %s

; AUTH-ASM:      DW.ref.__gxx_personality_v0:
; AUTH-ASM-NEXT:     .xword  __gxx_personality_v0@AUTH(ia,32429,addr)

; AUTH-RELOC:      Relocation section '.rela.data.DW.ref.__gxx_personality_v0' at offset 0x2a0 contains 1 entries:
; AUTH-RELOC-NEXT:     Offset             Info             Type               Symbol's Value  Symbol's Name + Addend
; AUTH-RELOC-NEXT: 0000000000000000  0000000f00000244 R_AARCH64_AUTH_ABS64   0000000000000000 __gxx_personality_v0 + 0

; AUTH-RELOC:      Hex dump of section '.data.DW.ref.__gxx_personality_v0':
; AUTH-RELOC-NEXT: 0x00000000 00000000 ad7e0080
;                                      ^^^^ 0x7EAD = discriminator
;                                            ^^ 0b10000000: bit 63 = 1 -> address diversity enabled, bits 61:60 = 0b00 -> key is IA

; RUN: llc -mtriple=aarch64-linux -filetype=asm noauth1.ll -o - | \
; RUN:   FileCheck --check-prefix=NOAUTH-ASM %s
; RUN: llc -mtriple=aarch64-linux -filetype=obj noauth1.ll -o - | \
; RUN:   llvm-readelf -r -x .data.DW.ref.__gxx_personality_v0 - | \
; RUN:   FileCheck --check-prefix=NOAUTH-RELOC %s

; RUN: llc -mtriple=aarch64-linux -filetype=asm noauth2.ll -o - | \
; RUN:   FileCheck --check-prefix=NOAUTH-ASM %s
; RUN: llc -mtriple=aarch64-linux -filetype=obj noauth2.ll -o - | \
; RUN:   llvm-readelf -r -x .data.DW.ref.__gxx_personality_v0 - | \
; RUN:   FileCheck --check-prefix=NOAUTH-RELOC %s

; NOAUTH-ASM:      DW.ref.__gxx_personality_v0:
; NOAUTH-ASM-NEXT:     .xword  __gxx_personality_v0{{$}}

; NOAUTH-RELOC:      Relocation section '.rela.data.DW.ref.__gxx_personality_v0' at offset 0x2a0 contains 1 entries:
; NOAUTH-RELOC-NEXT:     Offset             Info             Type               Symbol's Value  Symbol's Name + Addend
; NOAUTH-RELOC-NEXT: 0000000000000000  0000000f00000101 R_AARCH64_ABS64   0000000000000000 __gxx_personality_v0 + 0

; NOAUTH-RELOC:      Hex dump of section '.data.DW.ref.__gxx_personality_v0':
; NOAUTH-RELOC-NEXT: 0x00000000 00000000 00000000

;--- common.ll
@_ZTISt9exception = external constant ptr

define i32 @main() personality ptr @__gxx_personality_v0 {
entry:
  invoke void @foo() to label %cont unwind label %lpad

lpad:
  %0 = landingpad { ptr, i32 }
    catch ptr null
    catch ptr @_ZTISt9exception
  ret i32 0

cont:
  ret i32 0
}

declare i32 @__gxx_personality_v0(...)

declare void @foo()

;--- authflag.ll
!llvm.module.flags = !{!0}
!0 = !{i32 8, !"ptrauth-sign-personality", i32 1}

;--- noauthflag.ll
!llvm.module.flags = !{!0}
!0 = !{i32 8, !"ptrauth-sign-personality", i32 0}