]> git.proxmox.com Git - wasi-libc.git/commit - expected/wasm32-wasi-pthread/defined-symbols.txt
Optimize lseek in the `tell` case.
authorDan Gohman <sunfish@mozilla.com>
Mon, 29 Apr 2019 19:53:18 +0000 (12:53 -0700)
committerDan Gohman <sunfish@mozilla.com>
Tue, 30 Apr 2019 23:19:05 +0000 (16:19 -0700)
commitcf366c06d1fcbbff3ce2a3dbc9fb65f625ed1534
tree561bcfec73d3c838170f9e82608aa9a9fa4df067
parent9f103c288380c3d4459606e7d26f224a31ec5ce1
Optimize lseek in the `tell` case.

`lseek(x, 0, SEEK_CUR)` has no effect other than to return the current
file offset. The patch here uses a macro with `__builtin_constant_p` to
recognize this case and rewrite it to a library call that uses `fd_tell`
rather than `fd_seek`, so that programs that don't need actual seeking
don't end up importing `fd_seek`.

This is also the first usage of `__wasi_fd_tell` in WASI libc, so this
adds it to undefined-symbols.txt.
expected/wasm32-wasi/defined-symbols.txt
expected/wasm32-wasi/predefined-macros.txt
expected/wasm32-wasi/undefined-symbols.txt
libc-bottom-half/cloudlibc/src/libc/unistd/lseek.c
libc-bottom-half/headers/public/wasi/libc.h
libc-bottom-half/sources/__wasilibc_tell.c [new file with mode: 0644]
libc-top-half/musl/include/unistd.h