`__heap_base`似乎在clang 9.0.0中丢失,有替代品吗?

问题描述 投票:0回答:2

我正在尝试使用clang(无emscripten)为WebAssembly编译我的C库,并且在clang版本8.0.1下可以正常编译,但是在clang版本9.0.0下可以正常编译。报告的错误为wasm-ld: error: ….o: undefined symbol: __heap_base__heap_base是否已替换为其他符号?

该库是开源的,编译说明可以在here中找到

c llvm llvm-clang webassembly
2个回答
0
投票

这似乎是9.0.0中的错误。 ToT或8.0.0似乎没有发生这种情况。

简单的复制案例:

extern void* __heap_base;

void* a = &__heap_base;

void _start() {
}

构建方式:

$ clang --target=wasm32 test.c -nostdlib -Wl,-no-gc-sections

使用9.0.0:

wasm-ld: error: /tmp/test-551a5c.o: undefined symbol: __heap_base
clang-9: error: linker command failed with exit code 1 (use -v to see invocation)

这应在llvm错误跟踪器中作为错误打开。


0
投票

实际上,我相信我找到了罪魁祸首:9.0.0中的链接器似乎需要--export=__heap_base-Wl,--export=__heap_baseclang)。这适用于我的项目。

© www.soinside.com 2019 - 2024. All rights reserved.