Issue 153759
Summary [lld][WebAssembly] __wasm_first_page_end is wrongly relocated
Labels lld
Assignees
Reporter yamt
    test code:
```c
__attribute__((__visibility__("default")))
int
foo(void)
{
 extern char __wasm_first_page_end;
        return (int)&__wasm_first_page_end;
}
```

build:
```shell
clang -fPIC -shared -o a.so a.c
```

result:
```
  (func $foo (;3;) (type 1) (result i32)
 global.get $GOT.data.internal.__wasm_first_page_end
    return
  )
 (global $GOT.data.internal.__wasm_first_page_end (;2;) i32 global.get $__memory_base i32.const 65536 i32.add)
```
note that __memory_base is added.

w/o extended-const has the same issue:
```
  (func $__wasm_apply_global_relocs (;2;) (type 0)
    global.get $__memory_base
 i32.const 65536
    i32.add
    global.set $GOT.data.internal.__wasm_first_page_end
  )
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to