Skip to contentSkip to conversation

(no subject)

U-Boot New Peter Robinson 3 participants 12 messages Feb 3, 2016 – Feb 16, 2016

lore
Share & tools
lore
#0 lore raw

Hi All,

Here's a couple of patches to help building on gcc-6. We're rebasing Fedora to gcc-6 for Fedora 24 so this was the first build I've attempted with it. It doesn't fix all problems as I also see an issue that the generated/generic-asm-offsets.h isn't generated early enough in the build process but I couldn't quite work out how to move the generation of that earlier in the process. Full logs of that at the link below.

Cheers,
Peter

https://kojipkgs.fedoraproject.org//work/tasks/1747/12801747/build.log

#1 lore raw

PATCH 1/3 Copy gcc5 over to compiler-gcc6.h as a beginning of support

Add initial support for gcc6 by taking a copy of compiler-gcc5.h

---
 include/linux/compiler-gcc6.h | 65 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 65 insertions(+)
 create mode 100644 include/linux/compiler-gcc6.h
include/linux/compiler-gcc6.h new file +65 -0
new file mode 100644
index 0000000..622117b
@@ -0,0 +1,65 @@
+#ifndef __LINUX_COMPILER_H
+#error "Please don't include <linux/compiler-gcc6.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.
+ *
+ * (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 */
Signature · 1 line
2.5.0
#2 lore raw

PATCH 2/3 common: env_flags: include common.h even for HOST_CC

In reply to Peter Robinson

When compiling with gcc 6 we get the following error due to ARRAY_SIZE being defined elsewhere.

common/env_flags.c:155: undefined reference to `ARRAY_SIZE'

---
 common/env_flags.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
common/env_flags.c +1 -1
index 9c3aed1..696adef 100644
@@ -7,6 +7,7 @@
 
 #include <linux/string.h>
 #include <linux/ctype.h>
+#include <common.h>
 
 #ifdef USE_HOSTCC /* Eliminate "ANSI does not permit..." warnings */
 #include <stdint.h>
@@ -16,7 +17,6 @@
 #include <env_flags.h>
 #define getenv fw_getenv
 #else
-#include <common.h>
 #include <environment.h>
 #endif
 
Signature · 1 line
2.5.0
#3 lore raw

PATCH 2/3 common: env_flags: include common.h even for HOST_CC

Hello Peter,

Quoted 23 lines · Peter Robinson

When compiling with gcc 6 we get the following error due to ARRAY_SIZE being defined elsewhere.

common/env_flags.c:155: undefined reference to `ARRAY_SIZE'

---
 common/env_flags.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
common/env_flags.c +1 -0
index 9c3aed1..696adef 100644
@@ -7,6 +7,7 @@
 
 #include <linux/string.h>
 #include <linux/ctype.h>
+#include <common.h>
 
 #ifdef USE_HOSTCC /* Eliminate "ANSI does not permit..." warnings */
 #include <stdint.h>

common/env_flags.c line 21

Quoted 6 lines
common/env_flags.c +0 -1
@@ -16,7 +17,6 @@
 #include <env_flags.h>
 #define getenv fw_getenv
 #else
-#include <common.h>
 #include <environment.h>
 #endif

How come this happens only with gcc-6? Previous compilers surely did not 'guess' the proper value of ARRAY_SIZE, right?

Quoted 7 lines
Signature · 6 lines
2.5.0

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Amicalement,

Signature · 1 line
Albert.
#4 lore raw

PATCH 2/3 common: env_flags: include common.h even for HOST_CC

Hi Albert,

Quoted 24 lines · Albert ARIBAUD

Hello Peter,

Quoted 20 lines · Peter Robinson

When compiling with gcc 6 we get the following error due to ARRAY_SIZE being defined elsewhere.

common/env_flags.c:155: undefined reference to `ARRAY_SIZE'

---
 common/env_flags.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
common/env_flags.c +1 -0
index 9c3aed1..696adef 100644
@@ -7,6 +7,7 @@
 
 #include <linux/string.h>
 #include <linux/ctype.h>
+#include <common.h>
 
Quoted 12 lines

common/env_flags.c line 21

Quoted 9 lines
common/env_flags.c +0 -1
 #ifdef USE_HOSTCC /* Eliminate "ANSI does not permit..." warnings */
 #include <stdint.h>
@@ -16,7 +17,6 @@
 #include <env_flags.h>
 #define getenv fw_getenv
 #else
-#include <common.h>
 #include <environment.h>
 #endif

How come this happens only with gcc-6? Previous compilers surely did not 'guess' the proper value of ARRAY_SIZE, right?

So testing this RC on on Fedora 23 with gcc 5.3.1 I see the same failure, I didn't see it with 2016.01 when using 5.3.1 so I'm not sure what's changed there

Peter

#5 lore raw

PATCH 2/3 common: env_flags: include common.h even for HOST_CC

Hello Peter,

Quoted 41 lines · Peter Robinson

Hi Albert,

Quoted 24 lines · Albert ARIBAUD

Hello Peter,

Quoted 20 lines · Peter Robinson

When compiling with gcc 6 we get the following error due to ARRAY_SIZE being defined elsewhere.

common/env_flags.c:155: undefined reference to `ARRAY_SIZE'

---
 common/env_flags.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
common/env_flags.c +1 -0
index 9c3aed1..696adef 100644
@@ -7,6 +7,7 @@
 
 #include <linux/string.h>
 #include <linux/ctype.h>
+#include <common.h>
 
Quoted 12 lines

common/env_flags.c line 21

Quoted 9 lines
common/env_flags.c +0 -1
 #ifdef USE_HOSTCC /* Eliminate "ANSI does not permit..." warnings */
 #include <stdint.h>
@@ -16,7 +17,6 @@
 #include <env_flags.h>
 #define getenv fw_getenv
 #else
-#include <common.h>
 #include <environment.h>
 #endif

How come this happens only with gcc-6? Previous compilers surely did not 'guess' the proper value of ARRAY_SIZE, right?

Quoted 3 lines

So testing this RC on on Fedora 23 with gcc 5.3.1 I see the same failure, I didn't see it with 2016.01 when using 5.3.1 so I'm not sure what's changed there

OK, so maybe unrelated to gcc 6. Could you git bisect?

Quoted 1 line

Peter

Amicalement,

Signature · 1 line
Albert.
#6 lore raw

PATCH 2/3 common: env_flags: include common.h even for HOST_CC

Quoted 45 lines · Albert ARIBAUD

Hello Peter,

Quoted 41 lines · Peter Robinson

Hi Albert,

Quoted 36 lines · Albert ARIBAUD

Hello Peter,

Quoted 23 lines · Peter Robinson

When compiling with gcc 6 we get the following error due to ARRAY_SIZE being defined elsewhere.

common/env_flags.c:155: undefined reference to `ARRAY_SIZE'

---
 common/env_flags.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
common/env_flags.c +1 -0
index 9c3aed1..696adef 100644
@@ -7,6 +7,7 @@
 
 #include <linux/string.h>
 #include <linux/ctype.h>
+#include <common.h>
 
 #ifdef USE_HOSTCC /* Eliminate "ANSI does not permit..." warnings */
 #include <stdint.h>

common/env_flags.c line 21

Quoted 6 lines
common/env_flags.c +0 -1
@@ -16,7 +17,6 @@
 #include <env_flags.h>
 #define getenv fw_getenv
 #else
-#include <common.h>
 #include <environment.h>
 #endif

How come this happens only with gcc-6? Previous compilers surely did not 'guess' the proper value of ARRAY_SIZE, right?

Quoted 5 lines
Quoted 3 lines

So testing this RC on on Fedora 23 with gcc 5.3.1 I see the same failure, I didn't see it with 2016.01 when using 5.3.1 so I'm not sure what's changed there

OK, so maybe unrelated to gcc 6. Could you git bisect?

Please, gcc 5.3.x is one of my regular tests now. But I don't do a tools only build (tossing that on my TODO list..).

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160203/61d13f1e/attachment.sig>
#7 lore raw

PATCH 2/3 common: env_flags: include common.h even for HOST_CC

In reply to Peter Robinson
Quoted 6 lines · Peter Robinson

When compiling with gcc 6 we get the following error due to ARRAY_SIZE being defined elsewhere.

common/env_flags.c:155: undefined reference to `ARRAY_SIZE'

I'm going to take http://patchwork.ozlabs.org/patch/582527/ to fix this instead as I don't want to say that common.h must work in the case of USE_HOSTCC==true (I'm surprised it did, in fact). Thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160215/86a2b068/attachment.sig>
#8 lore raw

PATCH 2/3 common: env_flags: include common.h even for HOST_CC

Quoted 10 lines
Quoted 6 lines

When compiling with gcc 6 we get the following error due to ARRAY_SIZE being defined elsewhere.

common/env_flags.c:155: undefined reference to `ARRAY_SIZE'

I'm going to take http://patchwork.ozlabs.org/patch/582527/ to fix this instead as I don't want to say that common.h must work in the case of USE_HOSTCC==true (I'm surprised it did, in fact). Thanks!

What ever was pulled into RC2 works for me but I still needed my gcc6 patch.

Peter

#9 lore raw

PATCH 2/3 common: env_flags: include common.h even for HOST_CC

Quoted 5 lines · Peter Robinson
Quoted 5 lines
Quoted 5 lines

When compiling with gcc 6 we get the following error due to ARRAY_SIZE being defined elsewhere.

common/env_flags.c:155: undefined reference to `ARRAY_SIZE'

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

I'm going to take http://patchwork.ozlabs.org/patch/582527/ to fix this instead as I don't want to say that common.h must work in the case of USE_HOSTCC==true (I'm surprised it did, in fact). Thanks!

What ever was pulled into RC2 works for me but I still needed my gcc6 patch.

Somewhere along the lines, Linux stopped having compiler-gccN.h and just has compiler-gcc.h and compiler-clang.h. Would you feel up to making a pass at migrating those changes or should I? Thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160216/a3c77ee0/attachment.sig>
#10 lore raw

[U-Boot] your mail

In reply to Peter Robinson
Quoted 9 lines · Peter Robinson

Hi All,

Here's a couple of patches to help building on gcc-6. We're rebasing Fedora to gcc-6 for Fedora 24 so this was the first build I've attempted with it. It doesn't fix all problems as I also see an issue that the generated/generic-asm-offsets.h isn't generated early enough in the build process but I couldn't quite work out how to move the generation of that earlier in the process. Full logs of that at the link below.

Cheers,
Peter

https://kojipkgs.fedoraproject.org//work/tasks/1747/12801747/build.log

Oh fun, I saw some gcc-6 packages in debian/unstable but not a way to make them be "$arch-gcc" and not "$arch-gcc-6". At least with respect to this error, do you see it in the kernel too? If not, maybe there's a semi recent patch we need?

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160203/03335584/attachment.sig>
#11 lore raw

[U-Boot] your mail

Quoted 11 lines
Quoted 6 lines

Here's a couple of patches to help building on gcc-6. We're rebasing Fedora to gcc-6 for Fedora 24 so this was the first build I've attempted with it. It doesn't fix all problems as I also see an issue that the generated/generic-asm-offsets.h isn't generated early enough in the build process but I couldn't quite work out how to move the generation of that earlier in the process. Full logs of that at the link below.

Cheers,
Peter

https://kojipkgs.fedoraproject.org//work/tasks/1747/12801747/build.log

Oh fun, I saw some gcc-6 packages in debian/unstable but not a way to make them be "$arch-gcc" and not "$arch-gcc-6". At least with respect to this error, do you see it in the kernel too? If not, maybe there's a semi recent patch we need?

I'm not sure if there was issues with the kernel, there could have been since it landed as was fixed before I noticed or maybe the kernel was tested by the toolchains team, I'll see if I can find out.

Peter