[PATCH] powerpc/boot: Remove duplicate typedefs from libfdt_env.h

Subsystems: linux for powerpc (32-bit and 64-bit), the rest

STALE3110d

9 messages, 4 authors, 2018-04-03 · open the first message on its own page

[PATCH] powerpc/boot: Remove duplicate typedefs from libfdt_env.h

From: Mark Greer <mgreer@animalcreek.com>
Date: 2018-03-16 21:54:49

When building a uImage or zImage using ppc6xx_defconfig and some other
defconfigs, the following error occurs:

  BOOTCC  arch/powerpc/boot/fdt.o
  In file included from arch/powerpc/boot/fdt.c:51:0:
  ../arch/powerpc/boot/libfdt_env.h:10:13: error: redefinition of typedef 'uint32_t'
  ../arch/powerpc/boot/types.h:21:13: note: previous declaration of 'uint32_t' was here
  ../arch/powerpc/boot/libfdt_env.h:11:13: error: redefinition of typedef 'uint64_t'
  ../arch/powerpc/boot/types.h:22:13: note: previous declaration of 'uint64_t' was here
  ../arch/powerpc/boot/Makefile:210: recipe for target 'arch/powerpc/boot/fdt.o' failed
  make[2]: *** [arch/powerpc/boot/fdt.o] Error 1

The problem is that commit 656ad58ef19e (powerpc/boot: Add OPAL console
to epapr wrappers) adds typedefs for uint32_t and uint64_t to type.h but
doesn't remove the pre-existing (and now duplicate) typedefs from
libfdt_env.h.  Fix the error by removing the duplicat typedefs from
libfdt_env.h

CC: David Gibson <redacted>
CC: Oliver O'Halloran <oohall@gmail.com>
Signed-off-by: Mark Greer <mgreer@animalcreek.com>
---
Having said all of that, commit 656ad58ef19e (powerpc/boot: Add OPAL
console to epapr wrappers) went into mainline back in 2016 so, AFAICT,
this has been broken since then.  That seems unlikely so I must be
missing something...  Any ideas what that is?

I built all of the defconfigs that I had toolchains handy for (really
just old-fashioned ppc32, non-booke) so I didn't test everything.
Compile tested only as I no longer have any relevant hardware.

Based on git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux fixes
currently at e4b79900222b (powerpc/64s: Fix NULL AT_BASE_PLATFORM when
using DT CPU features).

 arch/powerpc/boot/libfdt_env.h | 2 --
 1 file changed, 2 deletions(-)
diff --git a/arch/powerpc/boot/libfdt_env.h b/arch/powerpc/boot/libfdt_env.h
index f52c31b1f48f..2a0c8b1bf147 100644
--- a/arch/powerpc/boot/libfdt_env.h
+++ b/arch/powerpc/boot/libfdt_env.h
@@ -7,8 +7,6 @@
 
 #include "of.h"
 
-typedef u32 uint32_t;
-typedef u64 uint64_t;
 typedef unsigned long uintptr_t;
 
 typedef __be16 fdt16_t;
-- 
2.16.1

Re: [PATCH] powerpc/boot: Remove duplicate typedefs from libfdt_env.h

From: Christophe LEROY <hidden>
Date: 2018-03-19 08:53:15


Le 16/03/2018 à 22:54, Mark Greer a écrit :
When building a uImage or zImage using ppc6xx_defconfig and some other
defconfigs, the following error occurs:

   BOOTCC  arch/powerpc/boot/fdt.o
   In file included from arch/powerpc/boot/fdt.c:51:0:
   ../arch/powerpc/boot/libfdt_env.h:10:13: error: redefinition of typedef 'uint32_t'
   ../arch/powerpc/boot/types.h:21:13: note: previous declaration of 'uint32_t' was here
   ../arch/powerpc/boot/libfdt_env.h:11:13: error: redefinition of typedef 'uint64_t'
   ../arch/powerpc/boot/types.h:22:13: note: previous declaration of 'uint64_t' was here
   ../arch/powerpc/boot/Makefile:210: recipe for target 'arch/powerpc/boot/fdt.o' failed
   make[2]: *** [arch/powerpc/boot/fdt.o] Error 1

