[lld] wasm-ld: Implement function pointer alignment (PR #105532)

Ethan O'Brien via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 21 10:09:04 PDT 2025


ethanaobrien wrote:

You are correct, I've created a new minimal example:

```
int foo(void) {
    return 3;
}

struct test {
    int fd;
    int (*write) (void);
};
struct test testing = {
	.fd = 2,
	.write = foo,
};

int main(int argc, char **argv) {
    if (argc == 1) return (int)&testing.write;
    if (argc == 2) return (int)&foo ;
    if (argc == 3) return foo();
    else return testing.write();
```

<img width="593" height="287" alt="image" src="https://github.com/user-attachments/assets/1ba27010-97e0-4e55-800f-e0d3083fae95" />



For reference, my old main:

```C
int main() {
    FILE *f;
    f = fopen("test", "w");
    return get_write_addr(f);
}
```


I'm not too sure where I need to go from here

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


More information about the llvm-commits mailing list