svn commit: r321284 - in head/sys: amd64/include sys

Ryan Libby rlibby at FreeBSD.org
Thu Jul 20 06:47:08 UTC 2017


Author: rlibby
Date: Thu Jul 20 06:47:06 2017
New Revision: 321284
URL: https://svnweb.freebsd.org/changeset/base/321284

Log:
  efi: restrict visibility of EFIABI_ATTR-declared functions
  
  In-tree gcc (4.2) doesn't understand __attribute__((ms_abi))
  (EFIABI_ATTR).  Avoid declaring functions with that attribute when the
  compiler is detected to be gcc < 4.4.
  
  Reviewed by:	kib, imp (previous version)
  Approved by:	markj (mentor)
  Sponsored by:	Dell EMC Isilon
  Differential Revision:	https://reviews.freebsd.org/D11636

Modified:
  head/sys/amd64/include/efi.h
  head/sys/sys/efi.h

Modified: head/sys/amd64/include/efi.h
==============================================================================
--- head/sys/amd64/include/efi.h	Thu Jul 20 05:43:48 2017	(r321283)
+++ head/sys/amd64/include/efi.h	Thu Jul 20 06:47:06 2017	(r321284)
@@ -36,8 +36,14 @@
  * XXX: from gcc 6.2 manual:
  * Note, the ms_abi attribute for Microsoft Windows 64-bit targets
  * currently requires the -maccumulate-outgoing-args option.
+ *
+ * Avoid EFIABI_ATTR declarations for compilers that don't support it.
+ * GCC support began in version 4.4.
  */
+#if defined(__clang__) || defined(__GNUC__) && \
+    (__GNUC__ > 4 || __GNUC__ == 4 && __GNUC_MINOR__ >= 4)
 #define	EFIABI_ATTR	__attribute__((ms_abi))
+#endif
 
 #ifdef _KERNEL
 struct uuid;

Modified: head/sys/sys/efi.h
==============================================================================
--- head/sys/sys/efi.h	Thu Jul 20 05:43:48 2017	(r321283)
+++ head/sys/sys/efi.h	Thu Jul 20 06:47:06 2017	(r321284)
@@ -122,6 +122,9 @@ struct efi_tblhdr {
 	uint32_t	__res;
 };
 
+#ifdef _KERNEL
+
+#ifdef EFIABI_ATTR
 struct efi_rt {
 	struct efi_tblhdr rt_hdr;
 	efi_status	(*rt_gettime)(struct efi_tm *, struct efi_tmcap *)
@@ -144,6 +147,7 @@ struct efi_rt {
 	efi_status	(*rt_reset)(enum efi_reset, efi_status, u_long,
 	    efi_char *) EFIABI_ATTR;
 };
+#endif
 
 struct efi_systbl {
 	struct efi_tblhdr st_hdr;
@@ -163,7 +167,6 @@ struct efi_systbl {
 	uint64_t	st_cfgtbl;
 };
 
-#ifdef _KERNEL
 extern vm_paddr_t efi_systbl_phys;
 #endif	/* _KERNEL */
 


More information about the svn-src-all mailing list