diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td index 1b02087425b75..b8b8d47641398 100644 --- a/clang/include/clang/Driver/Options.td +++ b/clang/include/clang/Driver/Options.td @@ -5297,7 +5297,7 @@ def pthreads : Flag<["-"], "pthreads">; defm pthread : BoolOption<"", "pthread", LangOpts<"POSIXThreads">, DefaultFalse, PosFlag, - NegFlag, BothFlags<[], [ClangOption, CC1Option]>>; + NegFlag, BothFlags<[], [ClangOption, CC1Option, FlangOption]>>; def pie : Flag<["-"], "pie">, Group; def static_pie : Flag<["-"], "static-pie">, Group; def read__only__relocs : Separate<["-"], "read_only_relocs">; diff --git a/flang/test/Driver/driver-help-hidden.f90 b/flang/test/Driver/driver-help-hidden.f90 index 9a11a7a571ffc..39c607b80ddb9 100644 --- a/flang/test/Driver/driver-help-hidden.f90 +++ b/flang/test/Driver/driver-help-hidden.f90 @@ -134,6 +134,7 @@ ! CHECK-NEXT: -pedantic Warn on language extensions ! CHECK-NEXT: -print-effective-triple Print the effective target triple ! CHECK-NEXT: -print-target-triple Print the normalized target triple +! CHECK-NEXT: -pthread Support POSIX threads in generated code ! CHECK-NEXT: -P Disable linemarker output in -E mode ! CHECK-NEXT: -Rpass-analysis= Report transformation analysis from optimization passes whose name matches the given POSIX regular expression ! CHECK-NEXT: -Rpass-missed= Report missed transformations by optimization passes whose name matches the given POSIX regular expression diff --git a/flang/test/Driver/driver-help.f90 b/flang/test/Driver/driver-help.f90 index e0e74dc56f331..51c59694f1570 100644 --- a/flang/test/Driver/driver-help.f90 +++ b/flang/test/Driver/driver-help.f90 @@ -120,6 +120,7 @@ ! HELP-NEXT: -pedantic Warn on language extensions ! HELP-NEXT: -print-effective-triple Print the effective target triple ! HELP-NEXT: -print-target-triple Print the normalized target triple +! HELP-NEXT: -pthread Support POSIX threads in generated code ! HELP-NEXT: -P Disable linemarker output in -E mode ! HELP-NEXT: -Rpass-analysis= Report transformation analysis from optimization passes whose name matches the given POSIX regular expression ! HELP-NEXT: -Rpass-missed= Report missed transformations by optimization passes whose name matches the given POSIX regular expression diff --git a/flang/test/Driver/dynamic-linker.f90 b/flang/test/Driver/dynamic-linker.f90 index df119c22a2ea5..57a2af01aadff 100644 --- a/flang/test/Driver/dynamic-linker.f90 +++ b/flang/test/Driver/dynamic-linker.f90 @@ -1,7 +1,7 @@ ! Verify that certain linker flags are known to the frontend and are passed on ! to the linker. -! RUN: %flang -### --target=x86_64-linux-gnu -rpath /path/to/dir -shared \ +! RUN: %flang -### --target=x86_64-linux-gnu -rpath /path/to/dir -shared -pthread \ ! RUN: -static %s 2>&1 | FileCheck \ ! RUN: --check-prefixes=GNU-LINKER-OPTIONS %s ! RUN: %flang -### --target=x86_64-windows-msvc -rpath /path/to/dir -shared \ @@ -13,6 +13,7 @@ ! GNU-LINKER-OPTIONS-SAME: "-shared" ! GNU-LINKER-OPTIONS-SAME: "-static" ! GNU-LINKER-OPTIONS-SAME: "-rpath" "/path/to/dir" +! GNU-LINKER-OPTIONS-SAME: "-lpthread" ! For MSVC, adding -static does not add any additional linker options. ! MSVC-LINKER-OPTIONS: "{{.*}}link{{(.exe)?}}"