From: Oliver Kurth Date: Fri, 15 Sep 2017 18:22:55 +0000 (-0700) Subject: Fix open-vm-tools build on Fedora using gcc 6. X-Git-Tag: stable-10.2.0~613 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=fbb9ff847ec87e6cddc399627ce4c651a7cdbe11;p=thirdparty%2Fopen-vm-tools.git Fix open-vm-tools build on Fedora using gcc 6. There were two problems: 1. VMW_BIT_MASK in x86cpuid.h generated an error when trying to set all 32 bits. This was due to using 33 bits in an intermediate calculation. The fix is to keep the calculation within 32 bits. 2. static const VMCI_HANDLE was defined in vmci_defs.h, but not used in one place that included the header. The fix is to add -Wno-unused-const-variable to CFLAGS to disable the new warning. --- diff --git a/open-vm-tools/configure.ac b/open-vm-tools/configure.ac index 0431f4eb3..4817928de 100644 --- a/open-vm-tools/configure.ac +++ b/open-vm-tools/configure.ac @@ -1036,7 +1036,8 @@ CFLAGS="$CFLAGS -Werror" # Glib2 keep changing mutex APIs so we also need to disable 'deprecated' # warnings for now (-Wno-deprecated-declarations). for TEST_CFLAG in -Wno-pointer-sign -Wno-unused-value -fno-strict-aliasing \ - -Wno-unknown-pragmas -Wno-uninitialized -Wno-deprecated-declarations; do + -Wno-unknown-pragmas -Wno-uninitialized -Wno-deprecated-declarations \ + -Wno-unused-const-variable; do AC_MSG_CHECKING([for GCC flag $TEST_CFLAG]) ORIGINAL_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $TEST_CFLAG" diff --git a/open-vm-tools/lib/include/x86cpuid.h b/open-vm-tools/lib/include/x86cpuid.h index 02c1b3ff4..89c5f76a8 100644 --- a/open-vm-tools/lib/include/x86cpuid.h +++ b/open-vm-tools/lib/include/x86cpuid.h @@ -1054,11 +1054,9 @@ FIELD(81E, 0, ECX, 8, 3, NODES_PER_PKG, NA, FALSE) * * e.g. - CPUID_VIRT_BITS_MASK = 0xff00 * - CPUID_VIRT_BITS_SHIFT = 8 - * - * Note: The MASK definitions must use some gymnastics to get - * around a warning when shifting left by 32. */ -#define VMW_BIT_MASK(shift) (((1 << (shift - 1)) << 1) - 1) +#define VMW_BIT_MASK(shift) (0xffffffffu >> (32 - shift)) + #define FIELD(lvl, ecxIn, reg, bitpos, size, name, s, c3) \ CPUID_##name##_SHIFT = bitpos, \