The problem is that commit 656ad58ef19e (powerpc/boot: Add OPAL console
to epapr wrappers) adds typedefs for uint32_t and uint64_t to type.h but
doesn't remove the pre-existing (and now duplicate) typedefs from
libfdt_env.h.  Fix the error by removing the duplicat typedefs from
libfdt_env.h

CC: David Gibson <redacted>
CC: Oliver O'Halloran <oohall@gmail.com>
Signed-off-by: Mark Greer <mgreer@animalcreek.com>
---
Having said all of that, commit 656ad58ef19e (powerpc/boot: Add OPAL
console to epapr wrappers) went into mainline back in 2016 so, AFAICT,
this has been broken since then.  That seems unlikely so I must be
missing something...  Any ideas what that is?
I just compiled uImage for ppc6xx_defconfig, and I don't get such error.
I looked at what gcc -E outputs, u32 is defined twice but it doesn't seems to bother GCC.

What version of GCC do you use ?
I tried with 5.4.0 and 4.6.3, both seems to work.

Christophe
quoted hunk
I built all of the defconfigs that I had toolchains handy for (really
just old-fashioned ppc32, non-booke) so I didn't test everything.
Compile tested only as I no longer have any relevant hardware.

Based on git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux fixes
currently at e4b79900222b (powerpc/64s: Fix NULL AT_BASE_PLATFORM when
using DT CPU features).

  arch/powerpc/boot/libfdt_env.h | 2 --
  1 file changed, 2 deletions(-)
diff --git a/arch/powerpc/boot/libfdt_env.h b/arch/powerpc/boot/libfdt_env.h
index f52c31b1f48f..2a0c8b1bf147 100644
--- a/arch/powerpc/boot/libfdt_env.h
+++ b/arch/powerpc/boot/libfdt_env.h
@@ -7,8 +7,6 @@
  
  #include "of.h"
  
-typedef u32 uint32_t;
-typedef u64 uint64_t;
  typedef unsigned long uintptr_t;
  
  typedef __be16 fdt16_t;

Re: [PATCH] powerpc/boot: Remove duplicate typedefs from libfdt_env.h

From: Mark Greer <mgreer@animalcreek.com>
Date: 2018-03-19 16:02:20

On Mon, Mar 19, 2018 at 09:53:09AM +0100, Christophe LEROY wrote:

Le 16/03/2018 à 22:54, Mark Greer a écrit :
quoted
When building a uImage or zImage using ppc6xx_defconfig and some other
defconfigs, the following error occurs:

  BOOTCC  arch/powerpc/boot/fdt.o
  In file included from arch/powerpc/boot/fdt.c:51:0:
  ../arch/powerpc/boot/libfdt_env.h:10:13: error: redefinition of typedef 'uint32_t'
  ../arch/powerpc/boot/types.h:21:13: note: previous declaration of 'uint32_t' was here
  ../arch/powerpc/boot/libfdt_env.h:11:13: error: redefinition of typedef 'uint64_t'
  ../arch/powerpc/boot/types.h:22:13: note: previous declaration of 'uint64_t' was here
  ../arch/powerpc/boot/Makefile:210: recipe for target 'arch/powerpc/boot/fdt.o' failed
  make[2]: *** [arch/powerpc/boot/fdt.o] Error 1

The problem is that commit 656ad58ef19e (powerpc/boot: Add OPAL console
to epapr wrappers) adds typedefs for uint32_t and uint64_t to type.h but
doesn't remove the pre-existing (and now duplicate) typedefs from
libfdt_env.h.  Fix the error by removing the duplicat typedefs from
libfdt_env.h

