Re: Regarding symbol resolving in VxWorks
- From: lje9292004@xxxxxxxxxxxx
- Date: Sat, 19 Jul 2008 00:25:55 -0700 (PDT)
On 6月28日, 下午10时23分, "Michael R. Kesti" <michaelke...@xxxxxxxxxx>
wrote:
satish....@xxxxxxxxx wrote:Hi, I do the same work as what Satish does, using the nmpentium .And
Hi Michael,
Thanks for your replies.
You're welcome.
I have one question.
If you dont mind, Can you please clarify?
Sure. Or, at lease, I'll try!
1. Here, in linking options, why we should use "-r" option ?
The -r option means that the linker's output is to be relinkable. This
is also known as partial linkage. This means several things including,
as previously discussed, not all symbols need to be resolved and, as
you have discovered, the entry symbol, _start, need not be defined.
There may be other differences between partial and full links, too.
Full linkage is typically used when building boot ROM and VxWorks images
because these builds must completely ready for execution and therefore
require resolution of all symbols and entry point (the _start symbol)
must be provided and set to a specific addresses.
Partial linkage is typically used to build downloadable application
images as they are expected to contain unresolved symbols and it is
not known at link time where in memory they might be loaded.
Library builds are not linked at all. Instead. the "ar" program is used
to write object files to the output (library) file.
2. If my code is like below:
void main()
{
printf("\n Hello..");
}
and in my linking options, if I remove "-r" option, it gives following
error:
armips crus test_project.a @..\prjObjs.lst
ldmips -EB -o project.out test.o
\cygdrive\d\Tornado2.2_MIPS\Mips\host\x86-win32\bin\ldmips: warning:
cannot find entry sym
bol _start; defaulting to 0000000000400000
test.o: In function `main':
d:\test\test_project\MIPS64gnu\..\test.c:12: undefined reference to
`printf'
make: *** [project.out] Error 0x1
This is all to be expected. Because the -r option has been omitted this
is a full link but your call to printf(), whose code is in a VxWorks
image rather than in test.o, cannot be resolved. Further, because test.o
does not define _start, the linker has supplied it and assigned it a
default address so that it can try to create an absolute image.
3. If my code is like below:
void main()
{
}
And in linking options, if "-r" option is not there, build log is like
below:
armips crus test_project.a @..\prjObjs.lst
ldmips -EB -o project.out test.o
\cygdrive\d\Tornado2.2_MIPS\Mips\host\x86-win32\bin\ldmips: warning:
cannot find entry sym
bol _start; defaulting to 0000000000400000
Done.
In this case you have eliminated the unresolved call to printf() but
the _start sysmbol is still not defined and is again supplied by the
linker and set to a default address.
And this program can not run properly. What might be the reason for
this?
I believe that this is because project.out was linked to an absolute
image that is to be loaded starting at address 0x400000 and, when this
file is downloaded to your target, it get loaded at that address. The
problem may be that this is also where your VxWorks image was loaded
and the VxWorks image is therefore partially overwritten. Once that
happens the system behavior is, as they say, unpredictable!
4. During the final link operation, Can we do any thing such that I
can avoid linking of unused functions?
Assuming that you are referring to the final link that occurs when a
partially linked application is downloaded to a target, I believe that
the only way is to arrange for the unused functions to not be included
in the partially linked application.
This is, at least, the case for VxWorks prior to version 6 which I
believe is your case as you said you're using Tornado 2.2. (Tornado is
replaced by Workbench in version 6.) Version 6 includes a new kind of
application called the real time process (RTP). One of the features
of RTPs is that they support shared libraries which, I believe, provide
the kind of operation you seek.
--
========================================================================
Michael Kesti | "And like, one and one don't make
| two, one and one make one."
mrkesti at hotmail dot com | - The Who, Bargain
I find it doesn't include the func1,func2,func3,func4,func6, and app
uses only one function func5 from above library.
But why, anyone can help me to explain it?
.
- Prev by Date: Re: network driver + replenishment
- Next by Date: how to use gdbi386 in xp?
- Previous by thread: Help - VxWorks Launcher not starting (Tornado/Vxworks 5.5.x)
- Next by thread: how to use gdbi386 in xp?
- Index(es):
Relevant Pages
|