[U-Boot] (no subject)

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

Add initial support for gcc6 by taking a copy of compiler-gcc5.h
Signed-off-by: Peter Robinson pbrobinson@gmail.com --- include/linux/compiler-gcc6.h | 65 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 include/linux/compiler-gcc6.h
diff --git a/include/linux/compiler-gcc6.h b/include/linux/compiler-gcc6.h new file mode 100644 index 0000000..622117b --- /dev/null +++ b/include/linux/compiler-gcc6.h @@ -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 */

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'
Signed-off-by: Peter Robinson pbrobinson@gmail.com --- common/env_flags.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/common/env_flags.c b/common/env_flags.c index 9c3aed1..696adef 100644 --- a/common/env_flags.c +++ b/common/env_flags.c @@ -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

Hello Peter,
On Wed, 3 Feb 2016 12:42:51 +0000, Peter Robinson pbrobinson@gmail.com wrote:
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'
Signed-off-by: Peter Robinson pbrobinson@gmail.com
common/env_flags.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/common/env_flags.c b/common/env_flags.c index 9c3aed1..696adef 100644 --- a/common/env_flags.c +++ b/common/env_flags.c @@ -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
How come this happens only with gcc-6? Previous compilers surely did not 'guess' the proper value of ARRAY_SIZE, right?
-- 2.5.0
U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Amicalement,

Hi Albert,
On Wed, Feb 3, 2016 at 1:41 PM, Albert ARIBAUD albert.u.boot@aribaud.net wrote:
Hello Peter,
On Wed, 3 Feb 2016 12:42:51 +0000, Peter Robinson pbrobinson@gmail.com wrote:
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'
Signed-off-by: Peter Robinson pbrobinson@gmail.com
common/env_flags.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/common/env_flags.c b/common/env_flags.c index 9c3aed1..696adef 100644 --- a/common/env_flags.c +++ b/common/env_flags.c @@ -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
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

Hello Peter,
On Wed, 3 Feb 2016 16:11:38 +0000, Peter Robinson pbrobinson@gmail.com wrote:
Hi Albert,
On Wed, Feb 3, 2016 at 1:41 PM, Albert ARIBAUD albert.u.boot@aribaud.net wrote:
Hello Peter,
On Wed, 3 Feb 2016 12:42:51 +0000, Peter Robinson pbrobinson@gmail.com wrote:
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'
Signed-off-by: Peter Robinson pbrobinson@gmail.com
common/env_flags.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/common/env_flags.c b/common/env_flags.c index 9c3aed1..696adef 100644 --- a/common/env_flags.c +++ b/common/env_flags.c @@ -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
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
OK, so maybe unrelated to gcc 6. Could you git bisect?
Peter
Amicalement,

On Wed, Feb 03, 2016 at 06:53:11PM +0100, Albert ARIBAUD wrote:
Hello Peter,
On Wed, 3 Feb 2016 16:11:38 +0000, Peter Robinson pbrobinson@gmail.com wrote:
Hi Albert,
On Wed, Feb 3, 2016 at 1:41 PM, Albert ARIBAUD albert.u.boot@aribaud.net wrote:
Hello Peter,
On Wed, 3 Feb 2016 12:42:51 +0000, Peter Robinson pbrobinson@gmail.com wrote:
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'
Signed-off-by: Peter Robinson pbrobinson@gmail.com
common/env_flags.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/common/env_flags.c b/common/env_flags.c index 9c3aed1..696adef 100644 --- a/common/env_flags.c +++ b/common/env_flags.c @@ -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
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
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..).

On Wed, Feb 03, 2016 at 12:42:51PM +0000, Peter Robinson wrote:
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'
Signed-off-by: Peter Robinson pbrobinson@gmail.com
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!

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'
Signed-off-by: Peter Robinson pbrobinson@gmail.com
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

On Tue, Feb 16, 2016 at 11:19:43AM +0000, Peter Robinson wrote:
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'
Signed-off-by: Peter Robinson pbrobinson@gmail.com
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!

On Wed, Feb 03, 2016 at 12:42:49PM +0000, Peter Robinson wrote:
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?

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
participants (3)
-
Albert ARIBAUD
-
Peter Robinson
-
Tom Rini