CC: David Gibson <redacted>
CC: Oliver O'Halloran <oohall@gmail.com>
Signed-off-by: Mark Greer <mgreer@animalcreek.com>
---
Having said all of that, commit 656ad58ef19e (powerpc/boot: Add OPAL
console to epapr wrappers) went into mainline back in 2016 so, AFAICT,
this has been broken since then.  That seems unlikely so I must be
missing something...  Any ideas what that is?
I just compiled uImage for ppc6xx_defconfig, and I don't get such error.
I looked at what gcc -E outputs, u32 is defined twice but it doesn't seems
to bother GCC.

What version of GCC do you use ?
I tried with 5.4.0 and 4.6.3, both seems to work.

Christophe
Hi Christophe.

That's interesting.  I would expect an error regardless of version.

I used an old 4.5.1 gcc that I had laying around (from denx, iirc).
I'll find a newer one and try it.

Either way, it seems to me that we should remove the duplicate definitions.
Do you agree?

Thanks,

Mark
--

Re: [PATCH] powerpc/boot: Remove duplicate typedefs from libfdt_env.h

From: christophe leroy <hidden>
Date: 2018-03-19 17:36:08


Le 19/03/2018 à 17:02, Mark Greer a écrit :
On Mon, Mar 19, 2018 at 09:53:09AM +0100, Christophe LEROY wrote:
quoted

Le 16/03/2018 à 22:54, Mark Greer a écrit :
quoted
When building a uImage or zImage using ppc6xx_defconfig and some other
defconfigs, the following error occurs:

   BOOTCC  arch/powerpc/boot/fdt.o
   In file included from arch/powerpc/boot/fdt.c:51:0:
   ../arch/powerpc/boot/libfdt_env.h:10:13: error: redefinition of typedef 'uint32_t'
   ../arch/powerpc/boot/types.h:21:13: note: previous declaration of 'uint32_t' was here
   ../arch/powerpc/boot/libfdt_env.h:11:13: error: redefinition of typedef 'uint64_t'
   ../arch/powerpc/boot/types.h:22:13: note: previous declaration of 'uint64_t' was here
   ../arch/powerpc/boot/Makefile:210: recipe for target 'arch/powerpc/boot/fdt.o' failed
   make[2]: *** [arch/powerpc/boot/fdt.o] Error 1

The problem is that commit 656ad58ef19e (powerpc/boot: Add OPAL console
to epapr wrappers) adds typedefs for uint32_t and uint64_t to type.h but
doesn't remove the pre-existing (and now duplicate) typedefs from
libfdt_env.h.  Fix the error by removing the duplicat typedefs from
libfdt_env.h

CC: David Gibson <redacted>
CC: Oliver O'Halloran <oohall@gmail.com>
Signed-off-by: Mark Greer <mgreer@animalcreek.com>
---
Having said all of that, commit 656ad58ef19e (powerpc/boot: Add OPAL
console to epapr wrappers) went into mainline back in 2016 so, AFAICT,
this has been broken since then.  That seems unlikely so I must be
missing something...  Any ideas what that is?
I just compiled uImage for ppc6xx_defconfig, and I don't get such error.
I looked at what gcc -E outputs, u32 is defined twice but it doesn't seems
to bother GCC.

What version of GCC do you use ?
I tried with 5.4.0 and 4.6.3, both seems to work.

Christophe
Hi Christophe.

That's interesting.  I would expect an error regardless of version.

I used an old 4.5.1 gcc that I had laying around (from denx, iirc).
I'll find a newer one and try it.

Either way, it seems to me that we should remove the duplicate definitions.
Do you agree?
Yes I agree. I was however intrigued by your statement that compilation should have been broken since 2016.

Christophe
Thanks,

Mark
--
---
L'absence de virus dans ce courrier électronique a été vérifiée par le logiciel antivirus Avast.
https://www.avast.com/antivirus

Re: [PATCH] powerpc/boot: Remove duplicate typedefs from libfdt_env.h

From: Oliver <oohall@gmail.com>
Date: 2018-03-19 23:55:10

On Tue, Mar 20, 2018 at 3:02 AM, Mark Greer [off-list ref] wrote:
On Mon, Mar 19, 2018 at 09:53:09AM +0100, Christophe LEROY wrote:
quoted

