1; RUN: llc -filetype=obj %s -o - | llvm-readobj -r - | FileCheck %s 2 3; Test for PR50408. Compiled from: 4; char a(); 5; template <typename, char b()> 6; void f() { b(); } 7; void g() { f<char, a>(); } 8 9; CHECK: Section (10) .debug_addr 10; CHECK-NEXT: 0x8 R_WASM_FUNCTION_OFFSET_I32 _Z1gv 0 11; CHECK-NEXT: 0xC R_WASM_FUNCTION_OFFSET_I32 _Z1fIcXadL_Z1avEEEvv 0 12; ensure that the reloc type is correct for _Z1av which is undefined 13; CHECK-NEXT: 0x10 R_WASM_FUNCTION_OFFSET_I32 _Z1av 0 14; CHECK-NEXT: } 15 16; ModuleID = 'PR50408.cc' 17source_filename = "PR50408.cc" 18target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128-ni:1" 19target triple = "wasm32-unknown-emscripten" 20 21$_Z1fIcXadL_Z1avEEEvv = comdat any 22 23; Function Attrs: noinline optnone mustprogress 24define hidden void @_Z1gv() #0 !dbg !7 { 25entry: 26 call void @_Z1fIcXadL_Z1avEEEvv(), !dbg !10 27 ret void, !dbg !11 28} 29 30; Function Attrs: noinline optnone mustprogress 31define linkonce_odr hidden void @_Z1fIcXadL_Z1avEEEvv() #0 comdat !dbg !12 { 32entry: 33 %call = call signext i8 @_Z1av(), !dbg !20 34 ret void, !dbg !21 35} 36 37declare signext i8 @_Z1av() #1 38 39attributes #0 = { noinline optnone mustprogress "frame-pointer"="none" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="generic" } 40attributes #1 = { "frame-pointer"="none" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="generic" } 41 42!llvm.dbg.cu = !{!0} 43!llvm.module.flags = !{!3, !4, !5} 44!llvm.ident = !{!6} 45 46!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "clang version 13.0.0 (https://github.com/llvm/llvm-project.git 5027637fa1d409e3ca78dab60dc2e2db6c62c175)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, splitDebugInlining: false, nameTableKind: None) 47!1 = !DIFile(filename: "PR50408.cc", directory: "/s/emr/emscripten-releases/localtests", checksumkind: CSK_MD5, checksum: "285a5682ae46dbbe90ccfb84cdef66c7") 48!2 = !{} 49!3 = !{i32 7, !"Dwarf Version", i32 5} 50!4 = !{i32 2, !"Debug Info Version", i32 3} 51!5 = !{i32 1, !"wchar_size", i32 4} 52!6 = !{!"clang version 13.0.0 (https://github.com/llvm/llvm-project.git 5027637fa1d409e3ca78dab60dc2e2db6c62c175)"} 53!7 = distinct !DISubprogram(name: "g", linkageName: "_Z1gv", scope: !1, file: !1, line: 5, type: !8, scopeLine: 5, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !2) 54!8 = !DISubroutineType(types: !9) 55!9 = !{null} 56!10 = !DILocation(line: 5, column: 12, scope: !7) 57!11 = !DILocation(line: 5, column: 26, scope: !7) 58!12 = distinct !DISubprogram(name: "f<char, &a>", linkageName: "_Z1fIcXadL_Z1avEEEvv", scope: !1, file: !1, line: 4, type: !8, scopeLine: 4, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, templateParams: !13, retainedNodes: !2) 59!13 = !{!14, !16} 60!14 = !DITemplateTypeParameter(type: !15) 61!15 = !DIBasicType(name: "char", size: 8, encoding: DW_ATE_signed_char) 62!16 = !DITemplateValueParameter(name: "b", type: !17, value: ptr @_Z1av) 63!17 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !18, size: 32) 64!18 = !DISubroutineType(types: !19) 65!19 = !{!15} 66!20 = !DILocation(line: 4, column: 12, scope: !12) 67!21 = !DILocation(line: 4, column: 17, scope: !12) 68