[lld] wasm-ld: Implement function pointer alignment (PR #105532)
Ethan O'Brien via llvm-commits
llvm-commits at lists.llvm.org
Sat Jun 14 10:43:23 PDT 2025
ethanaobrien wrote:
>It should be obivous from the disassembly if its address in the table is wrong.
It appears I was incorrect. You're right, main still fires how it should.
The issue is with apparently stdout somehow.
I have this test program `a.c`:
```c
#include <stdio.h>
int main() {
printf("Potato?\n");
return 0;
}
```
Compiled with: `EM_LLVM_ROOT=/home/ethan/git/llvm-project/build/bin emcc a.c -o a.html -Wl,--function-pointer-alignment=2 -gsource-map`
And the error appears to be tied to the call to print (or specifically, [this line](https://github.com/emscripten-core/emscripten/blob/c38fe09642e25a02dce25ad3d760f4203940e527/system/lib/libc/musl/src/stdio/fwrite.c#L16))

Or similar happens if attempting to write data to a file:

https://github.com/emscripten-core/emscripten/blob/c38fe09642e25a02dce25ad3d760f4203940e527/system/lib/libc/musl/src/stdio/fflush.c#L29
What I dont understand is why changing the index of the first function broke this?
https://github.com/llvm/llvm-project/pull/105532
More information about the llvm-commits
mailing list