[Pkg-ofed-commits] [mstflint] 17/25: Fix compilation on unknown architectures

Benjamin Drung bdrung at moszumanska.debian.org
Tue Jan 3 11:58:10 UTC 2017


This is an automated email from the git hooks/post-receive script.

bdrung pushed a commit to branch master
in repository mstflint.

commit 0391e12d131bd420286750fe694ef8fe85cbbd5c
Author: Benjamin Drung <benjamin.drung at profitbricks.com>
Date:   Fri Aug 19 14:48:18 2016 +0200

    Fix compilation on unknown architectures
    
    The printf statement requires specific length modifiers for printing
    fixed-sized integers (depending on the architecture). The code tries to
    determine the architecture for defining the correct length modifier. The
    architecture detection supports less architectures than Debian supports
    and causes the build to fail on armel, armhf, mips, mips64el, mipsel,
    s390x, alpha, and hppa.
    
    The mapping from the architecture to the length modifier also fails for
    the x32 architecture (which uses 32-bit integers, longs and pointers on
    64-bit hardware).
    
    inttypes.h already defines length modifiers for fixed-sized integers.
    Thus just use these definitions and drop the complete architecture
    detection on Linux and FreeBSD.
---
 .../Fix-compilation-on-unknown-architectures.patch | 178 +++++++++++++++++++++
 debian/patches/series                              |   1 +
 2 files changed, 179 insertions(+)