Le 16/03/2018 =C3=A0 22:54, Mark Greer a =C3=A9crit :
quoted
When building a uImage or zImage using ppc6xx_defconfig and some other
defconfigs, the following error occurs:

  BOOTCC  arch/powerpc/boot/fdt.o
  In file included from arch/powerpc/boot/fdt.c:51:0:
  ../arch/powerpc/boot/libfdt_env.h:10:13: error: redefinition of type=
def 'uint32_t'
quoted
quoted
  ../arch/powerpc/boot/types.h:21:13: note: previous declaration of 'u=
int32_t' was here
quoted
quoted
  ../arch/powerpc/boot/libfdt_env.h:11:13: error: redefinition of type=
def 'uint64_t'
quoted
quoted
  ../arch/powerpc/boot/types.h:22:13: note: previous declaration of 'u=
int64_t' was here
quoted
quoted
  ../arch/powerpc/boot/Makefile:210: recipe for target 'arch/powerpc/b=
oot/fdt.o' failed
quoted
quoted
  make[2]: *** [arch/powerpc/boot/fdt.o] Error 1

The problem is that commit 656ad58ef19e (powerpc/boot: Add OPAL console
to epapr wrappers) adds typedefs for uint32_t and uint64_t to type.h bu=
t
quoted
quoted
doesn't remove the pre-existing (and now duplicate) typedefs from
libfdt_env.h.  Fix the error by removing the duplicat typedefs from
libfdt_env.h

CC: David Gibson <redacted>
CC: Oliver O'Halloran <oohall@gmail.com>
Signed-off-by: Mark Greer <mgreer@animalcreek.com>
---
Having said all of that, commit 656ad58ef19e (powerpc/boot: Add OPAL
console to epapr wrappers) went into mainline back in 2016 so, AFAICT,
this has been broken since then.  That seems unlikely so I must be
missing something...  Any ideas what that is?
I just compiled uImage for ppc6xx_defconfig, and I don't get such error.
I looked at what gcc -E outputs, u32 is defined twice but it doesn't see=
ms
quoted
to bother GCC.

What version of GCC do you use ?
I tried with 5.4.0 and 4.6.3, both seems to work.

Christophe
Hi Christophe.

That's interesting.  I would expect an error regardless of version.

I used an old 4.5.1 gcc that I had laying around (from denx, iirc).
I'll find a newer one and try it.
Yeah that's pretty odd. It might be a bug in your specific version of
GCC since I can't replicate it with this dumb test case:

#include <stdio.h>
typedef unsigned int            u32;

typedef u32 uint32_t;
typedef u32 uint32_t;

int main(void) {
        uint32_t test =3D 0;
        printf("%u\n", test);
        return 0;
}

Does that result in an error?
Either way, it seems to me that we should remove the duplicate definition=
s.
Do you agree?
It wouldn't hurt to remove those definitions from libfdt_env.h. That
file includes types.h directly anyway so there's not much point in
them being there.

Thanks,
Oliver

Re: [PATCH] powerpc/boot: Remove duplicate typedefs from libfdt_env.h

From: Mark Greer <mgreer@animalcreek.com>
Date: 2018-03-30 02:22:58

On Tue, Mar 20, 2018 at 10:55:07AM +1100, Oliver wrote:
On Tue, Mar 20, 2018 at 3:02 AM, Mark Greer [off-list ref] wrote:
quoted
On Mon, Mar 19, 2018 at 09:53:09AM +0100, Christophe LEROY wrote:
quoted

Le 16/03/2018 à 22:54, Mark Greer a écrit :
quoted
When building a uImage or zImage using ppc6xx_defconfig and some other
defconfigs, the following error occurs:

  BOOTCC  arch/powerpc/boot/fdt.o
  In file included from arch/powerpc/boot/fdt.c:51:0:
  ../arch/powerpc/boot/libfdt_env.h:10:13: error: redefinition of typedef 'uint32_t'
  ../arch/powerpc/boot/types.h:21:13: note: previous declaration of 'uint32_t' was here
  ../arch/powerpc/boot/libfdt_env.h:11:13: error: redefinition of typedef 'uint64_t'
  ../arch/powerpc/boot/types.h:22:13: note: previous declaration of 'uint64_t' was here
  ../arch/powerpc/boot/Makefile:210: recipe for target 'arch/powerpc/boot/fdt.o' failed
  make[2]: *** [arch/powerpc/boot/fdt.o] Error 1

