This is the mail archive of the binutils@sources.redhat.com 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]

Intermingling sections


I am working on a linker script for my company's port of the gnu
binutils to our architecture. according to the version string, I am
using 2.11 with BFD 2.11.

According to the documentation at 

http://sources.redhat.com/binutils/docs-2.10/ld_3.html#SEC23

>>>>>>>>>>>
There are two ways to include more than one section: 
  
  *(.text .rdata)
  *(.text) *(.rdata)


The difference between these is the order in which the `.text' and
`.rdata' input sections will appear in the output section. In the first
example, they will be intermingled. In the second
example, all `.text' input sections will appear first, followed by all
`.rdata' input sections. 
<<<<<<<<<

I would expect that with the following entry in my script:

*(.data .text)

and two files foo.o and bar.o, that I would get the following layout:

.data (from foo.o)
.text (from foo.o)
.data (from bar.o)
.text (from bar.o)

But instead, I get the behavior I would expect with the entry

*(.literal) *(.text)

.data (from foo.o)
.data (from bar.o)
.text (from foo.o)
.text (from bar.o)

So either I don't understand the documentation, or it is incorrect or
ld's behavior isn't as designed. I looked through the code pretty
carefully, and as near as I can tell, it appears that ld doesn't behave
differently no matter which syntax you use. 

I would like the first layout (data and text interleaved). Is there an
easy way to get it? If not, I can modify ld to get it and contribute the
fix back. However, I suspect that other linker scripts are relying on
the current behavior, and I wouldn't want to mess them up.

walk_wild walks over every file looking for sections that match a
particular wildcard_spec. What I need it to do is walk over every file
and return sections that match several wildcard_specs. I could add
something similar to the SORT keyword. (which is close to what I want,
but not quite there)

Thanks,

Sterling
Member Technical Staff
Tensilica, Inc


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