[U-Boot] [PATCH] PowerPC: Change -fpic flag to -fPIC flag in the config.mk

Joakim Tjernlund joakim.tjernlund at transmode.se
Fri Apr 27 09:05:09 CEST 2012


Scott Wood <scottwood at freescale.com> wrote on 2012/04/26 23:26:52:
>
> On 04/26/2012 01:53 AM, Joakim Tjernlund wrote:
> > Scott Wood <scottwood at freescale.com> wrote on 2012/04/25 21:01:00:
> >>
> >> On 04/18/2012 05:07 AM, Joakim Tjernlund wrote:
> >>> 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.
> >
> >>
> >>> 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;
> >>
> >> 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:
> >>
> >>>   .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?
> >
> > 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



More information about the U-Boot mailing list