The problem is that commit 656ad58ef19e (powerpc/boot: Add OPAL console
to epapr wrappers) adds typedefs for uint32_t and uint64_t to type.h but
doesn't remove the pre-existing (and now duplicate) typedefs from
libfdt_env.h.  Fix the error by removing the duplicat typedefs from
libfdt_env.h

CC: David Gibson <redacted>
CC: Oliver O'Halloran <oohall@gmail.com>
Signed-off-by: Mark Greer <mgreer@animalcreek.com>
---
Having said all of that, commit 656ad58ef19e (powerpc/boot: Add OPAL
console to epapr wrappers) went into mainline back in 2016 so, AFAICT,
this has been broken since then.  That seems unlikely so I must be
missing something...  Any ideas what that is?
I just compiled uImage for ppc6xx_defconfig, and I don't get such error.
I looked at what gcc -E outputs, u32 is defined twice but it doesn't seems
to bother GCC.

What version of GCC do you use ?
I tried with 5.4.0 and 4.6.3, both seems to work.

Christophe
Hi Christophe.

That's interesting.  I would expect an error regardless of version.

I used an old 4.5.1 gcc that I had laying around (from denx, iirc).
I'll find a newer one and try it.
Yeah that's pretty odd. It might be a bug in your specific version of
GCC since I can't replicate it with this dumb test case:

#include <stdio.h>
typedef unsigned int            u32;

typedef u32 uint32_t;
typedef u32 uint32_t;

int main(void) {
        uint32_t test = 0;
        printf("%u\n", test);
        return 0;
}

Does that result in an error?
Hi Oliver.  I'm very sorry for the long delay in responding.

This fail to compile too:

$ cat test.c
#include <stdio.h>
typedef unsigned int u32;

typedef u32 uint32_t;
typedef u32 uint32_t;

int main(void) {
	uint32_t test = 0;
	printf("%u\n", test);
	return 0;
}
$
$ powerpc-linux-gnu-gcc -o test test.c
test.c:5:13: error: redefinition of typedef 'uint32_t'
test.c:4:13: note: previous declaration of 'uint32_t' was here
quoted
Either way, it seems to me that we should remove the duplicate definitions.
Do you agree?
It wouldn't hurt to remove those definitions from libfdt_env.h. That
file includes types.h directly anyway so there's not much point in
them being there.
+1

Mark
--

Re: [PATCH] powerpc/boot: Remove duplicate typedefs from libfdt_env.h

From: Mark Greer <mgreer@animalcreek.com>
Date: 2018-03-30 02:26:56

On Thu, Mar 29, 2018 at 07:22:50PM -0700, Mark Greer wrote:
On Tue, Mar 20, 2018 at 10:55:07AM +1100, Oliver wrote:
quoted
Yeah that's pretty odd. It might be a bug in your specific version of
GCC since I can't replicate it with this dumb test case:

#include <stdio.h>
typedef unsigned int            u32;

typedef u32 uint32_t;
typedef u32 uint32_t;

int main(void) {
        uint32_t test = 0;
        printf("%u\n", test);
        return 0;
}

Does that result in an error?
Hi Oliver.  I'm very sorry for the long delay in responding.

This fail to compile too:

$ cat test.c
#include <stdio.h>
typedef unsigned int u32;

typedef u32 uint32_t;
typedef u32 uint32_t;

int main(void) {
	uint32_t test = 0;
	printf("%u\n", test);
	return 0;
}
$
$ powerpc-linux-gnu-gcc -o test test.c
test.c:5:13: error: redefinition of typedef 'uint32_t'
test.c:4:13: note: previous declaration of 'uint32_t' was here
And I meant to add:

