emscripten-core/emscripten

ALLOW_UNIMPLEMENTED_SYSCALLS doesn't exclude unsupported syscalls in autoconf

Open

#14 824 ouverte le 9 août 2021

Voir sur GitHub
 (4 commentaires) (0 réactions) (0 assignés)C++ (3 519 forks)batch import
help wanted

Métriques du dépôt

Stars
 (27 361 stars)
Métriques de merge PR
 (Merge moyen 19j 10h) (147 PRs mergées en 30 j)

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?

Guide contributeur