emscripten-core/emscripten

ALLOW_UNIMPLEMENTED_SYSCALLS doesn't exclude unsupported syscalls in autoconf

Open

#14,824 创建于 2021年8月9日

在 GitHub 查看
 (4 评论) (0 反应) (0 负责人)C++ (3,519 fork)batch import
help wanted

仓库指标

Star
 (27,361 star)
PR 合并指标
 (平均合并 19天 10小时) (30 天内合并 147 个 PR)

描述

A program I was cross-compiling relies on pipe2. I've noticed that it was always printing a warning about pipe2 being unsupported during runtime, and always falling back to pipe.

While it's good that they left in a runtime fallback, I was wondering if there's a way to avoid compiling that unsupported code in altogether. I've noticed that they detect pipe2 with configure.ac:

AC_CHECK_FUNCS([pipe2])

When executed with Emscripten, it prints:

checking for pipe2... yes

After looking through settings, I've assumed it's because ALLOW_UNIMPLEMENTED_SYSCALLS is enabled by default, so I went ahead and changed it, but, surprisingly, now configure continued to report

checking for pipe2... yes

but the actual program fails to link due to the missing syscall.

Looking at config.log, this is the only relevant bit which seems suspicious but I don't understand how it explains why configure still manages to find the pipe2 function:

configure:17216: checking for pipe2
configure:17216: /usr/local/google/home/rreverser/emsdk/upstream/emscripten/emcc -o conftest -g -O2  -s ALLOW_UNIMPLEMENTED_SYSCALLS=0 conftest.c  >&5
wasm-ld: warning: function signature mismatch: pipe2
>>> defined as () -> i32 in /tmp/emscripten_temp_nj0l58ag/conftest_0.o
>>> defined as (i32, i32) -> i32 in /usr/local/google/home/rreverser/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/libc.a(pipe2.o)
configure:17216: $? = 0
configure:17216: result: yes

Does it try to link against wrong pipe2 function or something?

贡献者指南