On 05/06/18 11:38, Brian Callahan wrote:

On 05/05/18 08:42, Brian Callahan wrote:

On 05/02/18 00:41, Brian Callahan wrote:
Hi ports --

Finally got flang fixed for llvm-6.
It requires a new sub-port, lang/flang/libpgmath, the new Fortran math library that comes with flang6.

New sub-port + diff for the other 2 sub-ports attached.
Passes the NIST Fortran 77 test suite (get a copy here: http://www.fortran-2000.com/ArnaudRecipes/fcvs21_f95.html)

OK?

~Brian


Flang has been updated in the meantime, new patch/tarball.

~Brian


If it makes reviewing easier, this update of flang does not depend on the libaio_compat port I sent out. We'll handle that after this goes in, not before. I'd like to see flang unbroken so I can move on to adding arm64 support.

In the meantime meantime, flang has been updated again. Since I'm already here, now includes patches to allow flang6 to link with lld and have programs compiled with it also link with lld.

~Brian

Index: Makefile
===================================================================
RCS file: /cvs/ports/lang/flang/Makefile,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 Makefile
--- Makefile	31 Dec 2017 18:06:38 -0000	1.1.1.1
+++ Makefile	9 May 2018 16:03:53 -0000
@@ -3,5 +3,6 @@
 SUBDIR =
 SUBDIR += driver
 SUBDIR += flang
+SUBDIR += libpgmath
 
 .include <bsd.port.subdir.mk>
Index: Makefile.inc
===================================================================
RCS file: /cvs/ports/lang/flang/Makefile.inc,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 Makefile.inc
--- Makefile.inc	31 Dec 2017 18:06:38 -0000	1.1.1.1
+++ Makefile.inc	9 May 2018 16:03:53 -0000
@@ -12,6 +12,7 @@ GH_ACCOUNT ?=	flang-compiler
 
 # driver: BSD
 # flang: Apache 2.0 (will become BSD once integrated into LLVM)
+# libpgmath: Apache 2.0 (will become BSD once integrated into LLVM)
 PERMIT_PACKAGE_CDROM =	Yes
 
 NO_TEST ?=	Yes
Index: driver/Makefile
===================================================================
RCS file: /cvs/ports/lang/flang/driver/Makefile,v
retrieving revision 1.4
diff -u -p -r1.4 Makefile
--- driver/Makefile	7 Apr 2018 14:58:18 -0000	1.4
+++ driver/Makefile	9 May 2018 16:03:53 -0000
@@ -1,15 +1,13 @@
 # $OpenBSD: Makefile,v 1.4 2018/04/07 14:58:18 ajacoutot Exp $
 
-BROKEN =	needs work for LLVM 6.0
-
 # If you are updating to a new version
-# (e.g. 5.0->5.1 or 6.0), you need to sync
+# (e.g. 6.0->6.1 or 7.0), you need to sync
 # patches with devel/llvm
 COMMENT =	LLVM Fortran compiler driver
-DISTNAME =	flang-driver-5.0.1.20180308
+DISTNAME =	flang-driver-6.0.0.20180416
 
 GH_PROJECT =	flang-driver
-GH_COMMIT =	095de1354dd583b0cd4c7a91d5c328710a1a9c32
+GH_COMMIT =	ccd507ca383f2122b2c5510aac0f7393f440398a
 
 WANTLIB += ${COMPILER_LIBCXX} c m z
 
Index: driver/distinfo
===================================================================
RCS file: /cvs/ports/lang/flang/driver/distinfo,v
retrieving revision 1.3
diff -u -p -r1.3 distinfo
--- driver/distinfo	13 Mar 2018 02:46:44 -0000	1.3
+++ driver/distinfo	9 May 2018 16:03:53 -0000
@@ -1,2 +1,2 @@
-SHA256 (flang-driver-5.0.1.20180308-095de135.tar.gz) = 075nJLft1rXgOM+TEzWUVYodhbg7QbKo5mF5BKuaF84=
-SIZE (flang-driver-5.0.1.20180308-095de135.tar.gz) = 16017829
+SHA256 (flang-driver-6.0.0.20180416-ccd507ca.tar.gz) = a+XxP6BYrHFYQRFKdqyVUHezzqujZMed11JmyctKeg0=
+SIZE (flang-driver-6.0.0.20180416-ccd507ca.tar.gz) = 16780237
Index: driver/patches/patch-include_clang_Basic_DiagnosticSemaKinds_td
===================================================================
RCS file: /cvs/ports/lang/flang/driver/patches/patch-include_clang_Basic_DiagnosticSemaKinds_td,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 patch-include_clang_Basic_DiagnosticSemaKinds_td
--- driver/patches/patch-include_clang_Basic_DiagnosticSemaKinds_td	31 Dec 2017 18:06:38 -0000	1.1.1.1
+++ driver/patches/patch-include_clang_Basic_DiagnosticSemaKinds_td	9 May 2018 16:03:53 -0000
@@ -3,7 +3,7 @@ $OpenBSD: patch-include_clang_Basic_Diag
 Index: include/clang/Basic/DiagnosticSemaKinds.td
 --- include/clang/Basic/DiagnosticSemaKinds.td.orig
 +++ include/clang/Basic/DiagnosticSemaKinds.td
-@@ -5810,7 +5810,7 @@ def warn_pointer_indirection_from_incompatible_type : 
+@@ -5879,7 +5879,7 @@ def warn_pointer_indirection_from_incompatible_type : 
    InGroup<UndefinedReinterpretCast>, DefaultIgnore;
  def warn_taking_address_of_packed_member : Warning<
    "taking address of packed member %0 of class or structure %q1 may result in an unaligned pointer value">,
@@ -12,7 +12,7 @@ Index: include/clang/Basic/DiagnosticSem
  
  def err_objc_object_assignment : Error<
    "cannot assign to class object (%0 invalid)">;
-@@ -6747,7 +6747,7 @@ def ext_typecheck_convert_incompatible_pointer_sign : 
+@@ -6838,7 +6838,7 @@ def ext_typecheck_convert_incompatible_pointer_sign : 
    "sending to parameter of different type}0,1"
    "|%diff{casting $ to type $|casting between types}0,1}2"
    " converts between pointers to integer types with different sign">,
Index: driver/patches/patch-include_clang_Driver_Options_td
===================================================================
RCS file: /cvs/ports/lang/flang/driver/patches/patch-include_clang_Driver_Options_td,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 patch-include_clang_Driver_Options_td
--- driver/patches/patch-include_clang_Driver_Options_td	31 Dec 2017 18:06:38 -0000	1.1.1.1
+++ driver/patches/patch-include_clang_Driver_Options_td	9 May 2018 16:03:53 -0000
@@ -3,7 +3,7 @@ $OpenBSD: patch-include_clang_Driver_Opt
 Index: include/clang/Driver/Options.td
 --- include/clang/Driver/Options.td.orig
 +++ include/clang/Driver/Options.td
-@@ -2166,7 +2166,7 @@ def pthreads : Flag<["-"], "pthreads">;
+@@ -2169,7 +2169,7 @@ def pthreads : Flag<["-"], "pthreads">;
  def pthread : Flag<["-"], "pthread">, Flags<[CC1Option]>,
    HelpText<"Support POSIX threads in generated code">;
  def no_pthread : Flag<["-"], "no-pthread">, Flags<[CC1Option]>;
Index: driver/patches/patch-include_clang_Sema_Sema_h
===================================================================
RCS file: /cvs/ports/lang/flang/driver/patches/patch-include_clang_Sema_Sema_h,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 patch-include_clang_Sema_Sema_h
--- driver/patches/patch-include_clang_Sema_Sema_h	31 Dec 2017 18:06:38 -0000	1.1.1.1
+++ driver/patches/patch-include_clang_Sema_Sema_h	9 May 2018 16:03:53 -0000
@@ -3,7 +3,7 @@ $OpenBSD: patch-include_clang_Sema_Sema_
 Index: include/clang/Sema/Sema.h
 --- include/clang/Sema/Sema.h.orig
 +++ include/clang/Sema/Sema.h
-@@ -10255,6 +10255,7 @@ class Sema { (public)
+@@ -10361,6 +10361,7 @@ class Sema { (public)
      FST_FreeBSDKPrintf,
      FST_OSTrace,
      FST_OSLog,
Index: driver/patches/patch-lib_Driver_ToolChains_Arch_AArch64_cpp
===================================================================
RCS file: /cvs/ports/lang/flang/driver/patches/patch-lib_Driver_ToolChains_Arch_AArch64_cpp,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 patch-lib_Driver_ToolChains_Arch_AArch64_cpp
--- driver/patches/patch-lib_Driver_ToolChains_Arch_AArch64_cpp	31 Dec 2017 18:06:38 -0000	1.1.1.1
+++ driver/patches/patch-lib_Driver_ToolChains_Arch_AArch64_cpp	9 May 2018 16:03:53 -0000
@@ -3,7 +3,7 @@ $OpenBSD: patch-lib_Driver_ToolChains_Ar
 Index: lib/Driver/ToolChains/Arch/AArch64.cpp
 --- lib/Driver/ToolChains/Arch/AArch64.cpp.orig
 +++ lib/Driver/ToolChains/Arch/AArch64.cpp
-@@ -145,7 +145,8 @@ getAArch64MicroArchFeaturesFromMcpu(const Driver &D, S
+@@ -149,7 +149,8 @@ getAArch64MicroArchFeaturesFromMcpu(const Driver &D, S
    return getAArch64MicroArchFeaturesFromMtune(D, CPU, Args, Features);
  }
  
@@ -13,7 +13,7 @@ Index: lib/Driver/ToolChains/Arch/AArch6
                                         std::vector<StringRef> &Features) {
    Arg *A;
    bool success = true;
-@@ -187,9 +188,11 @@ void aarch64::getAArch64TargetFeatures(const Driver &D
+@@ -191,9 +192,11 @@ void aarch64::getAArch64TargetFeatures(const Driver &D
    }
  
    if (Arg *A = Args.getLastArg(options::OPT_mno_unaligned_access,
Index: driver/patches/patch-lib_Driver_ToolChains_Clang_cpp
===================================================================
RCS file: /cvs/ports/lang/flang/driver/patches/patch-lib_Driver_ToolChains_Clang_cpp,v
retrieving revision 1.2
diff -u -p -r1.2 patch-lib_Driver_ToolChains_Clang_cpp
--- driver/patches/patch-lib_Driver_ToolChains_Clang_cpp	5 Feb 2018 04:08:24 -0000	1.2
+++ driver/patches/patch-lib_Driver_ToolChains_Clang_cpp	9 May 2018 16:03:53 -0000
@@ -3,7 +3,7 @@ $OpenBSD: patch-lib_Driver_ToolChains_Cl
 Index: lib/Driver/ToolChains/Clang.cpp
 --- lib/Driver/ToolChains/Clang.cpp.orig
 +++ lib/Driver/ToolChains/Clang.cpp
-@@ -342,7 +342,7 @@ static void getTargetFeatures(const ToolChain &TC, con
+@@ -332,7 +332,7 @@ static void getTargetFeatures(const ToolChain &TC, con
      break;
    case llvm::Triple::aarch64:
    case llvm::Triple::aarch64_be:
@@ -12,11 +12,11 @@ Index: lib/Driver/ToolChains/Clang.cpp
      break;
    case llvm::Triple::x86:
    case llvm::Triple::x86_64:
-@@ -2308,9 +2308,12 @@ void Clang::ConstructJob(Compilation &C, const JobActi
+@@ -3362,9 +3362,12 @@ void Clang::ConstructJob(Compilation &C, const JobActi
        OFastEnabled ? options::OPT_Ofast : options::OPT_fstrict_aliasing;
    // We turn strict aliasing off by default if we're in CL mode, since MSVC
    // doesn't do any TBAA.
--  bool TBAAOnByDefault = !getToolChain().getDriver().IsCLMode();
+-  bool TBAAOnByDefault = !D.IsCLMode();
 +  bool StrictAliasingDefault = !getToolChain().getDriver().IsCLMode();
 +  // We also turn off strict aliasing on OpenBSD.
 +  if (getToolChain().getTriple().isOSOpenBSD())
@@ -27,7 +27,7 @@ Index: lib/Driver/ToolChains/Clang.cpp
      CmdArgs.push_back("-relaxed-aliasing");
    if (!Args.hasFlag(options::OPT_fstruct_path_tbaa,
                      options::OPT_fno_struct_path_tbaa))
-@@ -3296,7 +3299,8 @@ void Clang::ConstructJob(Compilation &C, const JobActi
+@@ -3950,7 +3953,8 @@ void Clang::ConstructJob(Compilation &C, const JobActi
                                        options::OPT_fno_strict_overflow)) {
      if (A->getOption().matches(options::OPT_fno_strict_overflow))
        CmdArgs.push_back("-fwrapv");
@@ -37,22 +37,22 @@ Index: lib/Driver/ToolChains/Clang.cpp
  
    if (Arg *A = Args.getLastArg(options::OPT_freroll_loops,
                                 options::OPT_fno_reroll_loops))
-@@ -4232,6 +4236,18 @@ void Clang::ConstructJob(Compilation &C, const JobActi
-       CmdArgs.push_back("-fno-builtin-strcpy");
-   }
+@@ -4781,6 +4785,18 @@ ObjCRuntime Clang::AddObjCRuntimeArgs(const ArgList &a
+ #else
+       unsigned nonFragileABIVersion = 2;
  #endif
 +
 +  // Disable some builtins on OpenBSD because they are just not
 +  // right...
 +  if (getToolChain().getTriple().isOSOpenBSD()) { 
-+    CmdArgs.push_back("-fno-builtin-malloc");
-+    CmdArgs.push_back("-fno-builtin-calloc");
-+    CmdArgs.push_back("-fno-builtin-realloc");
-+    CmdArgs.push_back("-fno-builtin-valloc");
-+    CmdArgs.push_back("-fno-builtin-free");
-+    CmdArgs.push_back("-fno-builtin-strdup");
-+    CmdArgs.push_back("-fno-builtin-strndup");
++    cmdArgs.push_back("-fno-builtin-malloc");
++    cmdArgs.push_back("-fno-builtin-calloc");
++    cmdArgs.push_back("-fno-builtin-realloc");
++    cmdArgs.push_back("-fno-builtin-valloc");
++    cmdArgs.push_back("-fno-builtin-free");
++    cmdArgs.push_back("-fno-builtin-strdup");
++    cmdArgs.push_back("-fno-builtin-strndup");
 +  }
  
-   bool RewriteImports = Args.hasFlag(options::OPT_frewrite_imports,
-                                      options::OPT_fno_rewrite_imports, false);
+       if (Arg *abiArg =
+               args.getLastArg(options::OPT_fobjc_nonfragile_abi_version_EQ)) {
Index: driver/patches/patch-lib_Driver_ToolChains_CommonArgs_cpp
===================================================================
RCS file: driver/patches/patch-lib_Driver_ToolChains_CommonArgs_cpp
diff -N driver/patches/patch-lib_Driver_ToolChains_CommonArgs_cpp
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ driver/patches/patch-lib_Driver_ToolChains_CommonArgs_cpp	9 May 2018 16:03:53 -0000
@@ -0,0 +1,23 @@
+$OpenBSD$
+
+Appease lld.
+
+Index: lib/Driver/ToolChains/CommonArgs.cpp
+--- lib/Driver/ToolChains/CommonArgs.cpp.orig
++++ lib/Driver/ToolChains/CommonArgs.cpp
+@@ -183,6 +183,7 @@ void tools::AddLinkerInputs(const ToolChain &TC, const
+     // Add Fortan "main" before the first linker input
+     if (!SeenFirstLinkerInput) {
+       if (needFortranMain(D, Args)) {
++        CmdArgs.push_back("-lflangrti");
+         CmdArgs.push_back("-lflangmain");
+       }
+       SeenFirstLinkerInput = true;
+@@ -206,6 +207,7 @@ void tools::AddLinkerInputs(const ToolChain &TC, const
+   }
+ 
+   if (!SeenFirstLinkerInput && needFortranMain(D, Args)) {
++    CmdArgs.push_back("-lflangrti");
+     CmdArgs.push_back("-lflangmain");
+   }
+ 
Index: driver/patches/patch-lib_Driver_ToolChains_Gnu_cpp
===================================================================
RCS file: /cvs/ports/lang/flang/driver/patches/patch-lib_Driver_ToolChains_Gnu_cpp,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 patch-lib_Driver_ToolChains_Gnu_cpp
--- driver/patches/patch-lib_Driver_ToolChains_Gnu_cpp	31 Dec 2017 18:06:38 -0000	1.1.1.1
+++ driver/patches/patch-lib_Driver_ToolChains_Gnu_cpp	9 May 2018 16:03:53 -0000
@@ -3,7 +3,7 @@ $OpenBSD: patch-lib_Driver_ToolChains_Gn
 Index: lib/Driver/ToolChains/Gnu.cpp
 --- lib/Driver/ToolChains/Gnu.cpp.orig
 +++ lib/Driver/ToolChains/Gnu.cpp
-@@ -2345,6 +2345,9 @@ bool Generic_GCC::IsIntegratedAssemblerDefault() const
+@@ -2253,6 +2253,9 @@ bool Generic_GCC::IsIntegratedAssemblerDefault() const
    case llvm::Triple::systemz:
    case llvm::Triple::mips:
    case llvm::Triple::mipsel:
@@ -13,7 +13,7 @@ Index: lib/Driver/ToolChains/Gnu.cpp
      return true;
    case llvm::Triple::mips64:
    case llvm::Triple::mips64el:
-@@ -2352,7 +2355,8 @@ bool Generic_GCC::IsIntegratedAssemblerDefault() const
+@@ -2260,7 +2263,8 @@ bool Generic_GCC::IsIntegratedAssemblerDefault() const
      // identify the ABI in use (Debian) or only use N64 for MIPS64 (Android).
      // Other targets are unable to distinguish N32 from N64.
      if (getTriple().getEnvironment() == llvm::Triple::GNUABI64 ||
Index: driver/patches/patch-lib_Driver_ToolChains_OpenBSD_cpp
===================================================================
RCS file: /cvs/ports/lang/flang/driver/patches/patch-lib_Driver_ToolChains_OpenBSD_cpp,v
retrieving revision 1.2
diff -u -p -r1.2 patch-lib_Driver_ToolChains_OpenBSD_cpp
--- driver/patches/patch-lib_Driver_ToolChains_OpenBSD_cpp	5 Feb 2018 04:08:24 -0000	1.2
+++ driver/patches/patch-lib_Driver_ToolChains_OpenBSD_cpp	9 May 2018 16:03:53 -0000
@@ -11,7 +11,7 @@ Index: lib/Driver/ToolChains/OpenBSD.cpp
  #include "clang/Driver/Options.h"
  #include "llvm/Option/ArgList.h"
  
-@@ -165,16 +166,22 @@ void openbsd::Linker::ConstructJob(Compilation &C, con
+@@ -165,16 +166,23 @@ void openbsd::Linker::ConstructJob(Compilation &C, con
      }
    }
  
@@ -36,11 +36,12 @@ Index: lib/Driver/ToolChains/OpenBSD.cpp
 +  }
 +
 +  CmdArgs.push_back(Args.MakeArgString("-L${LOCALBASE}/lib"));
++  CmdArgs.push_back(Args.MakeArgString("-L/usr/lib"));
 +
    AddLinkerInputs(getToolChain(), Inputs, Args, CmdArgs, JA);
  
    if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs)) {
-@@ -188,8 +195,13 @@ void openbsd::Linker::ConstructJob(Compilation &C, con
+@@ -189,8 +197,14 @@ void openbsd::Linker::ConstructJob(Compilation &C, con
  
      // FIXME: For some reason GCC passes -lgcc before adding
      // the default system libraries. Just mimic this for now.
@@ -50,12 +51,13 @@ Index: lib/Driver/ToolChains/OpenBSD.cpp
 +    else
 +      CmdArgs.push_back("-lgcc");
  
++    CmdArgs.push_back("-lpgmath");
 +    CmdArgs.push_back("-lflang");
 +
      if (Args.hasArg(options::OPT_pthread)) {
        if (!Args.hasArg(options::OPT_shared) && Args.hasArg(options::OPT_pg))
          CmdArgs.push_back("-lpthread_p");
-@@ -204,7 +216,10 @@ void openbsd::Linker::ConstructJob(Compilation &C, con
+@@ -205,7 +219,10 @@ void openbsd::Linker::ConstructJob(Compilation &C, con
          CmdArgs.push_back("-lc");
      }
  
@@ -67,7 +69,7 @@ Index: lib/Driver/ToolChains/OpenBSD.cpp
    }
  
    if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nostartfiles)) {
-@@ -225,8 +240,7 @@ void openbsd::Linker::ConstructJob(Compilation &C, con
+@@ -226,8 +243,7 @@ void openbsd::Linker::ConstructJob(Compilation &C, con
  OpenBSD::OpenBSD(const Driver &D, const llvm::Triple &Triple,
                   const ArgList &Args)
      : Generic_ELF(D, Triple, Args) {
@@ -77,7 +79,7 @@ Index: lib/Driver/ToolChains/OpenBSD.cpp
  }
  
  Tool *OpenBSD::buildAssembler() const {
-@@ -234,3 +248,62 @@ Tool *OpenBSD::buildAssembler() const {
+@@ -235,3 +251,62 @@ Tool *OpenBSD::buildAssembler() const {
  }
  
  Tool *OpenBSD::buildLinker() const { return new tools::openbsd::Linker(*this); }
Index: driver/patches/patch-lib_Sema_SemaChecking_cpp
===================================================================
RCS file: /cvs/ports/lang/flang/driver/patches/patch-lib_Sema_SemaChecking_cpp,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 patch-lib_Sema_SemaChecking_cpp
--- driver/patches/patch-lib_Sema_SemaChecking_cpp	31 Dec 2017 18:06:38 -0000	1.1.1.1
+++ driver/patches/patch-lib_Sema_SemaChecking_cpp	9 May 2018 16:03:53 -0000
@@ -3,7 +3,7 @@ $OpenBSD: patch-lib_Sema_SemaChecking_cp
 Index: lib/Sema/SemaChecking.cpp
 --- lib/Sema/SemaChecking.cpp.orig
 +++ lib/Sema/SemaChecking.cpp
-@@ -4901,7 +4901,7 @@ checkFormatStringExpr(Sema &S, const Expr *E, ArrayRef
+@@ -5136,7 +5136,7 @@ checkFormatStringExpr(Sema &S, const Expr *E, ArrayRef
  Sema::FormatStringType Sema::GetFormatStringType(const FormatAttr *Format) {
    return llvm::StringSwitch<FormatStringType>(Format->getType()->getName())
        .Case("scanf", FST_Scanf)
@@ -12,7 +12,7 @@ Index: lib/Sema/SemaChecking.cpp
        .Cases("NSString", "CFString", FST_NSString)
        .Case("strftime", FST_Strftime)
        .Case("strfmon", FST_Strfmon)
-@@ -4998,6 +4998,7 @@ bool Sema::CheckFormatArguments(ArrayRef<const Expr *>
+@@ -5233,6 +5233,7 @@ bool Sema::CheckFormatArguments(ArrayRef<const Expr *>
      case FST_Kprintf:
      case FST_FreeBSDKPrintf:
      case FST_Printf:
@@ -20,7 +20,7 @@ Index: lib/Sema/SemaChecking.cpp
        Diag(FormatLoc, diag::note_format_security_fixit)
          << FixItHint::CreateInsertion(FormatLoc, "\"%s\", ");
        break;
-@@ -6539,8 +6540,9 @@ static void CheckFormatString(Sema &S, const FormatStr
+@@ -6777,8 +6778,9 @@ static void CheckFormatString(Sema &S, const FormatStr
    }
  
    if (Type == Sema::FST_Printf || Type == Sema::FST_NSString ||
@@ -32,7 +32,7 @@ Index: lib/Sema/SemaChecking.cpp
      CheckPrintfHandler H(
          S, FExpr, OrigFormatExpr, Type, firstDataArg, numDataArgs,
          (Type == Sema::FST_NSString || Type == Sema::FST_OSTrace), Str,
-@@ -6550,7 +6552,7 @@ static void CheckFormatString(Sema &S, const FormatStr
+@@ -6788,7 +6790,7 @@ static void CheckFormatString(Sema &S, const FormatStr
      if (!analyze_format_string::ParsePrintfString(H, Str, Str + StrLen,
                                                    S.getLangOpts(),
                                                    S.Context.getTargetInfo(),
Index: driver/patches/patch-lib_Sema_SemaDeclAttr_cpp
===================================================================
RCS file: /cvs/ports/lang/flang/driver/patches/patch-lib_Sema_SemaDeclAttr_cpp,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 patch-lib_Sema_SemaDeclAttr_cpp
--- driver/patches/patch-lib_Sema_SemaDeclAttr_cpp	31 Dec 2017 18:06:38 -0000	1.1.1.1
+++ driver/patches/patch-lib_Sema_SemaDeclAttr_cpp	9 May 2018 16:03:53 -0000
@@ -3,7 +3,7 @@ $OpenBSD: patch-lib_Sema_SemaDeclAttr_cp
 Index: lib/Sema/SemaDeclAttr.cpp
 --- lib/Sema/SemaDeclAttr.cpp.orig
 +++ lib/Sema/SemaDeclAttr.cpp
-@@ -3168,6 +3168,7 @@ static FormatAttrKind getFormatAttrKind(StringRef Form
+@@ -3206,6 +3206,7 @@ static FormatAttrKind getFormatAttrKind(StringRef Form
        .Case("freebsd_kprintf", SupportedFormat) // FreeBSD.
        .Case("os_trace", SupportedFormat)
        .Case("os_log", SupportedFormat)
Index: flang/Makefile
===================================================================
RCS file: /cvs/ports/lang/flang/flang/Makefile,v
retrieving revision 1.10
diff -u -p -r1.10 Makefile
--- flang/Makefile	7 Apr 2018 14:58:18 -0000	1.10
+++ flang/Makefile	9 May 2018 16:03:53 -0000
@@ -1,18 +1,16 @@
 # $OpenBSD: Makefile,v 1.10 2018/04/07 14:58:18 ajacoutot Exp $
 
-BROKEN =	needs an update
-
 COMMENT =	LLVM Fortran compiler passes and runtime library
-DISTNAME =	flang-5.0.1.20180308
+DISTNAME =	flang-6.0.0.20180507
 
-SHARED_LIBS +=	flang                     0.0 # 5.0
-SHARED_LIBS +=	flangrti                  0.0 # 5.0
-SHARED_LIBS +=	ompstub                   0.0 # 5.0
+SHARED_LIBS +=	flang                     1.0 # 6.0
+SHARED_LIBS +=	flangrti                  1.0 # 6.0
+SHARED_LIBS +=	ompstub                   0.0 # 6.0
 
 GH_PROJECT =	flang
-GH_COMMIT =	e8123d1aa7882ea996851133b77ef17f1ec0e51d
+GH_COMMIT =	79dced4b9be4bb20f25ea5ebbb5cb61b1626f0c1
 
-WANTLIB += c execinfo m pthread
+WANTLIB += c execinfo m pgmath pthread
 
 # C11
 COMPILER =	base-clang ports-gcc ports-clang
@@ -22,16 +20,19 @@ MODULES =	devel/cmake
 BUILD_DEPENDS =	devel/llvm \
 		${RUN_DEPENDS}
 
-LIB_DEPENDS =	devel/libexecinfo
+LIB_DEPENDS =	devel/libexecinfo \
+		lang/flang/libpgmath
 
 RUN_DEPENDS =	lang/flang/driver
 
 # Fortran support has not been integrated into Ninja yet
 USE_NINJA =	No
 
+# CONFIGURE_ENV is to appease lld
 CONFIGURE_ARGS =	-DCMAKE_Fortran_COMPILER="${LOCALBASE}/bin/flang" \
 			-DFLANG_LIBEXECINFO="${LOCALBASE}/lib/libexecinfo.a" \
 			-DFLANG_LIBOMP="${WRKBUILD}/lib/libompstub.a" \
+			-DLIBPGMATH="${LOCALBASE}/lib/libpgmath.a" \
 			-DWITH_WERROR=OFF
 
 post-patch:
Index: flang/distinfo
===================================================================
RCS file: /cvs/ports/lang/flang/flang/distinfo,v
retrieving revision 1.8
diff -u -p -r1.8 distinfo
--- flang/distinfo	13 Mar 2018 02:46:44 -0000	1.8
+++ flang/distinfo	9 May 2018 16:03:53 -0000
@@ -1,2 +1,2 @@
-SHA256 (flang-5.0.1.20180308-e8123d1a.tar.gz) = 9EC3ndBcpkmri8yHk8BE3cwgxgPHOzZ1bpmnr7MneEQ=
-SIZE (flang-5.0.1.20180308-e8123d1a.tar.gz) = 3952311
+SHA256 (flang-6.0.0.20180507-79dced4b.tar.gz) = keJ0hVHHIbNjiqCQeAsVs6BJ5Fiw5ioql5AdtsK3GSE=
+SIZE (flang-6.0.0.20180507-79dced4b.tar.gz) = 4508822
Index: flang/patches/patch-CMakeLists_txt
===================================================================
RCS file: /cvs/ports/lang/flang/flang/patches/patch-CMakeLists_txt,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 patch-CMakeLists_txt
--- flang/patches/patch-CMakeLists_txt	31 Dec 2017 18:06:38 -0000	1.1.1.1
+++ flang/patches/patch-CMakeLists_txt	9 May 2018 16:03:53 -0000
@@ -5,7 +5,7 @@ Add OpenBSD/amd64
 Index: CMakeLists.txt
 --- CMakeLists.txt.orig
 +++ CMakeLists.txt
-@@ -51,6 +51,15 @@ if( ${TARGET_OS} STREQUAL "Linux" )
+@@ -49,6 +49,15 @@ if( ${TARGET_OS} STREQUAL "Linux" )
      message("Unsupported architecture: ${TARGET_ARCHITECTURE}" )
      return()
    endif()
Index: flang/patches/patch-runtime_flang_CMakeLists_txt
===================================================================
RCS file: /cvs/ports/lang/flang/flang/patches/patch-runtime_flang_CMakeLists_txt,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 patch-runtime_flang_CMakeLists_txt
--- flang/patches/patch-runtime_flang_CMakeLists_txt	31 Dec 2017 18:06:38 -0000	1.1.1.1
+++ flang/patches/patch-runtime_flang_CMakeLists_txt	9 May 2018 16:03:53 -0000
@@ -1,11 +1,21 @@
 $OpenBSD: patch-runtime_flang_CMakeLists_txt,v 1.1.1.1 2017/12/31 18:06:38 bcallah Exp $
 
 No -lrt
+Appease lld
 
 Index: runtime/flang/CMakeLists.txt
 --- runtime/flang/CMakeLists.txt.orig
 +++ runtime/flang/CMakeLists.txt
-@@ -491,7 +491,7 @@ add_flang_library(flang_shared
+@@ -18,7 +18,7 @@ enable_language(C ASM Fortran) # Enable assembly and F
+ 
+ SET(ASM_OPTIONS "-DLINUX_ELF")
+ SET(CMAKE_ASM_FLAGS "${CFLAGS} ${ASM_OPTIONS}" )
+-SET(CMAKE_SHARED_LINKER_FLAGS "-no-flang-libs")
++SET(CMAKE_SHARED_LINKER_FLAGS "-no-flang-libs -L/usr/lib")
+ 
+ # We are using Fortran driver to build this library with fresh compiler
+ # components, so point its binary directory to the build directory to pick up
+@@ -426,7 +426,7 @@ add_flang_library(flang_shared
  set_property(TARGET flang_shared PROPERTY OUTPUT_NAME flang)
  target_link_libraries(flang_shared ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib/libflangrti.so)
  # Resolve symbols against libm and librt
Index: flang/patches/patch-runtime_flangrti_CMakeLists_txt
===================================================================
RCS file: /cvs/ports/lang/flang/flang/patches/patch-runtime_flangrti_CMakeLists_txt,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 patch-runtime_flangrti_CMakeLists_txt
--- flang/patches/patch-runtime_flangrti_CMakeLists_txt	31 Dec 2017 18:06:38 -0000	1.1.1.1
+++ flang/patches/patch-runtime_flangrti_CMakeLists_txt	9 May 2018 16:03:53 -0000
@@ -5,13 +5,13 @@ We need -lexecinfo. Use the static versi
 Index: runtime/flangrti/CMakeLists.txt
 --- runtime/flangrti/CMakeLists.txt.orig
 +++ runtime/flangrti/CMakeLists.txt
-@@ -200,6 +200,9 @@ if (NOT DEFINED LIBOMP_EXPORT_DIR)
-   target_link_libraries(flangrti_shared ${FLANG_LIBOMP})
- endif()
- 
+@@ -112,6 +113,9 @@ find_library( 
+   libpgmath.so
+   HINTS ${CMAKE_BINARY_DIR}/lib)
+ target_link_libraries(flangrti_shared ${LIBPGMATH})
++
 +# Import execinfo
 +target_link_libraries(flangrti_shared ${FLANG_LIBEXECINFO})
-+
+ 
  if( ${TARGET_ARCHITECTURE} STREQUAL "aarch64" )
    target_compile_definitions(flangrti_static PRIVATE TARGET_LINUX_ARM)
-   target_compile_definitions(flangrti_shared PRIVATE TARGET_LINUX_ARM)

Attachment: libpgmath.tgz
Description: Binary data

Reply via email to