This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos 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: Linkerscript


My problem is partially solved.

I now have in my linkerscript:

INPUT(data.o)

SECTIONS
{
	...
	.reset : { *(.reset) }
	...
}
And the first line in data.o is:
.section ".Reset"

And now it pulls out the right information. So I solved the problem I had with
the absolute paths in my linkerscript!

But now I have the following problem:
I create a Map file with the following LD option: -Map link.map
And in this file the correct addresses are mentioned (so far no problem)
The LD command is:
$(LD) $(LDFLAGS) -Map $(OUTPUTDIR)/link.map -T$(LINKFILE) -o
$(OUTPUTDIR)/ram.elf

But if I make a s37 file these addresses have disappeared... I don't know why
cause they should be mentioned in the s37 file!
The command to make the s37 file:
$(OC) -O srec $(OUTPUTDIR)/ram.elf $(OUTPUTDIR)/ram.s37

Does anybody have any ideas??

Thanks in advance

-----Original Message-----
From: sandeep [mailto:sandeep@codito.com]
Sent: vrijdag 1 oktober 2004 10:00
To: Meulendijks, J.
Subject: Re: [ECOS] Linkerscript



> - in your linker script give complete path to data.o
> Works, BUT this is what is a problem to me. I do _not_ want a absolute path in
> my linkerscript
that's one good step in direction. you might want to have a look at
- INPUT and startup directives in your linker script.
STARTUP(vectors.o)
INPUT(extras.o)

read more about INPUT directive in info pages/other linker documentation.
these guys look for extras.o and vectors.o in the same directory as target.ld 
(there could be options to linker that help let it know where to look for *.o 
files referred to in the script, i will let u know, if i come across some info 
in slight free time)

don't tinker with STARTUP but try adding data.o to input list as
INPUT(extras.o data.o)

and refer to data.o in your script just data.o

as per your earlier mails, data.o is sitting in same place as target.ld

i guess, you don't want an absolute path in your linkerscript as that might 
require you to change the linker script more often for path(s).

here is another thing you could look at -
you can pass the path to directory holding your *.o of inerest, at command line 
during linker invocation (similar to the way you define environment macros 
during compilation "gcc -DMYMACRO=1 ..file.c") and use it to construct absolute 
path to data.o (and other such specially treated files).

here is another thing from 'info ld' that could be useful and save some 
modifications to generated target.ld
-------------------------------------
    If the linker cannot recognize the format of an object file, it will
assume that it is a linker script.  A script specified in this way
augments the main linker script used for the link (either the default
linker script or the one specified by using `-T').  This feature
permits the linker to link against a file which appears to be an object
or an archive, but actually merely defines some symbol values, or uses
`INPUT' or `GROUP' to load other objects.  Note that specifying a
script in this way merely augments the main linker script; use the `-T'
option to replace the default linker script entirely.  *Note Scripts::.
-------------------------------------
    You can specify a file name to include sections from a particular
file.  You would do this if one or more of your files contain special
data that needs to be at a particular location in memory.  For example:
      data.o(.data)

    If you use a file name without a list of sections, then all sections
in the input file will be included in the output section.  This is not
commonly done, but it may by useful on occasion.  For example:
      data.o

    When you use a file name which does not contain any wild card
characters, the linker will first see if you also specified the file
name on the linker command line or in an `INPUT' command.  If you did
not, the linker will attempt to open the file as an input file, as
though it appeared on the command line.  Note that this differs from an
`INPUT' command, because the linker will not search for the file in the
archive search path.
-------------------------------------
Here the `*' is a wildcard which matches any file name.  To exclude a
list of files from matching the file name wildcard, EXCLUDE_FILE may be
used to match all files except the ones specified in the EXCLUDE_FILE
list.  For example:
      (*(EXCLUDE_FILE (*crtend.o *otherfile.o) .ctors))
    will cause all .ctors sections from all files except `crtend.o' and
`otherfile.o' to be included.
-------------------------------------


If you see, there is enough clues for you in info pages --
- wildcard characters in file name specification could be useful for your needs?
- btw, did you try specifying data.o as just data.o on command line and also in 
linker script and data.o placed in your current directory, where you invoked the

linking command?

have a successful day
sandeep
--------------------------------------------------------------------------
Ducharme's Axiom:
	If you view your problem closely enough you will recognize
yourself as part of the problem.
--------------------------------------------------------------------------

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss


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