This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


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

Linker Problem



Hi,

   I am sorry, if this is not an appropriate list for my problem.  In
that case can you suggest me, a more suitable list.

   I am using the compiler powerpc-eabi-gcc and the linker
powerpc-eabi-ld.  My host system is a linux machine.  I am using the
RTOS 'eCos' for my application.  Recently I added a few packages of the
eCos to my existing (which is working fine) code.  They are 1. Net
package (a TCP/IP suit) 2. isoinfra (provides iso standard libc and
libm).

When we build the eCos code, it creates two libraries.  One is
libtarget.a and the other is libextras.a.  I am guessing, which objects
should go where is specified in configuration definition language files
of eCos.


When I prepre the executable and run it on the target, I got sigill
exception.  After studying the case I concluded that there is a problem
in memroy allocation to the variables.

The problems I am facing are -

   1.  There are a few static variables (local to the file in which are
they are defined) overlaping with the global variables.  All the local
variables are defined in the newly added code. For example, there are
two variables 'ifnet' and 'net_mem'.  ifnet is a golobal variable and
net_mem is a static variable.  ifnet is a structure of two pointers,
whose length is 8 bytes.  net_mem is an address and its length is 4
bytes.  The address of ifnet is
0x0203652C and the address of net_mem is 0x0236530.  Please note that
these two are overlaping.

  2.  There are overlaps with in the gloabal variables also.  My
observation regarding this is -
        If there are two global variables with same address, then one
variable is getting defined in a file whose object is put in the
library, libtarget.a and the other variable is getting defined in a file

whose object is put in the library libextras.a.  I am not confident of
this observation.

  All the variables I discussed about are comming in the category of
.sbss.

  I did the following experiment -
       I changed all the static variables to global then compiled and
linked.  Then problem 1 disappears.

Please suggest me the places where to look to solve these problems.

Thanks,
chandra




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