Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 8 Feb 2018 21:11:48 +0000 (UTC)
From:      Dimitry Andric <dim@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r329033 - in head: contrib/llvm/tools/clang/lib/CodeGen sys/sys
Message-ID:  <201802082111.w18LBmJt061100@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: dim
Date: Thu Feb  8 21:11:48 2018
New Revision: 329033
URL: https://svnweb.freebsd.org/changeset/base/329033

Log:
  Pull in r324594 from upstream clang trunk (by Alexander Ivchenko):
  
    Fix for #31362 - ms_abi is implemented incorrectly for values >=16
    bytes.
  
    Summary:
    This patch is a fix for following issue:
    https://bugs.llvm.org/show_bug.cgi?id=31362 The problem was caused by
    front end lowering C calling conventions without taking into account
    calling conventions enforced by attribute. In this case win64cc was
    no correctly lowered on targets other than Windows.
  
    Reviewed By: rnk (Reid Kleckner)
  
    Differential Revision: https://reviews.llvm.org/D43016
  
    Author: belickim <mateusz.belicki@intel.com>
  
  This fixes clang 6.0.0 assertions when building the emulators/wine and
  emulators/wine-devel ports, and should also make it use the correct
  Windows calling conventions.  Bump __FreeBSD_version to make the fix
  easy to detect.
  
  PR:		224863
  MFC after:	3 months
  X-MFC-With:	r327952

Modified:
  head/contrib/llvm/tools/clang/lib/CodeGen/TargetInfo.cpp
  head/sys/sys/param.h

Modified: head/contrib/llvm/tools/clang/lib/CodeGen/TargetInfo.cpp
==============================================================================
--- head/contrib/llvm/tools/clang/lib/CodeGen/TargetInfo.cpp	Thu Feb  8 21:06:30 2018	(r329032)
+++ head/contrib/llvm/tools/clang/lib/CodeGen/TargetInfo.cpp	Thu Feb  8 21:11:48 2018	(r329033)
@@ -3543,7 +3543,17 @@ ABIArgInfo X86_64ABIInfo::classifyRegCallStructType(Qu
 
 void X86_64ABIInfo::computeInfo(CGFunctionInfo &FI) const {
 
-  bool IsRegCall = FI.getCallingConvention() == llvm::CallingConv::X86_RegCall;
+  const unsigned CallingConv = FI.getCallingConvention();
+  // It is possible to force Win64 calling convention on any x86_64 target by
+  // using __attribute__((ms_abi)). In such case to correctly emit Win64
+  // compatible code delegate this call to WinX86_64ABIInfo::computeInfo.
+  if (CallingConv == llvm::CallingConv::Win64) {
+    WinX86_64ABIInfo Win64ABIInfo(CGT);
+    Win64ABIInfo.computeInfo(FI);
+    return;
+  }
+
+  bool IsRegCall = CallingConv == llvm::CallingConv::X86_RegCall;
 
   // Keep track of the number of assigned registers.
   unsigned FreeIntRegs = IsRegCall ? 11 : 6;

Modified: head/sys/sys/param.h
==============================================================================
--- head/sys/sys/param.h	Thu Feb  8 21:06:30 2018	(r329032)
+++ head/sys/sys/param.h	Thu Feb  8 21:11:48 2018	(r329033)
@@ -60,7 +60,7 @@
  *		in the range 5 to 9.
  */
 #undef __FreeBSD_version
-#define __FreeBSD_version 1200056	/* Master, propagated to newvers */
+#define __FreeBSD_version 1200057	/* Master, propagated to newvers */
 
 /*
  * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD,



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201802082111.w18LBmJt061100>