xref: /llvm-project/flang/test/Driver/pthread.f90 (revision aa440aae36474525211d02bbc0d120cc90c91cbf)
1! In release 2.34, glibc removed libpthread as a separate library. All the
2! pthread_* functions were subsumed into libc, so linking that is sufficient.
3! However, when linking against older glibc builds, the explicit link of
4! -pthread will be required. More details are here:
5!
6! https://developers.redhat.com/articles/2021/12/17/why-glibc-234-removed-libpthread#the_developer_view
7!
8! This makes it difficult to write a test that requires the -pthread flag in
9! order to pass. Checking for the presence of -lpthread in the linker flags is
10! not reliable since the linker could just skip the flag altogether if it is
11! linking against a new libc implementation.
12
13! RUN: %flang -### -pthread /dev/null -o /dev/null 2>&1 | FileCheck %s
14! RUN: %flang -### -Xflang -pthread /dev/null -o /dev/null 2>&1 | FileCheck %s
15
16! How the -pthread flag is handled is very platform-specific. A lot of that
17! functionality is tested by clang, and the flag itself is handled by clang's
18! driver that flang also uses. Instead of duplicating all that testing here,
19! just check that the presence of the flag does not raise an error. If we need
20! more customized handling of -pthread, the tests for that can be added here.
21!
22! CHECK-NOT: error:
23