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 control segments ?


On Mon, Dec 01, 2008 at 05:35:05PM -0800, Dong Phuong wrote:
> I'm porting for a microcontroler which has segmented
>  memory.
>  
> THe memory is devided into many pages, each page is
>  16K. And I'm going to use 256 pages for code. But
>  these 256 pages are not continuous in physical
> memory,
>  so when I want to jump to a function, I have to know
>  what is the segment address of this function, and
> then
>  set the CSP with this value, and jump to it.
>  
>  So what I want to know is if I'm in a function, is
>  there any way for me to know what code segments I'm
>  locating in ?

I would flatten the address space, so that the low 14 bits of an
address specify offset within segment, and the high bits specify
page.

> If I know this,  when I have to jump to
>  another function, I can decide wheather this function
>  is in the same segment with the function that I'm
>  locating in, and then can decide if I have to change
>  the CSP.
> 
> I've asked this question on the gcc-mailing list, and
> one adviced me to use "linker relaxation". But I don't
> know how to implement linker relaxation in Binutils. 
> 
> Could you give me some hints for this ? 

See one of the existing targets that does linker relaxation.  Search
for relax_section in the bfd/ directory.

-- 
Alan Modra
Australia Development Lab, IBM


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