Makefile question
Smith, Gene
gene.smith at siemens.com
Wed Nov 24 20:26:23 UTC 2004
Sergei Organov wrote, On 11/24/2004 2:11 PM:
>> I have a bunch of "modules" each in a separate directory (each is
>> not necessarily a rtems task). Do you think it is ok to build each
>> one as a partial link and then in the last build step link each
>> partial against rtems libraries? That seems reasonable to me.
>
>
> I'd say it's OK, but I indeed don't see any rationale behind it.
> What's a point in building these partially linked files? For me it'd
> bring only additional troubles managing subtle problems with linker
> behavior on partial links. Overall, my advice is: forget about
> partially linked files unless you really know you need them. If you
> don't want to just link all the objects from different directories
> into the final image, make libraries for each component instead.
Guess I was a little afraid of hitting the linker with thousands of .o's
all at one time. I did do a non-rtems project with a lot of partials and
it worked ok. The linker had no problems. But you may be right that
linking it at once is ok.
>
>> Two more questions:
>>
>> 1. Which rtems library(s) file(s) do you do the final link against?
>>
> That's basically how my options that I pass to gcc during link look
> like (here I use 'librtemsall.a' library that is specified by
> -lrtemsall option):
>
> gcc -o main \ -Wl,-EB,-Map,main.map,-s,-S,--gc-sections,-N
> -L../linker \ -Wl,-T,linker.lnk \
> -L/opt/ppc-rtems/rtems/v4n/network/ppc-rtems/gen56x/lib/ \ ... bunch
> of my object files ... \
> /opt/ppc-rtems/rtems/v4n/network/ppc-rtems/gen56x/lib/no-dpmem.rel \
> /opt/ppc-rtems/rtems/v4n/network/ppc-rtems/gen56x/lib/no-msg.rel \
> /opt/ppc-rtems/rtems/v4n/network/ppc-rtems/gen56x/lib/no-part.rel \
> /opt/ppc-rtems/rtems/v4n/network/ppc-rtems/gen56x/lib/no-signal.rel \
> /opt/ppc-rtems/rtems/v4n/network/ppc-rtems/gen56x/lib/no-timer.rel \
> /opt/ppc-rtems/rtems/v4n/network/ppc-rtems/gen56x/lib/no-rtmon.rel \
> -lc -lrtemsall -lc -lm
>
In /opt/rtems-4.6/powerpc/<my-bsp-name>/lib I see
librtemsbsp.a and librtemscpu.a plus linkcmds and all the no-*.rel's.
I only see librtemsall.a in rtems 4.5 stuff.
>
>> 2. What is the deal with the manaager linking, i.e., no-*.rel?
>
>
> If you are sure you don't use some of the RTEMS managers, you can
> save space by linking in corresponding no-*.rel files. They replace
> (long) library functions with (short) stubs that issue error if
> called.
Ok, thanks for the explanation on this! I looked at the no-*.c files but
not real closely but they did appear to be short routines.
>> (Relating to question 1 and 2, when I watch netdemo build I only
>> see linking against no-*.rel files.)
>
> Didn't you miss "-lsomething" that means link in "libsomething.a"?
Could debug -d be lying to me?
Here is what it says is being linked:
powerpc-rtems-gcc --pipe -B/opt/rtems-4.6/powerpc-rtems/<bspname>/lib/
-specs bsp_specs -qrtems -g -Wall -O0 -fno-keep-inline-functions
-mcpu=403 -D_OLD_EXCEPTIONS -Dppc405 -o o-optimize/netdemo.exe
o-optimize/init.o o-optimize/test.o
/opt/rtems-4.6/powerpc-rtems/<bspname>/lib/no-dpmem.rel
/opt/rtems-4.6/powerpc-rtems/<bspname>/lib/no-msg.rel
/opt/rtems-4.6/powerpc-rtems/<bspname>/lib/no-mp.rel
/opt/rtems-4.6/powerpc-rtems/<bspname>/lib/no-part.rel
/opt/rtems-4.6/powerpc-rtems/<bspname>/lib/no-signal.rel
/opt/rtems-4.6/powerpc-rtems/<bspname>/lib/no-timer.rel
/opt/rtems-4.6/powerpc-rtems/<bspname>/lib/no-rtmon.rel
More information about the users
mailing list