public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* gcc 4.8.1, powerpc, .data.rel.ro.local entry with no corresponding .fixup entry
@ 2014-02-03 15:10 Joerg Albert
  2014-02-10 14:33 ` Joerg Albert
  0 siblings, 1 reply; 2+ messages in thread
From: Joerg Albert @ 2014-02-03 15:10 UTC (permalink / raw)
  To: gcc-help

Hi,

we've recently compiled "Das U-Boot" with gcc 4.8.1 for powerpc target. This
bootloader relocates itself into RAM, using the content of the .fixup section.

A codeline similar to "printf("%p\n", "qwerty");" inside a static function
creates an address entry (for "qwerty") in .data.rel.ro.local, but I cannot
find a corresponding entry in the .fixup section of this object file. This
let the bootloader reference "qwerty" in the flash after it relocated to RAM.

Could someone please explain how the .fixup section is supposed to work?
Shall every .rela.data.* entry in the elf file have a corresponding entry in
the .fixup section?
Are there any command line options which may suppress the generation of the
data.rel.ro.* sections (as U-Boot does not write-protect parts of the RAM)?

The code works fine with gcc 4.7.x, but I haven't looked into the details of
the generated assembly code and section layout.


Thanks,
Joerg

details:
- gcc version: powerpc-softfloat-linux-gnuspe-gcc (Gentoo 4.8.1 p1.0,
pie-0.5.6) 4.8.1
- gcc command line (some -I removed):
  -g -gdwarf-2  -Os   -fpic -mrelocatable \
  -meabi \
  -D__KERNEL__ -DCONFIG_SYS_TEXT_BASE=0xef770000 \
  -fno-builtin  -ffreestanding \
  -isystem /usr/lib/gcc/powerpc-softfloat-linux-gnuspe/4.8.1/include \
  -nostdinc -pipe  -DCONFIG_PPC -D__powerpc__ -ffixed-r2 -Wa,-me500 \
  -msoft-float -mno-string -mspe=yes -mno-spe -Wall -Wstrict-prototypes \
  -fno-stack-protector -Wno-format-nonliteral -Wno-format-security \
  -fstack-usage"


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: gcc 4.8.1, powerpc, .data.rel.ro.local entry with no corresponding .fixup entry
  2014-02-03 15:10 gcc 4.8.1, powerpc, .data.rel.ro.local entry with no corresponding .fixup entry Joerg Albert
@ 2014-02-10 14:33 ` Joerg Albert
  0 siblings, 0 replies; 2+ messages in thread
From: Joerg Albert @ 2014-02-10 14:33 UTC (permalink / raw)
  To: gcc-help

Hi,

switched to gcc 4.8.2, but the problem remains.

It seems like .data.rel.ro.local contains pointers only
and its entries are not covered by any entries in .fixup.
All other .data.rel.ro.* sections contain arbitrary data -
if there are any pointers, there is always a corresponding
entry in .fixup.

Therefore I put .data.rel.ro.local between .got2 and .got in the
linker script file:

    KEEP(*(.got2))
    KEEP(*(.data.rel.ro.local))
    KEEP(*(.got))

which seems to solve the problem.

Is the above assumption valid? Or may it break with some other code
or with the next compiler version? It's quite hard to find documentation
about the usage of .data.rel.ro.local.

Thanks,
Joerg

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-02-10 14:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-03 15:10 gcc 4.8.1, powerpc, .data.rel.ro.local entry with no corresponding .fixup entry Joerg Albert
2014-02-10 14:33 ` Joerg Albert

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).