Index: lib/Driver/Tools.cpp =================================================================== --- lib/Driver/Tools.cpp +++ lib/Driver/Tools.cpp @@ -5200,8 +5200,7 @@ Args.AddAllArgs(CmdArgs, options::OPT_L); if (Args.hasArg(options::OPT_fopenmp)) - // This is more complicated in gcc... - CmdArgs.push_back("-lgomp"); + CmdArgs.push_back("-liomp5"); AddLinkerInputs(getToolChain(), Inputs, Args, CmdArgs); @@ -6797,19 +6796,13 @@ if (Args.hasArg(options::OPT_static)) CmdArgs.push_back("--start-group"); - bool OpenMP = Args.hasArg(options::OPT_fopenmp); - if (OpenMP) { - CmdArgs.push_back("-lgomp"); - - // FIXME: Exclude this for platforms with libgomp that don't require - // librt. Most modern Linux platforms require it, but some may not. - CmdArgs.push_back("-lrt"); - } + if (Args.hasArg(options::OPT_fopenmp)) + CmdArgs.push_back("-liomp5"); AddRunTimeLibs(ToolChain, D, CmdArgs, Args); if (Args.hasArg(options::OPT_pthread) || - Args.hasArg(options::OPT_pthreads) || OpenMP) + Args.hasArg(options::OPT_pthreads)) CmdArgs.push_back("-lpthread"); CmdArgs.push_back("-lc"); Index: test/OpenMP/linking.c =================================================================== --- test/OpenMP/linking.c +++ test/OpenMP/linking.c @@ -5,12 +5,12 @@ // RUN: -fopenmp -target i386-unknown-linux \ // RUN: | FileCheck --check-prefix=CHECK-LD-32 %s // CHECK-LD-32: "{{.*}}ld{{(.exe)?}}" -// CHECK-LD-32: "-lgomp" "-lrt" "-lgcc" -// CHECK-LD-32: "-lpthread" "-lc" +// CHECK-LD-32: "-liomp5" "-lgcc" +// CHECK-LD-32: "-lc" // // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ // RUN: -fopenmp -target x86_64-unknown-linux \ // RUN: | FileCheck --check-prefix=CHECK-LD-64 %s // CHECK-LD-64: "{{.*}}ld{{(.exe)?}}" -// CHECK-LD-64: "-lgomp" "-lrt" "-lgcc" -// CHECK-LD-64: "-lpthread" "-lc" +// CHECK-LD-64: "-liomp5" "-lgcc" +// CHECK-LD-64: "-lc"