xref: /llvm-project/llvm/test/ExecutionEngine/OrcLazy/debug-objects.ll (revision cd6ed95e48354d14e59871f3c3f3a8665def22c8)
1; REQUIRES: native && x86_64-linux
2
3; In-memory debug-objects contain DWARF
4;
5; RUN: lli --jit-linker=rtdyld  --orc-lazy-debug=jit-debug-objects %s | llvm-dwarfdump --diff - | FileCheck %s
6; RUN: lli --jit-linker=jitlink --orc-lazy-debug=jit-debug-objects %s | llvm-dwarfdump --diff - | FileCheck %s
7;
8; CHECK: -:	file format elf64-x86-64
9; TODO: Synthesized Mach-O objects error out with:
10;       truncated or malformed object (offset field of section 8 in
11;       LC_SEGMENT_64 command 0 extends past the end of the file)
12;
13; CHECK: .debug_info contents:
14; CHECK: format = DWARF32
15; CHECK: DW_TAG_compile_unit
16; CHECK:               DW_AT_producer	("clang version 18.0.0git")
17; CHECK:               DW_AT_language	(DW_LANG_C11)
18; CHECK:               DW_AT_name	("source-file.c")
19; CHECK:               DW_AT_comp_dir	("/workspace")
20; CHECK:   DW_TAG_subprogram
21; CHECK:                 DW_AT_frame_base	(DW_OP_reg7 RSP)
22; CHECK:                 DW_AT_name	("main")
23; CHECK:                 DW_AT_decl_file	("/workspace/source-file.c")
24; CHECK:                 DW_AT_decl_line	(1)
25; CHECK:                 DW_AT_type	("int")
26; CHECK:                 DW_AT_external	(true)
27; CHECK:   DW_TAG_base_type
28; CHECK:                 DW_AT_name	("int")
29; CHECK:                 DW_AT_encoding	(DW_ATE_signed)
30; CHECK:                 DW_AT_byte_size	(0x04)
31; CHECK:   NULL
32
33; Text section of the in-memory debug-objects have non-null load-address
34;
35; RUN: lli --jit-linker=rtdyld --orc-lazy-debug=jit-debug-objects %s | \
36; RUN:                              llvm-objdump --section-headers - | \
37; RUN:                              FileCheck --check-prefix=CHECK_LOAD_ADDR %s
38; RUN: lli --jit-linker=jitlink --orc-lazy-debug=jit-debug-objects %s | \
39; RUN:                               llvm-objdump --section-headers - | \
40; RUN:                               FileCheck --check-prefix=CHECK_LOAD_ADDR %s
41;
42; CHECK_LOAD_ADDR:      .text
43; CHECK_LOAD_ADDR-NOT:  0000000000000000
44; CHECK_LOAD_ADDR-SAME: TEXT
45
46define i32 @main() !dbg !3 {
47entry:
48  ret i32 0, !dbg !8
49}
50
51!llvm.module.flags = !{!0}
52!llvm.dbg.cu = !{!2}
53
54!0 = !{i32 2, !"Debug Info Version", i32 3}
55!1 = !DIFile(filename: "source-file.c", directory: "/workspace")
56!2 = distinct !DICompileUnit(language: DW_LANG_C11, file: !1, producer: "clang version 18.0.0git", emissionKind: FullDebug)
57!3 = distinct !DISubprogram(name: "main", scope: !1, file: !1, line: 1, type: !4, scopeLine: 1, unit: !2, retainedNodes: !7)
58!4 = !DISubroutineType(types: !5)
59!5 = !{!6}
60!6 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
61!7 = !{}
62!8 = !DILocation(line: 1, column: 14, scope: !3)
63