File: objc-imageinfo.S

package info (click to toggle)
llvm-toolchain-18 1%3A18.1.8-18
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 1,908,340 kB
  • sloc: cpp: 6,667,937; ansic: 1,440,452; asm: 883,619; python: 230,549; objc: 76,880; f90: 74,238; lisp: 35,989; pascal: 16,571; sh: 10,229; perl: 7,459; ml: 5,047; awk: 3,523; makefile: 2,987; javascript: 2,149; xml: 892; fortran: 649; cs: 573
file content (111 lines) | stat: -rw-r--r-- 3,531 bytes parent folder | download | duplicates (2)
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
// Test merging of __objc_imageinfo flags and ensure we can run mixed objc and
// swift code in a single jit dylib.

// REQUIRES: system-darwin && asserts

// RUN: rm -rf %t
// RUN: split-file %s %t
// RUN: (cd %t; %clang -c *.S)

// Check individual versions are loadable.

// RUN: %llvm_jitlink -debug-only=orc %t/main.o %t/objc_old.o 2>&1 | FileCheck %s -check-prefix=OLD
// OLD: MachOPlatform: Registered __objc_imageinfo for main
// OLD-SAME: flags = 0x0000
// RUN: %llvm_jitlink -debug-only=orc %t/main.o %t/objc_new.o 2>&1 | FileCheck %s -check-prefix=NEW
// NEW: MachOPlatform: Registered __objc_imageinfo for main
// NEW-SAME: flags = 0x0040
// RUN: %llvm_jitlink -debug-only=orc %t/main.o %t/swift_4.o 2>&1 | FileCheck %s -check-prefix=SWIFT_4
// SWIFT_4: MachOPlatform: Registered __objc_imageinfo for main
// SWIFT_4-SAME: flags = 0x0640
// RUN: %llvm_jitlink -debug-only=orc %t/main.o %t/swift_5.o 2>&1 | FileCheck %s -check-prefix=SWIFT_5
// SWIFT_5: MachOPlatform: Registered __objc_imageinfo for main
// SWIFT_5-SAME: flags = 0x5000740
// RUN: %llvm_jitlink -debug-only=orc %t/main.o %t/swift_59.o 2>&1 | FileCheck %s -check-prefix=SWIFT_59
// SWIFT_59: MachOPlatform: Registered __objc_imageinfo for main
// SWIFT_59-SAME: flags = 0x5090740

// Check error conditions.

// RUN: not %llvm_jitlink %t/main.o %t/objc_old.o %t/objc_new.o 2>&1 | FileCheck %s -check-prefix=CATEGORY
// CATEGORY: ObjC category class property support in {{.*}} does not match first registered flags

// RUN: not %llvm_jitlink %t/main.o %t/swift_4.o %t/swift_5.o 2>&1 | FileCheck %s -check-prefix=SWIFT_ABI
// SWIFT_ABI: Swift ABI version in {{.*}} does not match first registered flags

// Check merging.

// Take the lowest swift version.
// RUN: %llvm_jitlink -debug-only=orc %t/main.o %t/swift_59.o %t/swift_5.o 2>&1 | FileCheck %s -check-prefix=SWIFT_MIX1
// SWIFT_MIX1: MachOPlatform: Merging __objc_imageinfo flags for main {{.*}} -> 0x5000740

// Add swift to objc.
// RUN: %llvm_jitlink -debug-only=orc %t/main.o %t/swift_59.o %t/objc_new.o 2>&1 | FileCheck %s -check-prefix=SWIFT_MIX2
// SWIFT_MIX2: MachOPlatform: Merging __objc_imageinfo flags for main {{.*}} -> 0x5090740

// Add multiple swift to objc.
// RUN: %llvm_jitlink -debug-only=orc %t/main.o %t/swift_59.o %t/swift_5.o %t/objc_new.o 2>&1 | FileCheck %s -check-prefix=SWIFT_MIX3
// SWIFT_MIX3: MachOPlatform: Merging __objc_imageinfo flags for main {{.*}} -> 0x5000740

//--- main.S
.section  __TEXT,__text,regular,pure_instructions
.globl _main
_main:
  mov w0, #0
  ret

//--- objc_old.S
.section  __TEXT,__text,regular,pure_instructions
.globl _objc1
_objc1:
  ret

  .section  __DATA,__objc_imageinfo,regular,no_dead_strip
L_OBJC_IMAGE_INFO:
  .long 0
  .long 0

//--- objc_new.S
.section  __TEXT,__text,regular,pure_instructions
.globl _objc2
_objc2:
  ret

  .section  __DATA,__objc_imageinfo,regular,no_dead_strip
L_OBJC_IMAGE_INFO:
  .long 0
  .long 64

//--- swift_4.S
.section  __TEXT,__text,regular,pure_instructions
.globl _swift4
_swift4:
  ret

  .section  __DATA,__objc_imageinfo,regular,no_dead_strip
L_OBJC_IMAGE_INFO:
  .long 0
  .long 1600

//--- swift_5.S
.section  __TEXT,__text,regular,pure_instructions
.globl _swift5
_swift5:
  ret

  .section  __DATA,__objc_imageinfo,regular,no_dead_strip
L_OBJC_IMAGE_INFO:
  .long 0
  .long 83887936

//--- swift_59.S
.section  __TEXT,__text,regular,pure_instructions
.globl _swift59
_swift59:
  ret

  .section  __DATA,__objc_imageinfo,regular,no_dead_strip
L_OBJC_IMAGE_INFO:
  .long 0
  .long 84477760