The diff below updates LLVM/Clang's Driver to mimic the new link spec behavior from gcc4. Looked over by Matthew and he thinks it looks good.
Index: Makefile =================================================================== RCS file: /home/cvs/ports/devel/llvm/Makefile,v retrieving revision 1.48 diff -u -p -r1.48 Makefile --- Makefile 8 Aug 2012 09:35:24 -0000 1.48 +++ Makefile 15 Aug 2012 11:12:22 -0000 @@ -10,7 +10,7 @@ COMMENT = modular, fast C/C++/ObjC compi LLVM_V = 3.1 DISTNAME = llvm-${LLVM_V}.src PKGNAME = llvm-${LLVM_V} -REVISION = 3 +REVISION = 4 CATEGORIES = devel # packager notes in http://llvm.org/docs/Packaging.html Index: patches/patch-tools_clang_lib_Driver_Tools_cpp =================================================================== RCS file: patches/patch-tools_clang_lib_Driver_Tools_cpp diff -N patches/patch-tools_clang_lib_Driver_Tools_cpp --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-tools_clang_lib_Driver_Tools_cpp 16 Aug 2012 06:23:46 -0000 @@ -0,0 +1,30 @@ +$OpenBSD$ +--- tools/clang/lib/Driver/Tools.cpp.orig Wed Apr 18 17:32:25 2012 ++++ tools/clang/lib/Driver/Tools.cpp Thu Aug 16 02:23:30 2012 +@@ -4672,14 +4672,20 @@ void openbsd::Link::ConstructJob(Compilation &C, const + // the default system libraries. Just mimic this for now. + CmdArgs.push_back("-lgcc"); + +- if (Args.hasArg(options::OPT_pthread)) +- CmdArgs.push_back("-lpthread"); +- if (!Args.hasArg(options::OPT_shared)) { +- if (Args.hasArg(options::OPT_pg)) +- CmdArgs.push_back("-lc_p"); ++ if (Args.hasArg(options::OPT_pthread)) { ++ if (!Args.hasArg(options::OPT_shared) && ++ Args.hasArg(options::OPT_pg)) ++ CmdArgs.push_back("-lpthread_p"); + else +- CmdArgs.push_back("-lc"); ++ CmdArgs.push_back("-lpthread"); + } ++ ++ if (!Args.hasArg(options::OPT_shared) && ++ Args.hasArg(options::OPT_pg)) ++ CmdArgs.push_back("-lc_p"); ++ else ++ CmdArgs.push_back("-lc"); ++ + CmdArgs.push_back("-lgcc"); + } + -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.