need help with section attributes & relocation
Ken Greenberg
ken@calast.com
Tue Sep 9 12:27:00 GMT 1997
I am running a SunOS-hosted cross development environment for MIPS
that I built successfully a while ago. Now I am trying to write some
small tests that need to locate code in kseg1 (0xa000000), and I have
tried innumerable approaches to actually getting a section of code
located there with the proper attributes. I am tired of fighting with
the linker command language, so this seems like a good time to ask
for help.
1) If I make a up a private name for this section, it only has the
attribute READONLY. Is there some way to assign the attributes of a
section either in gas or in the linker command language? I searched
through the info files but can't find anything. It would be really
nice if you could do something like:
.kseg1 0xa0000000 : LOAD ALLOC READONLY CODE
{ *(.kseg1) }
But, of course this causes a parse error. Is there some other syntax
for it? Or, perhaps in the assembler, something analogous to:
.section .kseg1 (LOAD ALLOC READONLY CODE)
How does one assign attributes to a section? Or is this not possible?
2) An alternative is to just let it be .text, which will give it the
proper attributes, but then I can't force the linker to put it where
I want it. Suppose I put all the contents for this section in one
file called ks1.o; there are other .text sections that go in the
"normal" place in other files. Then I can have a section directive
like:
.kseg1 0xa0000000: { ks1.o(.text) }
If I put this before the other text directive (that collects the
non-kseg1 code), and restore the load point to its normal place
(0x400080) before the rest of the text, I get a "no room for program
headers" message. If I place it afterwards, it ends up being empty
because the *(.text) in the normal .text section directive sucks up
all the sections, including this one.
I also tried using the MEMORY facility, but it seems to do absolutely
nothing. In other words, I defined a memory region that starts at
0xa0000000 and had a more normal section directive:
.kseg1 : { ks1.o(.text) } > kseg1
This is completely ignored; the symbol in ks1.o's .text section ends
up in the normal .text output section (yes, this directive came
first) despite it being redirected to the specific memory section.
It seems like the idea of selecting one section from one file and
putting it in one place, then taking all the similarly-named
sections from other files and putting them somewhere else falls apart
if the first one selected goes at a higher address than the others.
Any suggestions on how to get around this problem?
-Ken
Kenneth F. Greenberg, President
California Advanced Software Tools, Inc.
Los Gatos, CA, USA
http://www.calast.com/ken
More information about the crossgcc
mailing list