test code:
__attribute__((__visibility__("default")))
int
foo(void)
{
extern char __wasm_first_page_end;
return (int)&__wasm_first_page_end;
}
build:
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
)