[lld] [lld][WebAssembly] Return 0 for synthetic function offsets (PR #96134)

Heejin Ahn via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 19 19:54:42 PDT 2024


aheejin wrote:

> Nice work finding this! Do you know what C/C++ is needed to reproduce?

a.c:
```c
void foo(int a) {}
void test0() {
  foo(3);
}
```
b.c:
```c
void foo(int a, int b) {}
void test1() {
  foo(4, 5);
}
```
main.c:
```c
void test0();
void test1();
int main() {
  test0();
  test1();
  return 0;
}
```
And I manually removed instructions and debug info that were not necessary in the generated files.

> i.e. why haven't we seen it before?

I'm not very sure. This happens when all of these are satisfied:
1. There is a signature mismatch warning
2. The 'stub' function containing `unreachable` has a callsite, meaning it isn't DCE'd
3. `.debug_info` section is generated (i.e., DWARF is used)

I'm not sure how easy or hard to meet all three conditions.

https://github.com/llvm/llvm-project/pull/96134


More information about the llvm-commits mailing list