This is the mail archive of the binutils@sourceware.org mailing list for the binutils 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]

Re: How to map text and data section to same address in the linker script for targets based on Harvard architectures


Sarajyo Puli <psarajyo@yahoo.com> writes:

> Â For targets based on Harvard architectures, it is possible that the program memory and data memory are
> two different memory systems, hence both of them could start/map at the same start address.
> But, if I set the start address of text and data segment in the linker script, linker errors out saying
> that both text and data section overlaps (while creating the final executable).
> Does anyone have an idea how to do this in the linker script for a cross linker?
> OrÂis it the job of the loader to do the right mapping?

The trick I've used in the past is to set high bits in the address in
the executable.  For example, if you have 16-bit addresses, put the text
segment from 0 to 0xffff and put the data segment from 0x10000 to
0x1ffff.  Change the relocation routines to do the right thing with such
addresses--give errors for invalid references and/or strip the high bit.
Write your loader to ignore the high bit, or if appropriate to use it to
decide where to load the segments.

Ian


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