1
+ # REQUIRES: x86
2
+ ## Test HIP specific sections layout.
3
+
4
+ # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux --defsym=HIP_SECTIONS=1 --defsym=NON_HIP_SECTIONS=1 %s -o %t.o
5
+ # RUN: ld.lld %t.o -o %t.out
6
+ # RUN: llvm-readobj --sections %t.out | FileCheck %s
7
+
8
+ # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux --defsym=NON_HIP_SECTIONS=1 %s -o %t.1.o
9
+ # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux --defsym=HIP_SECTIONS=1 %s -o %t.2.o
10
+ # RUN: ld.lld %t.1.o %t.2.o -o %t.s.out
11
+ # RUN: llvm-readobj --sections %t.s.out | FileCheck %s
12
+
13
+ .ifdef HIP_SECTIONS
14
+ .section .hipFatBinSegment,"aw" ,@progbits ; .space 1
15
+ .section .hip_gpubin_handle,"aw" ,@progbits ; .space 1
16
+ .section .hip_fatbin,"a" ,@progbits ; .space 1
17
+ .endif
18
+
19
+ .ifdef NON_HIP_SECTIONS
20
+ .global _start
21
+ .text
22
+ _start:
23
+ .section .bss ,"aw" ,@nobits ; .space 1
24
+ .section .debug_info,"",@progbits
25
+ .section .debug_line,"",@progbits
26
+ .section .debug_str,"MS" ,@progbits ,1
27
+ .endif
28
+
29
+ # Check that the HIP sections are placed towards the end but before non allocated sections
30
+
31
+ // CHECK: Name: .bss
32
+ // CHECK: Name: .hipFatBinSegment
33
+ // CHECK: Name: .hip_gpubin_handle
34
+ // CHECK: Name: .hip_fatbin
35
+ // CHECK: Name: .debug_info
36
+ // CHECK: Name: .debug_line
37
+ // CHECK: Name: .debug_str
0 commit comments