emscripten-core/emscripten

ALLOW_UNIMPLEMENTED_SYSCALLS doesn't exclude unsupported syscalls in autoconf

Open

#14.824 aberto em 9 de ago. de 2021

Ver no GitHub
 (4 comments) (0 reactions) (0 assignees)C++ (3.519 forks)batch import
help wanted

Métricas do repositório

Stars
 (27.361 stars)
Métricas de merge de PR
 (Mesclagem média 19d 10h) (147 fundiu PRs em 30d)

Description

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?

Guia do colaborador