diff options
author | Khem Raj <raj.khem@gmail.com> | 2017-07-26 11:58:15 -0700 |
---|---|---|
committer | Martin Jansa <Martin.Jansa@gmail.com> | 2017-08-13 13:19:40 +0200 |
commit | fcfa955fcb030c84a0362e113be506030c65b06c (patch) | |
tree | 836206f4ddfd259ac77493a158a8afb8d3cca446 /meta-oe/recipes-extended | |
parent | 9ef4f05cf4a971d1af3b9fc11d215dcf3f8c56d0 (diff) | |
download | meta-openembedded-fcfa955fcb030c84a0362e113be506030c65b06c.tar.gz |
flashrom: Fix build with clang
Backport a patch from staging
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Diffstat (limited to 'meta-oe/recipes-extended')
-rw-r--r-- | meta-oe/recipes-extended/flashrom/flashrom/0001-Remove-undefined-behavior.patch | 82 | ||||
-rw-r--r-- | meta-oe/recipes-extended/flashrom/flashrom_0.9.9.bb | 3 |
2 files changed, 84 insertions, 1 deletions
diff --git a/meta-oe/recipes-extended/flashrom/flashrom/0001-Remove-undefined-behavior.patch b/meta-oe/recipes-extended/flashrom/flashrom/0001-Remove-undefined-behavior.patch new file mode 100644 index 000000000..51397dc55 --- /dev/null +++ b/meta-oe/recipes-extended/flashrom/flashrom/0001-Remove-undefined-behavior.patch | |||
@@ -0,0 +1,82 @@ | |||
1 | From d2a03b3e43043b596a79803bcb93f70e513bbb50 Mon Sep 17 00:00:00 2001 | ||
2 | From: Patrick Georgi <pgeorgi@google.com> | ||
3 | Date: Mon, 13 Mar 2017 13:48:03 +0100 | ||
4 | Subject: [PATCH] Remove undefined behavior | ||
5 | |||
6 | Per clang-3.9, the compiler fails on #define ...defined(...) statements | ||
7 | as they're undefined behavior (apparently with different behavior | ||
8 | between gcc/clang and msvc, too). | ||
9 | |||
10 | See clang's cfe repo commit r258128 for details. | ||
11 | |||
12 | Change-Id: I82b6235e11b425fae45eebbe06b08f81c5bdbb98 | ||
13 | Signed-off-by: Patrick Georgi <pgeorgi@google.com> | ||
14 | Reviewed-on: https://review.coreboot.org/18792 | ||
15 | Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org> | ||
16 | Tested-by: build bot (Jenkins) <no-reply@coreboot.org> | ||
17 | --- | ||
18 | hwaccess.c | 18 +++++++++++++++--- | ||
19 | platform.h | 18 +++++++++++++++--- | ||
20 | 2 files changed, 30 insertions(+), 6 deletions(-) | ||
21 | |||
22 | diff --git a/hwaccess.c b/hwaccess.c | ||
23 | index aede7e3..2bf6f42 100644 | ||
24 | --- a/hwaccess.c | ||
25 | +++ b/hwaccess.c | ||
26 | @@ -37,9 +37,21 @@ | ||
27 | #error "Unknown operating system" | ||
28 | #endif | ||
29 | |||
30 | -#define USE_IOPL (IS_LINUX || IS_MACOSX || defined(__NetBSD__) || defined(__OpenBSD__)) | ||
31 | -#define USE_DEV_IO (defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)) | ||
32 | -#define USE_IOPERM (defined(__gnu_hurd__)) | ||
33 | +#if IS_LINUX || IS_MACOSX || defined(__NetBSD__) || defined(__OpenBSD__) | ||
34 | +#define USE_IOPL 1 | ||
35 | +#else | ||
36 | +#define USE_IOPL 0 | ||
37 | +#endif | ||
38 | +#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) | ||
39 | +#define USE_DEV_IO 1 | ||
40 | +#else | ||
41 | +#define USE_DEV_IO 0 | ||
42 | +#endif | ||
43 | +#if defined(__gnu_hurd__) | ||
44 | +#define USE_IOPERM 1 | ||
45 | +#else | ||
46 | +#define USE_IOPERM 0 | ||
47 | +#endif | ||
48 | |||
49 | #if USE_IOPERM | ||
50 | #include <sys/io.h> | ||
51 | diff --git a/platform.h b/platform.h | ||
52 | index c5a52ef..b2fdcd0 100644 | ||
53 | --- a/platform.h | ||
54 | +++ b/platform.h | ||
55 | @@ -25,9 +25,21 @@ | ||
56 | #define __PLATFORM_H__ 1 | ||
57 | |||
58 | // Helper defines for operating systems | ||
59 | -#define IS_LINUX (defined(__gnu_linux__) || defined(__linux__)) | ||
60 | -#define IS_MACOSX (defined(__APPLE__) && defined(__MACH__)) /* yes, both. */ | ||
61 | -#define IS_WINDOWS (defined(_WIN32) || defined(_WIN64) || defined(__WIN32__) || defined(__WINDOWS__)) | ||
62 | +#if defined(__gnu_linux__) || defined(__linux__) | ||
63 | +#define IS_LINUX 1 | ||
64 | +#else | ||
65 | +#define IS_LINUX 0 | ||
66 | +#endif | ||
67 | +#if defined(__APPLE__) && defined(__MACH__) /* yes, both. */ | ||
68 | +#define IS_MACOSX 1 | ||
69 | +#else | ||
70 | +#define IS_MACOSX 0 | ||
71 | +#endif | ||
72 | +#if defined(_WIN32) || defined(_WIN64) || defined(__WIN32__) || defined(__WINDOWS__) | ||
73 | +#define IS_WINDOWS 1 | ||
74 | +#else | ||
75 | +#define IS_WINDOWS 0 | ||
76 | +#endif | ||
77 | |||
78 | // Likewise for target architectures | ||
79 | #if defined (__i386__) || defined (__x86_64__) || defined(__amd64__) | ||
80 | -- | ||
81 | 2.13.3 | ||
82 | |||
diff --git a/meta-oe/recipes-extended/flashrom/flashrom_0.9.9.bb b/meta-oe/recipes-extended/flashrom/flashrom_0.9.9.bb index 1bd97929c..4cdd8ad23 100644 --- a/meta-oe/recipes-extended/flashrom/flashrom_0.9.9.bb +++ b/meta-oe/recipes-extended/flashrom/flashrom_0.9.9.bb | |||
@@ -3,11 +3,12 @@ LICENSE = "GPLv2" | |||
3 | HOMEPAGE = "http://flashrom.org" | 3 | HOMEPAGE = "http://flashrom.org" |
4 | 4 | ||
5 | LIC_FILES_CHKSUM = "file://COPYING;md5=751419260aa954499f7abaabaa882bbe" | 5 | LIC_FILES_CHKSUM = "file://COPYING;md5=751419260aa954499f7abaabaa882bbe" |
6 | DEPENDS = "pciutils libusb" | 6 | DEPENDS = "pciutils libusb libusb-compat" |
7 | 7 | ||
8 | SRC_URI = "http://download.flashrom.org/releases/flashrom-${PV}.tar.bz2 \ | 8 | SRC_URI = "http://download.flashrom.org/releases/flashrom-${PV}.tar.bz2 \ |
9 | file://0001-spi-Define-_XOPEN_SOURCE-to-enable-ffs-libc-API.patch \ | 9 | file://0001-spi-Define-_XOPEN_SOURCE-to-enable-ffs-libc-API.patch \ |
10 | file://sst26.patch \ | 10 | file://sst26.patch \ |
11 | file://0001-Remove-undefined-behavior.patch \ | ||
11 | " | 12 | " |
12 | SRC_URI[md5sum] = "aab9c98925d9cfb5ffb28b67a6112530" | 13 | SRC_URI[md5sum] = "aab9c98925d9cfb5ffb28b67a6112530" |
13 | SRC_URI[sha256sum] = "cb3156b0f63eb192024b76c0814135930297aac41f80761a5d293de769783c45" | 14 | SRC_URI[sha256sum] = "cb3156b0f63eb192024b76c0814135930297aac41f80761a5d293de769783c45" |