public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Relocating code on cortex m3 but keeping data constant
@ 2011-02-25  1:56 Dan Baldor
  2011-02-27 19:27 ` Ian Lance Taylor
  0 siblings, 1 reply; 6+ messages in thread
From: Dan Baldor @ 2011-02-25  1:56 UTC (permalink / raw)
  To: gcc-help

I am working on a project using a arm cortex-m3 processor that needs 
relocatable code. The relocation is such that the .text and .data 
sections will have a different offset when loaded than what they were 
compiled with (the .text section can be loaded to different sections of 
internal flash while the .data section will always reside in the same 
location of sram). If I keep the .got with .text section I can get the 
global variables to have the correct addresses but my static local 
variables have the wrong address (they are offset from where they should 
be the amount that the .text segment shifted). I think the static locals 
are referenced from the start of the .GOT section which is why I am 
having problems. I am compiling all my c code with –fpic and linking 
with –fpic and –pie. Is there any way to either force the static locals 
(and maybe global variables) to absolute addresses or to relocate the 
.GOT section dynamically? I tried doing by placing the GOT section with 
the data but when I do so code does not locate the GOT section 
correctly. I thought that perhaps I should be using |-msingle-pic-base 
and -mpic-register=|/reg /but so far all attempts to use this did not 
work at all.

Any help you can provide would be greatly appreciated.

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

end of thread, other threads:[~2011-03-02  0:28 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-25  1:56 Relocating code on cortex m3 but keeping data constant Dan Baldor
2011-02-27 19:27 ` Ian Lance Taylor
     [not found]   ` <4D6AFAF4.3000009@gmail.com>
     [not found]     ` <mcrlj10glkg.fsf@google.com>
2011-03-01  1:18       ` Dan Baldor
2011-03-01  3:57         ` Ian Lance Taylor
2011-03-02  0:25           ` Dan Baldor
2011-03-02  0:28             ` Ian Lance Taylor

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).