$ powerpc-linux-gnu-gcc --version
powerpc-linux-gnu-gcc (Sourcery G++ Lite 2010.09-55) 4.5.1
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

So, yeah, its really old.

I'll get a newer one and test it.

Mark
--

Re: [PATCH] powerpc/boot: Remove duplicate typedefs from libfdt_env.h

From: Mark Greer <mgreer@animalcreek.com>
Date: 2018-03-31 02:42:37

On Thu, Mar 29, 2018 at 07:26:52PM -0700, Mark Greer wrote:
On Thu, Mar 29, 2018 at 07:22:50PM -0700, Mark Greer wrote:
quoted
On Tue, Mar 20, 2018 at 10:55:07AM +1100, Oliver wrote:
quoted
quoted
Yeah that's pretty odd. It might be a bug in your specific version of
GCC since I can't replicate it with this dumb test case:

#include <stdio.h>
typedef unsigned int            u32;

typedef u32 uint32_t;
typedef u32 uint32_t;

int main(void) {
        uint32_t test = 0;
        printf("%u\n", test);
        return 0;
}

Does that result in an error?
Hi Oliver.  I'm very sorry for the long delay in responding.

This fail to compile too:

$ cat test.c
#include <stdio.h>
typedef unsigned int u32;

typedef u32 uint32_t;
typedef u32 uint32_t;

int main(void) {
	uint32_t test = 0;
	printf("%u\n", test);
	return 0;
}
$
$ powerpc-linux-gnu-gcc -o test test.c
test.c:5:13: error: redefinition of typedef 'uint32_t'
test.c:4:13: note: previous declaration of 'uint32_t' was here
And I meant to add:

$ powerpc-linux-gnu-gcc --version
powerpc-linux-gnu-gcc (Sourcery G++ Lite 2010.09-55) 4.5.1
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

So, yeah, its really old.

I'll get a newer one and test it.
I downloaded this version from denx.de (thank you, Wolfgang):

$ powerpc-linux-gcc --version
powerpc-linux-gcc (GCC) 4.8.2
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Its still dated but its the best prebuilt version that I could find easily
available.  With this version, the kernel (ppc6xx_defconfig) built without
issue.

Thanks to all who helped me through this.

To Ben or whoever, I think the original patch is still worth applying even
if it isn't critical.

Thanks,

Mark
--

Re: powerpc/boot: Remove duplicate typedefs from libfdt_env.h

From: Michael Ellerman <hidden>
Date: 2018-04-03 16:03:38

On Fri, 2018-03-16 at 21:54:43 UTC, Mark Greer wrote:
When building a uImage or zImage using ppc6xx_defconfig and some other
defconfigs, the following error occurs:

  BOOTCC  arch/powerpc/boot/fdt.o
  In file included from arch/powerpc/boot/fdt.c:51:0:
  ../arch/powerpc/boot/libfdt_env.h:10:13: error: redefinition of typedef 'uint32_t'
  ../arch/powerpc/boot/types.h:21:13: note: previous declaration of 'uint32_t' was here
  ../arch/powerpc/boot/libfdt_env.h:11:13: error: redefinition of typedef 'uint64_t'
  ../arch/powerpc/boot/types.h:22:13: note: previous declaration of 'uint64_t' was here
  ../arch/powerpc/boot/Makefile:210: recipe for target 'arch/powerpc/boot/fdt.o' failed
  make[2]: *** [arch/powerpc/boot/fdt.o] Error 1

The problem is that commit 656ad58ef19e (powerpc/boot: Add OPAL console
to epapr wrappers) adds typedefs for uint32_t and uint64_t to type.h but
doesn't remove the pre-existing (and now duplicate) typedefs from
libfdt_env.h.  Fix the error by removing the duplicat typedefs from
libfdt_env.h

CC: David Gibson <redacted>
CC: Oliver O'Halloran <oohall@gmail.com>
Signed-off-by: Mark Greer <mgreer@animalcreek.com>
Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/147704534e2de30dd47171d55240c3

cheers
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help