-
Notifications
You must be signed in to change notification settings - Fork 14.4k
[lld][WebAssembly] Return 0 for synthetic function offsets #96134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
d5ba71e
f463f91
88a48b2
ea4eb9a
6f7d8cd
607b92a
165246a
dc1ad4c
9cd6790
98d9243
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
target triple = "wasm32-unknown-emscripten" | ||
|
||
define void @foo(i32 %a) !dbg !6 { | ||
ret void | ||
} | ||
|
||
define void @test0() !dbg !10 { | ||
entry: | ||
call void @foo(i32 3), !dbg !13 | ||
ret void, !dbg !14 | ||
} | ||
|
||
!llvm.dbg.cu = !{!0} | ||
!llvm.module.flags = !{!2, !3, !4} | ||
!llvm.ident = !{!5} | ||
|
||
!0 = distinct !DICompileUnit(language: DW_LANG_C11, file: !1, producer: "clang version 19.0.0git", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, nameTableKind: None) | ||
!1 = !DIFile(filename: "a.c", directory: "") | ||
!2 = !{i32 7, !"Dwarf Version", i32 4} | ||
!3 = !{i32 2, !"Debug Info Version", i32 3} | ||
!4 = !{i32 1, !"wchar_size", i32 4} | ||
!5 = !{!"clang version 19.0.0git"} | ||
!6 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 3, type: !7, scopeLine: 3, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0) | ||
!7 = !DISubroutineType(types: !8) | ||
!8 = !{null, !9} | ||
!9 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) | ||
!10 = distinct !DISubprogram(name: "test0", scope: !1, file: !1, line: 7, type: !11, scopeLine: 7, spFlags: DISPFlagDefinition, unit: !0) | ||
!11 = !DISubroutineType(types: !12) | ||
!12 = !{null} | ||
!13 = !DILocation(line: 8, column: 3, scope: !10) | ||
!14 = !DILocation(line: 9, column: 1, scope: !10) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
target triple = "wasm32-unknown-emscripten" | ||
|
||
define void @foo(i32 %a, i32 %b) !dbg !6 { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why does this not result in a link error due to multiple definitions of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't know. They are not marked as When we do this by LTO, meaning running There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. IIUC, regardless of signature... you can't have two global definitions of foo in the same program unless one of them is weak. So I can't see why this wouldn't fail, even with matching signatures. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure why the current non-weak functions don't error out, but changed the test function linkages to be |
||
ret void | ||
} | ||
|
||
define void @test1() !dbg !10 { | ||
entry: | ||
call void @foo(i32 4, i32 5), !dbg !13 | ||
ret void, !dbg !14 | ||
} | ||
|
||
!llvm.dbg.cu = !{!0} | ||
!llvm.module.flags = !{!2, !3, !4} | ||
!llvm.ident = !{!5} | ||
|
||
!0 = distinct !DICompileUnit(language: DW_LANG_C11, file: !1, producer: "clang version 19.0.0git", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, nameTableKind: None) | ||
!1 = !DIFile(filename: "b.c", directory: "") | ||
!2 = !{i32 7, !"Dwarf Version", i32 4} | ||
!3 = !{i32 2, !"Debug Info Version", i32 3} | ||
!4 = !{i32 1, !"wchar_size", i32 4} | ||
!5 = !{!"clang version 19.0.0git"} | ||
!6 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 3, type: !7, scopeLine: 3, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0) | ||
!7 = !DISubroutineType(types: !8) | ||
!8 = !{null, !9, !9} | ||
!9 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) | ||
!10 = distinct !DISubprogram(name: "test1", scope: !1, file: !1, line: 7, type: !11, scopeLine: 7, spFlags: DISPFlagDefinition, unit: !0) | ||
!11 = !DISubroutineType(types: !12) | ||
!12 = !{null} | ||
!13 = !DILocation(line: 8, column: 3, scope: !10) | ||
!14 = !DILocation(line: 9, column: 1, scope: !10) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These tests include a lot of stuff that is perhaps not completely relevant to the bug I guess? Can we remove any of these lines that are not needed? Or is it better to keep them more like clang-generated bitcode? One thing that would be great would be if we could write this in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is what I got after I spent some time deleting unnecessary debug info already... I can further delete Can I attach debug info in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think simply converting these files to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
target triple = "wasm32-unknown-emscripten" | ||
|
||
define i32 @main() !dbg !6 { | ||
entry: | ||
call void @test0(), !dbg !10 | ||
call void @test1(), !dbg !11 | ||
ret i32 0, !dbg !12 | ||
} | ||
|
||
declare void @test0() | ||
|
||
declare void @test1() | ||
|
||
!llvm.dbg.cu = !{!0} | ||
!llvm.module.flags = !{!2, !3, !4} | ||
!llvm.ident = !{!5} | ||
|
||
!0 = distinct !DICompileUnit(language: DW_LANG_C11, file: !1, producer: "clang version 19.0.0git", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, nameTableKind: None) | ||
!1 = !DIFile(filename: "main.c", directory: "") | ||
!2 = !{i32 7, !"Dwarf Version", i32 4} | ||
!3 = !{i32 2, !"Debug Info Version", i32 3} | ||
!4 = !{i32 1, !"wchar_size", i32 4} | ||
!5 = !{!"clang version 19.0.0git"} | ||
!6 = distinct !DISubprogram(name: "main", scope: !1, file: !1, line: 4, type: !7, scopeLine: 4, spFlags: DISPFlagDefinition, unit: !0) | ||
!7 = !DISubroutineType(types: !8) | ||
!8 = !{!9} | ||
!9 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) | ||
!10 = !DILocation(line: 5, column: 3, scope: !6) | ||
!11 = !DILocation(line: 6, column: 3, scope: !6) | ||
!12 = !DILocation(line: 7, column: 3, scope: !6) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# This is a regression test that checks whether a function signature mismatch | ||
# in functions with debug info does not cause does not cause a segmentation | ||
# fault when writing .debug_info section. | ||
|
||
; RUN: llc -filetype=obj %p/Inputs/signature-mismatch-debug-info-a.ll -o %t.a.o | ||
; RUN: llc -filetype=obj %p/Inputs/signature-mismatch-debug-info-b.ll -o %t.b.o | ||
; RUN: llc -filetype=obj %p/Inputs/signature-mismatch-debug-info-main.ll -o %t.main.o | ||
; RUN: wasm-ld -o %t.wasm %t.a.o %t.b.o %t.main.o --export=main --no-entry |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why does this function have
entry:
but not the one above?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I generated these tests from
.c
file and manually removed some unnecessary parts, and I think I left someentry
s. Removed them for consistency.