This is the mail archive of the
ecos-discuss@sourceware.cygnus.com
mailing list for the eCos project.
Re: device code link problem
- To: Norbert dot Schulze at t-online dot de
- Subject: Re: [ECOS] device code link problem
- From: Bart Veer <bartv at redhat dot com>
- Date: Thu, 18 May 2000 12:04:38 +0100
- CC: ecos-discuss at sourceware dot cygnus dot com
- References: <000201bfc0b2$2b91f280$37049fc1@nexus>
- Reply-to: bartv at redhat dot com
>>>>> "Norbert" == Norbert Schulze <Norbert.Schulze@t-online.de> writes:
Norbert> I wrote a new device driver and I see the code in
Norbert> libtarget.a. But the code is not included in the test
Norbert> program for the new device. What's the trick to include
Norbert> code from a library that is indirectly accessed?
You are being hit by selective linking. The device driver functions
are never accessed directly, only indirectly via the device name and
the driver table. Hence the linker things that the code is not used
and garbage-collects it.
The eCos build system actually generates two libraries: libtarget.a
and libextras.a. Via some build and linker script magic we make sure
that everything in the latter ends up in the application image,
bypassing the garbage collection. You should specify the destination
library in the CDL line, for example:
compile -library=libextras.a xyzzy.c
For more details see:
http://sourceware.cygnus.com/ecos/docs-1.3.1/cdl/build.make.html#BUILD.EXTRAS
Bart