Paul Robinson | 78046b4 | 2015-08-11 21:36:45 +0000 | [diff] [blame] | 1 | ; DWARF linkage name attributes are optional; verify they are missing for |
| 2 | ; PS4 triple or when tuning for SCE. |
| 3 | |
| 4 | ; RUN: llc -O0 -mtriple=x86_64-unknown-unknown < %s | FileCheck %s -check-prefix LINKAGE1 |
| 5 | ; RUN: llc -O0 -mtriple=x86_64-unknown-unknown < %s | FileCheck %s -check-prefix LINKAGE2 |
| 6 | ; RUN: llc -O0 -mtriple=x86_64-scei-ps4 < %s | FileCheck %s -check-prefix NOLINKAGE |
| 7 | ; RUN: llc -O0 -mtriple=x86_64-unknown-unknown -debugger-tune=sce < %s | FileCheck %s -check-prefix NOLINKAGE |
| 8 | |
| 9 | ; $ clang++ -emit-llvm -S -g dwarf-linkage-names.cpp |
| 10 | ; namespace test { |
| 11 | ; int global_var; |
| 12 | ; int bar() { return global_var; } |
| 13 | ;}; |
| 14 | |
| 15 | ; With linkage names, we get an attribute for the declaration (first) entry |
| 16 | ; for the global variable, and one for the function. |
| 17 | |
| 18 | ; This assumes the variable will appear before the function. |
| 19 | ; LINKAGE1: .section .debug_info |
| 20 | ; LINKAGE1: DW_TAG_variable |
| 21 | ; LINKAGE1-NOT: DW_TAG |
Paul Robinson | 9c10414 | 2015-08-19 19:36:35 +0000 | [diff] [blame] | 22 | ; LINKAGE1: {{DW_AT_(MIPS_)?linkage_name}} |
Paul Robinson | 78046b4 | 2015-08-11 21:36:45 +0000 | [diff] [blame] | 23 | ; LINKAGE1: DW_TAG_subprogram |
| 24 | ; LINKAGE1-NOT: DW_TAG |
Paul Robinson | 9c10414 | 2015-08-19 19:36:35 +0000 | [diff] [blame] | 25 | ; LINKAGE1: {{DW_AT_(MIPS_)?linkage_name}} |
Paul Robinson | 78046b4 | 2015-08-11 21:36:45 +0000 | [diff] [blame] | 26 | ; LINKAGE1: .section |
| 27 | |
| 28 | ; Also verify we see the mangled names. We do this as a separate pass to |
| 29 | ; avoid depending on the order of .debug_info and .debug_str sections. |
| 30 | |
| 31 | ; LINKAGE2-DAG: .asciz "_ZN4test10global_varE" |
| 32 | ; LINKAGE2-DAG: .asciz "_ZN4test3barEv" |
| 33 | |
| 34 | ; Without linkage names, verify there aren't any linkage-name attributes, |
| 35 | ; and no mangled names. |
| 36 | |
Paul Robinson | 9c10414 | 2015-08-19 19:36:35 +0000 | [diff] [blame] | 37 | ; NOLINKAGE-NOT: {{DW_AT_(MIPS_)?linkage_name}} |
Paul Robinson | 78046b4 | 2015-08-11 21:36:45 +0000 | [diff] [blame] | 38 | ; NOLINKAGE-NOT: .asciz "_ZN4test10global_varE" |
| 39 | ; NOLINKAGE-NOT: .asciz "_ZN4test3barEv" |
| 40 | |
Adrian Prantl | 1eadba1 | 2016-12-22 00:45:21 +0000 | [diff] [blame] | 41 | source_filename = "test/DebugInfo/X86/dwarf-linkage-names.ll" |
| 42 | |
| 43 | @_ZN4test10global_varE = global i32 0, align 4, !dbg !0 |
Paul Robinson | 78046b4 | 2015-08-11 21:36:45 +0000 | [diff] [blame] | 44 | |
| 45 | ; Function Attrs: nounwind uwtable |
Adrian Prantl | 1eadba1 | 2016-12-22 00:45:21 +0000 | [diff] [blame] | 46 | define i32 @_ZN4test3barEv() #0 !dbg !11 { |
Paul Robinson | 78046b4 | 2015-08-11 21:36:45 +0000 | [diff] [blame] | 47 | entry: |
| 48 | %0 = load i32, i32* @_ZN4test10global_varE, align 4, !dbg !14 |
| 49 | ret i32 %0, !dbg !15 |
| 50 | } |
| 51 | |
serge-sans-paille | 4ab3041 | 2021-05-24 19:43:40 +0200 | [diff] [blame] | 52 | attributes #0 = { nounwind uwtable "disable-tail-calls"="false" "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+sse,+sse2" "unsafe-fp-math"="false" "use-soft-float"="false" } |
Paul Robinson | 78046b4 | 2015-08-11 21:36:45 +0000 | [diff] [blame] | 53 | |
Adrian Prantl | 1eadba1 | 2016-12-22 00:45:21 +0000 | [diff] [blame] | 54 | !llvm.dbg.cu = !{!5} |
| 55 | !llvm.module.flags = !{!8, !9} |
| 56 | !llvm.ident = !{!10} |
Paul Robinson | 78046b4 | 2015-08-11 21:36:45 +0000 | [diff] [blame] | 57 | |
Adrian Prantl | 0578221 | 2017-08-30 18:06:51 +0000 | [diff] [blame] | 58 | !0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression()) |
Adrian Prantl | 1eadba1 | 2016-12-22 00:45:21 +0000 | [diff] [blame] | 59 | !1 = !DIGlobalVariable(name: "global_var", linkageName: "_ZN4test10global_varE", scope: !2, file: !3, line: 2, type: !4, isLocal: false, isDefinition: true) |
Adrian Prantl | fed4f39 | 2017-04-28 22:25:46 +0000 | [diff] [blame] | 60 | !2 = !DINamespace(name: "test", scope: null) |
Adrian Prantl | 1eadba1 | 2016-12-22 00:45:21 +0000 | [diff] [blame] | 61 | !3 = !DIFile(filename: "dwarf-linkage-names.cpp", directory: "/home/probinson/projects/scratch") |
| 62 | !4 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed) |
| 63 | !5 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !3, producer: "clang version 3.8.0 (trunk 244662)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !6, globals: !7) |
| 64 | !6 = !{} |
| 65 | !7 = !{!0} |
| 66 | !8 = !{i32 2, !"Dwarf Version", i32 4} |
| 67 | !9 = !{i32 2, !"Debug Info Version", i32 3} |
| 68 | !10 = !{!"clang version 3.8.0 (trunk 244662)"} |
Shiva Chen | 2c86455 | 2018-05-09 02:40:45 +0000 | [diff] [blame] | 69 | !11 = distinct !DISubprogram(name: "bar", linkageName: "_ZN4test3barEv", scope: !2, file: !3, line: 3, type: !12, isLocal: false, isDefinition: true, scopeLine: 3, flags: DIFlagPrototyped, isOptimized: false, unit: !5, retainedNodes: !6) |
Adrian Prantl | 1eadba1 | 2016-12-22 00:45:21 +0000 | [diff] [blame] | 70 | !12 = !DISubroutineType(types: !13) |
| 71 | !13 = !{!4} |
| 72 | !14 = !DILocation(line: 3, column: 21, scope: !11) |
| 73 | !15 = !DILocation(line: 3, column: 14, scope: !11) |
| 74 | |