fix build failure on i686

Signed-off-by: Peter Jones <pjones@redhat.com>
This commit is contained in:
Peter Jones 2016-08-11 15:47:00 -04:00
parent 1026cab2d4
commit 1c7b676a77
2 changed files with 41 additions and 0 deletions

View File

@ -0,0 +1,40 @@
From ebbff29622bd7c80415ab52749982918e66fa2be Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Thu, 11 Aug 2016 15:46:06 -0400
Subject: [PATCH] util.h: add int_add for 32-bit platforms
---
src/util.h | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/src/util.h b/src/util.h
index 80f5fab..de972af 100644
--- a/src/util.h
+++ b/src/util.h
@@ -38,12 +38,23 @@
*/
#if defined(__GNUC__) && defined(__GNUC_MINOR__)
#if __GNUC__ >= 5 && __GNUC_MINOR__ >= 1
+#define int_add(a, b, c) __builtin_add_overflow(a, b, c)
#define long_add(a, b, c) __builtin_add_overflow(a, b, c)
#define long_mult(a, b, c) __builtin_mul_overflow(a, b, c)
#define ulong_add(a, b, c) __builtin_add_overflow(a, b, c)
#define ulong_mult(a, b, c) __builtin_mul_overflow(a, b, c)
#endif
#endif
+#ifndef int_add
+#define int_add(a, b, c) ({ \
+ const int _limit = INT_MAX; \
+ int _ret; \
+ _ret = _limit - (a) > (b); \
+ if (!_ret) \
+ *(c) = ((a) + (b)); \
+ _ret; \
+ })
+#endif
#ifndef long_add
#define long_add(a, b, c) ({ \
const long _limit = LONG_MAX; \
--
2.7.4

View File

@ -9,6 +9,7 @@ ExclusiveArch: %{ix86} x86_64 aarch64
BuildRequires: popt-devel popt-static git glibc-static
Source0: https://github.com/rhinstaller/efivar/releases/download/efivar-%{version}/efivar-%{version}.tar.bz2
Patch0001: 0001-util.h-add-int_add-for-32-bit-platforms.patch
%description
efivar provides a simple command line interface to the UEFI variable facility.