diff --git a/debian/patches/Fix-compilation-on-unknown-architectures.patch b/debian/patches/Fix-compilation-on-unknown-architectures.patch
new file mode 100644
index 0000000..c69fa34
--- /dev/null
+++ b/debian/patches/Fix-compilation-on-unknown-architectures.patch
@@ -0,0 +1,178 @@
+Description: Fix compilation on unknown architectures
+ The printf statement requires specific length modifiers for printing
+ fixed-sized integers (depending on the architecture). The code tries to
+ determine the architecture for defining the correct length modifier.
+ The architecture detection supports less architectures than Debian supports
+ and causes the build to fail on armel, armhf, mips, mips64el, mipsel, s390x,
+ alpha, and hppa.
+ .
+ The mapping from the architecture to the length modifier also fails for the
+ x32 architecture (which uses 32-bit integers, longs and pointers on 64-bit
+ hardware).
+ .
+ inttypes.h already defines length modifiers for fixed-sized integers.
+ Thus just use these definitions and drop the complete architecture detection
+ on Linux and FreeBSD.
+Author: Benjamin Drung <benjamin.drung at profitbricks.com>
+
+--- a/common/compatibility.h
++++ b/common/compatibility.h
+@@ -48,23 +48,7 @@
+ 
+ 
+ /* define macros to the architecture of the CPU */
+-#if defined(__linux) || defined(__FreeBSD__)             /* __linux || __FreeBSD__ */
+-#   if defined(__i386__)
+-#       define ARCH_x86
+-#   elif defined(__x86_64__)
+-#       define ARCH_x86_64
+-#   elif defined(__ia64__)
+-#       define ARCH_ia64
+-#   elif defined(__PPC64__)
+-#       define ARCH_ppc64
+-#   elif defined(__PPC__)
+-#       define ARCH_ppc
+-#   elif defined(__aarch64__)
+-#       define ARCH_arm64
+-#   else
+-#       error Unknown CPU architecture using the linux OS
+-#   endif
+-#elif defined(__MINGW32__) || defined(__MINGW64__)              /* Windows MINGW */
++#if defined(__MINGW32__) || defined(__MINGW64__)                /* Windows MINGW */
+ #   if defined(__MINGW32__)
+ #       define ARCH_x86
+ #   elif defined(__MINGW64__)
+@@ -80,7 +64,7 @@
+ #   else
+ #       error Unknown CPU architecture using the windows OS
+ #   endif
+-#else                                                   /* Unknown */
++#elif ! (defined(__linux) || defined(__FreeBSD__))      /* Unknown */
+ #   error Unknown OS
+ #endif
+ 
+@@ -92,7 +76,14 @@
+ #define U16H_FMT    "0x%04x"
+ #define U8H_FMT     "0x%02x"
+ 
+-#if defined(ARCH_x86) || defined(ARCH_ppc) || defined(UEFI_BUILD)
++#if defined(__linux) || defined(__FreeBSD__)
++#    include <inttypes.h>
++#    define U64D_FMT    "%" PRId64
++#    define U64H_FMT    "0x%" PRIx64
++#    define U64H_FMT_GEN PRIx64
++#    define U48H_FMT    "0x%" PRIx64
++#    define U64D_FMT_GEN PRId64
++#elif defined(ARCH_x86) || defined(ARCH_ppc) || defined(UEFI_BUILD)
+ #   if defined(__MINGW32__) || defined(__MINGW64__)
+ #       include <inttypes.h>
+ #       define U64D_FMT    "0x%"PRId64
+--- a/mtcr_ul/packets_common.h
++++ b/mtcr_ul/packets_common.h
+@@ -132,56 +132,6 @@
+ #endif
+ 
+ 
+-/************************************/
+-/* define macros to the architecture of the CPU */
+-#if defined(__linux) || defined(__FreeBSD__)
+-#   if defined(__i386__)
+-#       define ARCH_x86
+-#   elif defined(__x86_64__)
+-#       define ARCH_x86_64
+-#   elif defined(__ia64__)
+-#       define ARCH_ia64
+-#   elif defined(__PPC64__)
+-#       define ARCH_ppc64
+-#   elif defined(__PPC__)
+-#       define ARCH_ppc
+-#   elif defined(__aarch64__)
+-#       define ARCH_arm64
+-#   else
+-#       error Unknown CPU architecture using the linux OS
+-#   endif
+-#elif defined(_WIN32)
+-
+-//#   error Windows OS need to define macros
+-#else       /* __linux || __FreeBSD__ */
+-#   error Unknown OS
+-#endif      /* __linux || __FreeBSD__ */
+-
+-
+-/**********************************/
+-/* define macros for print fields */
+-//#if defined (ARCH_ia64) || defined(ARCH_x86_64) || defined(ARCH_ppc64) || defined(__MINGW64__)
+-/*
+-#if !defined(UEFI_BUILD) && (defined (ARCH_ia64) || defined(ARCH_x86_64) || defined(ARCH_ppc64) || defined(__MINGW64__))
+-#   define U64H_FMT "0x%016lx"
+-#   define U64D_FMT "%lu"
+-#   define U32H_FMT "0x%08x"
+-#   define U16H_FMT "0x%04x"
+-#   define U8H_FMT  "0x%02x"
+-#   define U32D_FMT "%u"
+-#   define STR_FMT "%s"
+-#elif defined(ARCH_x86) || defined(ARCH_ppc) || defined(__MINGW32__) || defined(UEFI_BUILD)
+-#   define U64H_FMT "0x%016llx"
+-#   define U64D_FMT "%llu"
+-#   define U32H_FMT "0x%08x"
+-#   define U16H_FMT "0x%04x"
+-#   define U8H_FMT  "0x%02x"
+-#   define U32D_FMT "%u"
+-#   define STR_FMT "%s"
+-#else  // ARCH
+-#   error Unknown architecture
+-#endif // ARCH
+-*/
+ 
+ /**********************************/
+ void push_to_buff_64(u_int8_t *buff, u_int32_t bit_offset, u_int64_t field_value);
+--- a/tools_layouts/adb_to_c_utils.h
++++ b/tools_layouts/adb_to_c_utils.h
+@@ -124,23 +124,7 @@
+ 
+ 
+ /* define macros to the architecture of the CPU */
+-#if defined(__linux) || defined(__FreeBSD__)             /* __linux || __FreeBSD__ */
+-#   if defined(__i386__)
+-#       define ARCH_x86
+-#   elif defined(__x86_64__)
+-#       define ARCH_x86_64
+-#   elif defined(__ia64__)
+-#       define ARCH_ia64
+-#   elif defined(__PPC64__)
+-#       define ARCH_ppc64
+-#   elif defined(__PPC__)
+-#       define ARCH_ppc
+-#   elif defined(__aarch64__)
+-#       define ARCH_arm64
+-#   else
+-#       error Unknown CPU architecture using the linux OS
+-#   endif
+-#elif defined(__MINGW32__) || defined(__MINGW64__)		/* Windows MINGW */
++#if defined(__MINGW32__) || defined(__MINGW64__)                /* Windows MINGW */
+ #   if defined(__MINGW32__)
+ #       define ARCH_x86
+ #   elif defined(__MINGW64__)
+@@ -156,7 +140,7 @@
+ #   else
+ #       error Unknown CPU architecture using the windows OS
+ #   endif
+-#else                                                   /* Unknown */
++#elif ! (defined(__linux) || defined(__FreeBSD__))      /* Unknown */
+ #   error Unknown OS
+ #endif
+ 
+@@ -169,7 +153,12 @@
+ #define U16H_FMT    "0x%04x"
+ #define U8H_FMT     "0x%02x"
+ 
+-#if defined(ARCH_x86) || defined(ARCH_ppc) || defined(UEFI_BUILD)
++#if defined(__linux) || defined(__FreeBSD__)
++#    include <inttypes.h>
++#    define U64D_FMT    "%" PRId64
++#    define U64H_FMT    "0x%" PRIx64
++#    define U48H_FMT    "0x%" PRIx64
++#elif defined(ARCH_x86) || defined(ARCH_ppc) || defined(UEFI_BUILD)
+ #   if defined(__MINGW32__) || defined(__MINGW64__)
+ #       include <inttypes.h>
+ #       define U64D_FMT    "0x%"PRId64
diff --git a/debian/patches/series b/debian/patches/series
index 62a63f8..70ee3bf 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -5,3 +5,4 @@
 0005-Fix-section-mismatch-in-man-pages.patch
 0006-Fix-man-page-errors.patch
 0007-Pass-foreign-to-automake.patch
+Fix-compilation-on-unknown-architectures.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ofed/mstflint.git



More information about the Pkg-ofed-commits mailing list