This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Relocating code on cortex m3 but keeping data constant


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]