> So I wonder why
> -pthread works around the problem, considering that for linking it should
> effectively be the same as -lpthread.
I would expect the same, but it differs that -pthread is kept in:
COLLECT_GCC_OPTIONS='-O2' '-D' '_FORTIFY_SOURCE=2' '-fstack-protector-strong'
'-funwind-tables' '-fasynchronous-unwind-tables' '-fstack-clash-protection'
'-Werror=return-type' '-flto=auto' '-g' '-D'
'ICU_DATA_DIR="/usr/share/icu/67.1/"' '-Wextra' '-Wall' '-Wpedantic'
'-Wpointer-arith' '-Wwrite-strings' '-Wno-long-long' '-std=c++11' '-flto=auto'
'-shared' '-o' '../lib/libicuuc.so.67.1' '-L../lib' '-L../stubdata' '-pthread'
'-v' '-shared-libgcc' '-mtune=generic' '-march=x86-64'
and I see ld is executed with -plugin-opt=-pass-through=-lpthread
But I'm not sure why it hurts.