[lld] [WebAssembly] Generate a call to __wasm_apply_global_tls_relocs in __wasm_init_memory (PR #149832)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 22 03:55:30 PDT 2025
Arshia001 wrote:
Well, turns out we're linking your sample module incorrectly. Need to investigate our implementation in depth now:
```c
// side.c
int foo = 1;
int bar = 2;
```
```c
// main.c
#include <stdio.h>
extern int foo;
extern int bar;
typedef struct
{
int *a;
int *b;
} my_struct;
_Thread_local my_struct s = {&foo, &bar};
int main()
{
printf("foo: %d %d, bar: %d %d, s: %p\n", *s.a, foo, *s.b, bar, &s);
return 0;
}
```
```
foo: 0 1, bar: 0 2, s: 0x240
```
https://github.com/llvm/llvm-project/pull/149832
More information about the llvm-commits
mailing list