public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Shinya Kuribayashi <skuribay@ruby.dti.ne.jp>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] _gp in current u-boot.lds for MIPS ports
Date: Wed, 17 Oct 2007 23:27:40 +0900	[thread overview]
Message-ID: <47161BDC.2030006@ruby.dti.ne.jp> (raw)
In-Reply-To: <c166aa9f0710161315g34d17a1ah94dee4aec93f495@mail.gmail.com>

Hi Andrew,

Andrew Dyer wrote:
> Typically _gp is set in the linker script to 0x7ff0 above the start of
> the 'small' sections (all ELF sections with SHF_MIPS_GPREL flag), so
> that all small items can be accessed by a 16 bit signed offset off of
> the register allocated for _gp.  The 16-bit signed offset corresponds
> to the native MIPS addressing mode.  The .got section usually comes
> first in the link map and so .got + 0x7ff0 = _gp.
> 
> Somewhere in the linking process the linker calculates the signed
> offset necessary for each instruction accessing data in these sections
> based on the _gp symbol from the link scripts and puts that into the
> appropriate offset field in the instruction.
> 
> For us, I don't believe it matters where _gp is, as long as the
> relative offsets to all small items can be held in the 16 bit field
> and that _gp is aligned properly.  Obviously we need to fixup the _gp
> register correctly during relocation.  Since _gp is only a pointer,
> IMHO it makes sense to adhere to the standard map with a 0x7ff0
> offset.
> 
> (BTW, ${CROSS_COMPILE}ld --verbose will dump the normal link script
> that gets used in an ELDK setup)

Good abstract. I hope that I don't miss anything. I'll submit patches
later, please review them.

thanks a lot,

   Shinya

  reply	other threads:[~2007-10-17 14:27 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-04 17:45 [U-Boot-Users] [PATCH] Off-by-two bug when relocating GOT Vlad Lungu
2007-10-05  3:58 ` Shinya Kuribayashi
2007-10-05 10:39   ` Vlad Lungu
2007-10-05 20:18     ` Thomas Lange
2007-10-05 22:31       ` Vlad Lungu
2007-10-06  0:20         ` Thomas Lange
2007-10-06 12:27           ` Vlad Lungu
2007-10-11 20:04         ` Shinya Kuribayashi
2007-10-11 22:06           ` Vlad Lungu
2007-10-12 10:20             ` Vlad Lungu
2007-10-14 15:57             ` Shinya Kuribayashi
2007-10-14 19:00               ` Vlad Lungu
2007-10-16 18:19               ` [U-Boot-Users] _gp in current u-boot.lds for MIPS ports Wolfgang Denk
2007-10-16 19:13                 ` Vlad Lungu
2007-10-16 20:15                 ` Andrew Dyer
2007-10-17 14:27                   ` Shinya Kuribayashi [this message]
2007-10-17 14:23                 ` Shinya Kuribayashi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=47161BDC.2030006@ruby.dti.ne.jp \
    --to=skuribay@ruby.dti.ne.jp \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox