This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: [ARM/Thumb] Problem and question with PIC option?
- From: Richard Earnshaw <rearnsha at arm dot com>
- To: "Thierry COLIN" <thierry dot colin at thales-e-transactions dot com>
- Cc: gcc at gcc dot gnu dot org, Richard dot Earnshaw at arm dot com
- Date: Tue, 14 May 2002 10:41:45 +0100
- Subject: Re: [ARM/Thumb] Problem and question with PIC option?
- Organization: ARM Ltd.
- Reply-to: Richard dot Earnshaw at arm dot com
> Hi,
>
> I am using GCC 3.1 (pre-release) under Cygwin environment. I would like
> to create outputs for ARM processors so I have built gcc for ARM target.
> I create a simple project with some files.
> I use these options :
> -mthumb : because I need a thumb compatible output
> -mthumb-interwork
> -fpic
>
> The file created with these options is correct and It woks 'good' with
> the simulator but I have noted a strange aspect of the pic option.
> In fact, The file use the relative address to access to variables but,
> in my files, I am using const string which are placed in the 'rodata'
> sections (for exemple fprintf("coucou");).
> When I move all the code (not the data because I don't need this section
> for the moment and no information are stored in this section...) and I
> load my application in another address, when the file try to access to
> the string variable in the rodata section, It access to the GOT section
> with relative address but in this section, the PHYSICAL address is
> present....!!!! and so in the register is present the 'bad' address...
>
> I don't understood why It couldn't access to this section with relative
> address and not by the got
>
> I would like that these rodata are placed in text section to access only
> with relative address and no physical one.
> Could someone help me and answer me.
That's how the GOT is designed to work. If you move the code after the
GOT relocations have been resolved, then you will have to rebuild your GOT.
To make it work in a relative manner you would need a single, well-known
base address. There isn't anything of this form available, so you are off
to a non-starter.
R.