[meta-freescale] [meta-fsl-ppc][PATCH 1/2] linux-qoriq: fix build issue under gcc6
Zhenhua Luo
zhenhua.luo at nxp.com
Thu Jun 2 02:18:12 PDT 2016
Signed-off-by: Zhenhua Luo <zhenhua.luo at nxp.com>
---
.../files/fix-the-compile-issue-under-gcc6.patch | 103 +++++++++++++++++++++
.../files/module-remove-MODULE_GENERIC_TABLE.patch | 77 +++++++++++++++
recipes-kernel/linux/linux-qoriq_3.12.bb | 2 +
3 files changed, 182 insertions(+)
create mode 100644 recipes-kernel/linux/files/fix-the-compile-issue-under-gcc6.patch
create mode 100644 recipes-kernel/linux/files/module-remove-MODULE_GENERIC_TABLE.patch
diff --git a/recipes-kernel/linux/files/fix-the-compile-issue-under-gcc6.patch b/recipes-kernel/linux/files/fix-the-compile-issue-under-gcc6.patch
new file mode 100644
index 0000000..910ef18
--- /dev/null
+++ b/recipes-kernel/linux/files/fix-the-compile-issue-under-gcc6.patch
@@ -0,0 +1,103 @@
+Fix the compile issue under gcc6
+
+Fix the following build error:
+| .../include/linux/compiler-gcc.h:106:30: fatal error: linux/compiler-gcc6.h: No such file or directory
+| #include gcc_header(__GNUC__)
+
+Signed-off-by: Zhenhua Luo <zhenhua.luo at nxp.com>
+
+Upstream-Status: Pending
+---
+ arch/powerpc/kernel/Makefile | 2 --
+ include/linux/compiler-gcc6.h | 66 +++++++++++++++++++++++++++++++++++++++++++
+ 2 files changed, 66 insertions(+), 2 deletions(-)
+ create mode 100644 include/linux/compiler-gcc6.h
+
+diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile
+index c326675..45f0494 100644
+--- a/arch/powerpc/kernel/Makefile
++++ b/arch/powerpc/kernel/Makefile
+@@ -4,8 +4,6 @@
+
+ CFLAGS_ptrace.o += -DUTS_MACHINE='"$(UTS_MACHINE)"'
+
+-subdir-ccflags-$(CONFIG_PPC_WERROR) := -Werror
+-
+ ifeq ($(CONFIG_PPC64),y)
+ CFLAGS_prom_init.o += $(NO_MINIMAL_TOC)
+ endif
+diff --git a/include/linux/compiler-gcc6.h b/include/linux/compiler-gcc6.h
+new file mode 100644
+index 0000000..cdd1cc2
+--- /dev/null
++++ b/include/linux/compiler-gcc6.h
+@@ -0,0 +1,66 @@
++#ifndef __LINUX_COMPILER_H
++#error "Please don't include <linux/compiler-gcc5.h> directly, include <linux/compiler.h> instead."
++#endif
++
++#define __used __attribute__((__used__))
++#define __must_check __attribute__((warn_unused_result))
++#define __compiler_offsetof(a, b) __builtin_offsetof(a, b)
++
++/* Mark functions as cold. gcc will assume any path leading to a call
++ to them will be unlikely. This means a lot of manual unlikely()s
++ are unnecessary now for any paths leading to the usual suspects
++ like BUG(), printk(), panic() etc. [but let's keep them for now for
++ older compilers]
++
++ Early snapshots of gcc 4.3 don't support this and we can't detect this
++ in the preprocessor, but we can live with this because they're unreleased.
++ Maketime probing would be overkill here.
++
++ gcc also has a __attribute__((__hot__)) to move hot functions into
++ a special section, but I don't see any sense in this right now in
++ the kernel context */
++#define __cold __attribute__((__cold__))
++
++#define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__)
++
++#ifndef __CHECKER__
++# define __compiletime_warning(message) __attribute__((warning(message)))
++# define __compiletime_error(message) __attribute__((error(message)))
++#endif /* __CHECKER__ */
++
++/*
++ * Mark a position in code as unreachable. This can be used to
++ * suppress control flow warnings after asm blocks that transfer
++ * control elsewhere.
++ *
++ * Early snapshots of gcc 4.5 don't support this and we can't detect
++ * this in the preprocessor, but we can live with this because they're
++ * unreleased. Really, we need to have autoconf for the kernel.
++ */
++#define unreachable() __builtin_unreachable()
++
++/* Mark a function definition as prohibited from being cloned. */
++#define __noclone __attribute__((__noclone__))
++
++/*
++ * Tell the optimizer that something else uses this function or variable.
++ */
++#define __visible __attribute__((externally_visible))
++
++/*
++ * GCC 'asm goto' miscompiles certain code sequences:
++ *
++ * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58670
++ *
++ * Work it around via a compiler barrier quirk suggested by Jakub Jelinek.
++ * Fixed in GCC 4.8.2 and later versions.
++ *
++ * (asm goto is automatically volatile - the naming reflects this.)
++ */
++#define asm_volatile_goto(x...) do { asm goto(x); asm (""); } while (0)
++
++#ifdef CONFIG_ARCH_USE_BUILTIN_BSWAP
++#define __HAVE_BUILTIN_BSWAP32__
++#define __HAVE_BUILTIN_BSWAP64__
++#define __HAVE_BUILTIN_BSWAP16__
++#endif /* CONFIG_ARCH_USE_BUILTIN_BSWAP */
+--
+2.5.0
+
diff --git a/recipes-kernel/linux/files/module-remove-MODULE_GENERIC_TABLE.patch b/recipes-kernel/linux/files/module-remove-MODULE_GENERIC_TABLE.patch
new file mode 100644
index 0000000..5a67155
--- /dev/null
+++ b/recipes-kernel/linux/files/module-remove-MODULE_GENERIC_TABLE.patch
@@ -0,0 +1,77 @@
+module: remove MODULE_GENERIC_TABLE
+
+MODULE_DEVICE_TABLE() calles MODULE_GENERIC_TABLE(); make it do the
+work directly. This also removes a wart introduced in the last patch,
+where the alias is defined to be an unknown struct type "struct
+type##__##name##_device_id" instead of "struct type##_device_id" (it's
+an extern so GCC doesn't care, but it's wrong).
+
+The other user of MODULE_GENERIC_TABLE (ISAPNP_CARD_TABLE) is unused,
+so delete it.
+
+<Backport from cff26a51da5d206d3baf871e75778da44710219d>
+
+Signed-off-by: Rusty Russell <rusty at rustcorp.com.au>
+Signed-off-by: Zhenhua Luo <zhenhua.luo at nxp.com>
+
+Upstream-Status: Backport
+---
+ include/linux/isapnp.h | 4 ----
+ include/linux/module.h | 19 ++++++++-----------
+ 2 files changed, 8 insertions(+), 15 deletions(-)
+
+diff --git a/include/linux/isapnp.h b/include/linux/isapnp.h
+index e2d28b0..3c77bf9 100644
+--- a/include/linux/isapnp.h
++++ b/include/linux/isapnp.h
+@@ -56,10 +56,6 @@
+ #define ISAPNP_DEVICE_ID(_va, _vb, _vc, _function) \
+ { .vendor = ISAPNP_VENDOR(_va, _vb, _vc), .function = ISAPNP_FUNCTION(_function) }
+
+-/* export used IDs outside module */
+-#define ISAPNP_CARD_TABLE(name) \
+- MODULE_GENERIC_TABLE(isapnp_card, name)
+-
+ struct isapnp_card_id {
+ unsigned long driver_data; /* data private to the driver */
+ unsigned short card_vendor, card_device;
+diff --git a/include/linux/module.h b/include/linux/module.h
+index 54aef1b..a9f6812 100644
+--- a/include/linux/module.h
++++ b/include/linux/module.h
+@@ -83,15 +83,6 @@ void sort_extable(struct exception_table_entry *start,
+ void sort_main_extable(void);
+ void trim_init_extable(struct module *m);
+
+-#ifdef MODULE
+-#define MODULE_GENERIC_TABLE(gtype,name) \
+-extern const struct gtype##_id __mod_##gtype##_table \
+- __attribute__ ((unused, alias(__stringify(name))))
+-
+-#else /* !MODULE */
+-#define MODULE_GENERIC_TABLE(gtype,name)
+-#endif
+-
+ /* Generic info of form tag = "info" */
+ #define MODULE_INFO(tag, info) __MODULE_INFO(tag, tag, info)
+
+@@ -142,8 +133,14 @@ extern const struct gtype##_id __mod_##gtype##_table \
+ /* What your module does. */
+ #define MODULE_DESCRIPTION(_description) MODULE_INFO(description, _description)
+
+-#define MODULE_DEVICE_TABLE(type,name) \
+- MODULE_GENERIC_TABLE(type##__##name##_device, name)
++#ifdef MODULE
++/* Creates an alias so file2alias.c can find device table. */
++#define MODULE_DEVICE_TABLE(type, name) \
++ extern const struct type##_device_id __mod_##type##__##name##_device_table \
++ __attribute__ ((unused, alias(__stringify(name))))
++#else /* !MODULE */
++#define MODULE_DEVICE_TABLE(type, name)
++#endif
+
+ /* Version of form [<epoch>:]<version>[-<extra-version>].
+ Or for CVS/RCS ID version, everything but the number is stripped.
+--
+2.5.0
+
diff --git a/recipes-kernel/linux/linux-qoriq_3.12.bb b/recipes-kernel/linux/linux-qoriq_3.12.bb
index 110d7ce..744aa4e 100644
--- a/recipes-kernel/linux/linux-qoriq_3.12.bb
+++ b/recipes-kernel/linux/linux-qoriq_3.12.bb
@@ -4,5 +4,7 @@ SRC_URI = "git://git.freescale.com/ppc/sdk/linux.git;branch=sdk-v1.9.x \
file://modify-defconfig-t1040-nr-cpus.patch \
file://net-sctp-CVE-2014-0101.patch \
file://0001-powerpc-Align-TOC-to-256-bytes.patch \
+ file://fix-the-compile-issue-under-gcc6.patch \
+ file://module-remove-MODULE_GENERIC_TABLE.patch \
"
SRCREV = "43cecda943a6c40a833b588801b0929e8bd48813"
--
2.4.11
More information about the meta-freescale
mailing list