Skip to content

Support -no-pthread linking flag #20720

Description

@RReverser

Apparently Clang has a -no-pthread option. It's not very useful on most platforms (and is even broken on some llvm/llvm-project#69363) but supporting it in Emscripten could help solve a common issue with complex build system where some autoconf + libtool scripts add -pthread to the list of linker flags and they end up propagated all the way to the top linker invocation with no easy way to remove it.

If you know that the library only uses pthread condvars and similar APIs that don't really need multi-threading support, you could link with the Emscripten's pthread stub, and still get a usable, smaller, and, in some cases, even faster, Wasm binary. However, currently there is no way to selectively disable just the pthreads during the linking phase and ask for the stub instead.

Being able to do $(LD) $(LDFLAGS) -no-pthread where -no-pthread overrides a former -pthread flag would solve this issue elegantly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions