PowerPC: Change -fpic flag to -fPIC flag in the config.mk
PATCH 1/1 PowerPC: Change -fpic flag to -fPIC flag in the config.mk
The -fPIC/-fpic flag belongs with -mrelocatable. The -fpic flag can limit the size of the GOT and produce smaller binaries, so it causes some GOT entries to be lost in the gcc 4.6 version. But -fPIC flag allows the maximum possible size of the GOT entries.
However, currently -mrelocatable promotes -fpic flag to -fPIC flag.
This reverts that portion of the
commit 33ee4c92339ee386662c0ee2d221098c5cc8b07e.
--- arch/powerpc/config.mk | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
arch/powerpc/config.mk +1 -1
@@ -25,7 +25,7 @@ CROSS_COMPILE ?= ppc_8xx- CONFIG_STANDALONE_LOAD_ADDR ?= 0x40000 LDFLAGS_FINAL += --gc-sections -PLATFORM_RELFLAGS += -fpic -mrelocatable -ffunction-sections -fdata-sections +PLATFORM_RELFLAGS += -fPIC -mrelocatable -ffunction-sections -fdata-sections PLATFORM_CPPFLAGS += -DCONFIG_PPC -D__powerpc__ PLATFORM_LDFLAGS += -n
Signature · 1 line
1.5.6.5
PATCH 1/1 PowerPC: Change -fpic flag to -fPIC flag in the config.mk
Dear Chunhe Lan,
Quoted 9 lines · In message <[email protected]> you…
The -fPIC/-fpic flag belongs with -mrelocatable. The -fpic flag can limit the size of the GOT and produce smaller binaries, so it causes some GOT entries to be lost in the gcc 4.6 version. But -fPIC flag allows the maximum possible size of the GOT entries.
However, currently -mrelocatable promotes -fpic flag to -fPIC flag.
This reverts that portion of the
commit33ee4c92339ee386662c0ee2d221098c5cc8b07e.
As you state yourself, your modification has the negative impact of increasing the image size. What would be the benefits of it?
Are you trying to fix any specific problem? Which one? I am not aware of any related isses for any of the mainline PowerPC systems...
Best regards,
Wolfgang Denk
Signature · 4 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de If ignorance is bliss, why aren't there more happy people?
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 1/1 PowerPC: Change -fpic flag to -fPIC flag in the config.mk
Dear Chunhe Lan,
Quoted 4 lines · In message <[email protected]> you wrote:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html>
<head>
<meta content=3D"text/html;charset=3DUTF-8" http-equiv=3D"Content-Type"=
Message unreadable, ignored. Please post plain text only.
Wolfgang Denk
Signature · 5 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: [email protected] I have the simplest tastes. I am always satisfied with the best. -- Oscar Wilde
PATCH 1/1 PowerPC: Change -fpic flag to -fPIC flag in the config.mk
In reply to Wolfgang DenkQuoted 11 lines · Wolfgang Denk
Dear Chunhe Lan,
In message <[email protected]>
Quoted 7 lines · you
The -fPIC/-fpic flag belongs with -mrelocatable. The -fpic flag can limit the size of the GOT and produce smaller binaries, so it causes some GOT entries to be lost in the gcc 4.6 version. But -fPIC flag allows the maximum possible size of the GOT entries.
However, currently -mrelocatable promotes -fpic flag to -fPIC flag.
Quoted 8 lines
Quoted 2 lines
This reverts that portion of the
commit33ee4c92339ee386662c0ee2d221098c5cc8b07e.As you state yourself, your modification has the negative impact of increasing the image size. What would be the benefits of it?
Are you trying to fix any specific problem? Which one? I am not aware of any related isses for any of the mainline PowerPC systems...
Yes, I have fixed the booting issue of nand u-boot of
P1010/P1022/P1023/P2020 with this patch.
When use gcc 4.5 version, produce the size of u-boot-nand.bin to be
same with -fpic or -fPIC.
The u-boot-nand.bin is OK.
But when use gcc 4.6 version, produce the size of u-boot-nand.bin to
be different with -fpic or -fPIC.
The some GOT entries of u-boot-nand.bin are lost with -fpic(because
limit the size), so
u-boot-nand.bin hangs when booting. But use -fPIC, the
u-boot-nand.bin is OK.
And this patch reverts that portion of the commit33ee4c92339ee386662c0ee2d221098c5cc8b07e.
Thanks,
Chunhe
Quoted 5 lines
Best regards,
Wolfgang Denk
PATCH 1/1 PowerPC: Change -fpic flag to -fPIC flag in the config.mk
Dear Chunhe Lan,
Quoted 8 lines · In message <[email protected]> you wrote:
Quoted 6 lines
As you state yourself, your modification has the negative impact of increasing the image size. What would be the benefits of it?
Are you trying to fix any specific problem? Which one? I am not aware of any related isses for any of the mainline PowerPC systems...
Yes, I have fixed the booting issue of nand u-boot of
P1010/P1022/P1023/P2020 with this patch.
What exactly is "the booting issue" you mention here? Are you referring to any messages previously posted here? Which?
Quoted 6 lines
But when use gcc 4.6 version, produce the size of u-boot-nand.bin to
be different with -fpic or -fPIC.
The some GOT entries of u-boot-nand.bin are lost with -fpic(because
limit the size), so
u-boot-nand.bin hangs when booting. But use -fPIC, the
u-boot-nand.bin is OK.
What do you mean "GOT entries ... are lost"? Are there any error messages?
If yes, what exactly are these?
If not, then this has to be considered a serious bug in either the compiler and the linker, and it should be fixed there rather than being papered over.
Best regards,
Wolfgang Denk
Signature · 5 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de I think it's a new feature. Don't tell anyone it was an accident. :-) -- Larry Wall on s/foo/bar/eieio in <[email protected]>
PATCH 1/1 PowerPC: Change -fpic flag to -fPIC flag in the config.mk
In reply to Chunhe LanQuoted 6 lines
Quoted 2 lines · Wolfgang Denk
Dear Chunhe Lan,
Quoted 8 lines
Quoted 8 lines
In message <[email protected]>
Quoted 6 lines · you
The -fPIC/-fpic flag belongs with -mrelocatable. The -fpic flag can limit the size of the GOT and produce smaller binaries, so it causes some GOT entries to be lost in the gcc 4.6 version. But -fPIC flag allows the maximum possible size of the GOT entries.
However, currently -mrelocatable promotes -fpic flag to -fPIC flag.
Not in newer gcc's. I added this to gcc some time ago and I think it got into gcc 4.6.
Quoted 16 lines
Quoted 9 lines
Quoted 3 lines
This reverts that portion of the
commit33ee4c92339ee386662c0ee2d221098c5cc8b07e.As you state yourself, your modification has the negative impact of increasing the image size. What would be the benefits of it?
Are you trying to fix any specific problem? Which one? I am not aware of any related isses for any of the mainline PowerPC systems...
Yes, I have fixed the booting issue of nand u-boot of
P1010/P1022/P1023/P2020 with this patch.When use gcc 4.5 version, produce the size of u-boot-nand.bin to be
same with -fpic or -fPIC.
The u-boot-nand.bin is OK.
Quoted 6 lines
But when use gcc 4.6 version, produce the size of u-boot-nand.bin to
be different with -fpic or -fPIC.
The some GOT entries of u-boot-nand.bin are lost with -fpic(because
limit the size), so
u-boot-nand.bin hangs when booting. But use -fPIC, the
u-boot-nand.bin is OK.
Your linker file is buggy I think. I found u-boot-nand_spl.lds, is that the one? Check out that files reloc part:
.reloc : {
_GOT2_TABLE_ = .;
KEEP(*(.got2))
_FIXUP_TABLE_ = .;
KEEP(*(.fixup))
}
__got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >> 2;
__fixup_entries = (. - _FIXUP_TABLE_) >> 2;Compare that with(from u-boot.lds):
.reloc :
{
_GOT2_TABLE_ = .;
KEEP(*(.got2))
KEEP(*(.got))
PROVIDE(_GLOBAL_OFFSET_TABLE_ = . + 4);
_FIXUP_TABLE_ = .;
KEEP(*(.fixup)) }
__got2_entries = ((_GLOBAL_OFFSET_TABLE_ - _GOT2_TABLE_) >> 2) - 1; __fixup_entries = (. - _FIXUP_TABLE_) >> 2;
You may have to look at start.S for nand too
PATCH 1/1 PowerPC: Change -fpic flag to -fPIC flag in the config.mk
Quoted 1 line · Joakim Tjernlund
Your linker file is buggy I think. I found
u-boot-nand_spl.lds, is that the one?
That's the one for the SPL part.
Quoted 19 lines
Check out that files reloc part:
.reloc : { _GOT2_TABLE_ = .; KEEP(*(.got2)) _FIXUP_TABLE_ = .; KEEP(*(.fixup)) } __got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >> 2; __fixup_entries = (. - _FIXUP_TABLE_) >> 2;Compare that with(from
u-boot.lds):
.reloc :{ _GOT2_TABLE_ = .; KEEP(*(.got2)) KEEP(*(.got)) PROVIDE(_GLOBAL_OFFSET_TABLE_ = . + 4); _FIXUP_TABLE_ = .; KEEP(*(.fixup))
Quoted 3 lines
}
__got2_entries= ((_GLOBAL_OFFSET_TABLE_ - _GOT2_TABLE_) >> 2) - 1;__fixup_entries= (. - _FIXUP_TABLE_) >> 2;
I notice a difference between u-boot.lds and u-boot-nand.lds -- the latter (used for the main part of U-Boot when loaded from SPL) has:
Quoted 10 lines
.reloc :
{
KEEP(*(.got))
_GOT2_TABLE_ = .;
KEEP(*(.got2))
_FIXUP_TABLE_ = .;
KEEP(*(.fixup))
}
__got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >> 2;
__fixup_entries = (. - _FIXUP_TABLE_) >> 2;Is this wrong as well?
-Scott
PATCH 1/1 PowerPC: Change -fpic flag to -fPIC flag in the config.mk
Scott Wood <[email protected]> wrote on 2012/04/25 21:01:00:
Quoted 5 lines · Joakim Tjernlund
Quoted 1 line
Your linker file is buggy I think. I found
u-boot-nand_spl.lds, is that the one?That's the one for the SPL part.
OK, good.
Quoted 38 lines
Quoted 20 lines
Check out that files reloc part:
.reloc : { _GOT2_TABLE_ = .; KEEP(*(.got2)) _FIXUP_TABLE_ = .; KEEP(*(.fixup)) } __got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >> 2; __fixup_entries = (. - _FIXUP_TABLE_) >> 2;Compare that with(from
u-boot.lds):
.reloc :{ _GOT2_TABLE_ = .; KEEP(*(.got2)) KEEP(*(.got)) PROVIDE(_GLOBAL_OFFSET_TABLE_ = . + 4); _FIXUP_TABLE_ = .; KEEP(*(.fixup))Quoted 3 lines
}
__got2_entries= ((_GLOBAL_OFFSET_TABLE_ - _GOT2_TABLE_) >> 2) - 1;__fixup_entries= (. - _FIXUP_TABLE_) >> 2;I notice a difference between
u-boot.ldsandu-boot-nand.lds-- the latter (used for the main part of U-Boot when loaded from SPL) has:Quoted 10 lines
.reloc : { KEEP(*(.got)) _GOT2_TABLE_ = .; KEEP(*(.got2)) _FIXUP_TABLE_ = .; KEEP(*(.fixup)) } __got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >> 2; __fixup_entries = (. - _FIXUP_TABLE_) >> 2;
Quoted 1 line
Is this wrong as well?
Yes, I think so. This one does not care about the .got entries at all so I suspect never gcc's wont work.
Jocke
PATCH 1/1 PowerPC: Change -fpic flag to -fPIC flag in the config.mk
Quoted 47 lines · Joakim Tjernlund
Scott Wood <[email protected]> wrote on 2012/04/25 21:01:00:
Quoted 5 lines · Joakim Tjernlund
Quoted 1 line
Your linker file is buggy I think. I found
u-boot-nand_spl.lds, is that the one?That's the one for the SPL part.
OK, good.
Quoted 38 lines
Quoted 20 lines
Check out that files reloc part:
.reloc : { _GOT2_TABLE_ = .; KEEP(*(.got2)) _FIXUP_TABLE_ = .; KEEP(*(.fixup)) } __got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >> 2; __fixup_entries = (. - _FIXUP_TABLE_) >> 2;Compare that with(from
u-boot.lds):
.reloc :{ _GOT2_TABLE_ = .; KEEP(*(.got2)) KEEP(*(.got)) PROVIDE(_GLOBAL_OFFSET_TABLE_ = . + 4); _FIXUP_TABLE_ = .; KEEP(*(.fixup))Quoted 3 lines
}
__got2_entries= ((_GLOBAL_OFFSET_TABLE_ - _GOT2_TABLE_) >> 2) - 1;__fixup_entries= (. - _FIXUP_TABLE_) >> 2;I notice a difference between
u-boot.ldsandu-boot-nand.lds-- the latter (used for the main part of U-Boot when loaded from SPL) has:Quoted 10 lines
.reloc : { KEEP(*(.got)) _GOT2_TABLE_ = .; KEEP(*(.got2)) _FIXUP_TABLE_ = .; KEEP(*(.fixup)) } __got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >> 2; __fixup_entries = (. - _FIXUP_TABLE_) >> 2;
Quoted 4 lines
Quoted 1 line
Is this wrong as well?
Yes, I think so. This one does not care about the .got entries at all so I suspect never gcc's wont work.
Thanks.
I'm not entirely sure about the _GLOBAL_OFFSET_TABLE_ stuff, though -- what's wrong with the simpler version that uses _FIXUP_TABLE_?
-Scott
PATCH 1/1 PowerPC: Change -fpic flag to -fPIC flag in the config.mk
Scott Wood <[email protected]> wrote on 2012/04/26 23:26:52:
Quoted 51 lines · Joakim Tjernlund
Quoted 49 lines
Scott Wood <[email protected]> wrote on 2012/04/25 21:01:00:
Quoted 5 lines · Joakim Tjernlund
Quoted 1 line
Your linker file is buggy I think. I found
u-boot-nand_spl.lds, is that the one?That's the one for the SPL part.
OK, good.
Quoted 39 lines
Quoted 20 lines
Check out that files reloc part:
.reloc : { _GOT2_TABLE_ = .; KEEP(*(.got2)) _FIXUP_TABLE_ = .; KEEP(*(.fixup)) } __got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >> 2; __fixup_entries = (. - _FIXUP_TABLE_) >> 2;Compare that with(from
u-boot.lds):
.reloc :{ _GOT2_TABLE_ = .; KEEP(*(.got2)) KEEP(*(.got)) PROVIDE(_GLOBAL_OFFSET_TABLE_ = . + 4); _FIXUP_TABLE_ = .; KEEP(*(.fixup))Quoted 3 lines
}
__got2_entries= ((_GLOBAL_OFFSET_TABLE_ - _GOT2_TABLE_) >> 2) - 1;__fixup_entries= (. - _FIXUP_TABLE_) >> 2;I notice a difference between
u-boot.ldsandu-boot-nand.lds-- the latter (used for the main part of U-Boot when loaded from SPL) has:Quoted 10 lines
.reloc : { KEEP(*(.got)) _GOT2_TABLE_ = .; KEEP(*(.got2)) _FIXUP_TABLE_ = .; KEEP(*(.fixup)) } __got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >> 2; __fixup_entries = (. - _FIXUP_TABLE_) >> 2;Is this wrong as well?
Quoted 7 lines
Quoted 2 lines
Yes, I think so. This one does not care about the .got entries at all so I suspect never gcc's wont work.
Thanks.
I'm not entirely sure about the _GLOBAL_OFFSET_TABLE_ stuff, though -- what's wrong with the simpler version that uses _FIXUP_TABLE_?
_GLOBAL_OFFSET_TABLE_ is a -fpic thing, it marks the beginning of reloc entrires and gcc/binutils defines it if there are -fpic relocs present. If -fpic is present, there is are some extra entrires. If no -fpic I need to manually recreate space, otherwise the reloc routine will be off.
Jocke
PATCH 1/1 PowerPC: Change -fpic flag to -fPIC flag in the config.mk
Quoted 56 lines
Scott Wood <[email protected]> wrote on 2012/04/26 23:26:52:
Quoted 54 lines · Joakim Tjernlund
Quoted 51 lines
Scott Wood <[email protected]> wrote on 2012/04/25 21:01:00:
Quoted 5 lines · Joakim Tjernlund
Quoted 1 line
Your linker file is buggy I think. I found
u-boot-nand_spl.lds, is that the one?That's the one for the SPL part.
OK, good.
Quoted 38 lines
Quoted 20 lines
Check out that files reloc part:
.reloc : { _GOT2_TABLE_ = .; KEEP(*(.got2)) _FIXUP_TABLE_ = .; KEEP(*(.fixup)) } __got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >> 2; __fixup_entries = (. - _FIXUP_TABLE_) >> 2;Compare that with(from
u-boot.lds):
.reloc :{ _GOT2_TABLE_ = .; KEEP(*(.got2)) KEEP(*(.got)) PROVIDE(_GLOBAL_OFFSET_TABLE_ = . + 4); _FIXUP_TABLE_ = .; KEEP(*(.fixup))Quoted 3 lines
}
__got2_entries= ((_GLOBAL_OFFSET_TABLE_ - _GOT2_TABLE_) >> 2) - 1;__fixup_entries= (. - _FIXUP_TABLE_) >> 2;I notice a difference between
u-boot.ldsandu-boot-nand.lds-- the latter (used for the main part of U-Boot when loaded from SPL) has:Quoted 10 lines
.reloc : { KEEP(*(.got)) _GOT2_TABLE_ = .; KEEP(*(.got2)) _FIXUP_TABLE_ = .; KEEP(*(.fixup)) } __got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >> 2; __fixup_entries = (. - _FIXUP_TABLE_) >> 2;Quoted 1 line
Is this wrong as well?
Yes, I think so. This one does not care about the .got entries at all so I suspect never gcc's wont work.
Quoted 8 lines
Quoted 4 lines
Thanks.
I'm not entirely sure about the _GLOBAL_OFFSET_TABLE_ stuff, though -- what's wrong with the simpler version that uses _FIXUP_TABLE_?
_GLOBAL_OFFSET_TABLE_ is a -fpic thing, it marks the beginning of reloc entrires and gcc/binutils defines it if there are -fpic relocs present. If -fpic is present, there is are some extra entrires. If no -fpic I need to manually recreate space, otherwise the reloc routine will be off.
PS. note the -1 diff too:
__got2_entries = ((_GLOBAL_OFFSET_TABLE_ - _GOT2_TABLE_) >> 2) - 1;
Jocke