This is the mail archive of the gcc@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]

Re: Relocatable code


Hi Rafel,

>   I'm programming with gcc for ARM (ARM7TDMI) and I wonder if there's a
> way to make gcc compile relocatable code. My ARM processor hasn't got an
> MMU and I would want to be able to store programs in flash or receive
> them via serial port and put them to work at any memory region.

Richard mentioned compiling Position Independent Code.  Another method
you could try is to compile position dependent code (ie the default
that gcc-arm-elf generates), but link it with the --emit-relocs linker
switch.  This will preserve the relocations in the resulting binary
and then your loader will have to process them in order to create a
working executable.  Note - I have not actually tried this in
practice, so I do not guarantee that it will work, but it should be
worth investigating.

>   Another question that I have is the topic of this list. Is my
> question suitable? Which aspects can be discussed here?

The question is OK.  The gcc list is:

  a high volume list for general development discussions
  about GCC. Anything not covered by other mailing lists
  is suitable for discussion here.

For information about all of the lists see:

  http://gcc.gnu.org/lists.html


Cheers
	Nick

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