From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Koundinya.K" To: Ian Lance Taylor Cc: bfd@cygnus.com, gas2@cygnus.com Subject: Re: Problem with GNU Linker on mips... Date: Thu, 18 Feb 1999 06:39:00 -0000 Message-id: <199902181439.UAA13324@bombay.ddeorg.soft.net> References: <199902111620.LAA00234@subrogation.cygnus.com> X-SW-Source: 1999/msg00023.html Hello, First of all a quick thanks to Ian for the response to my queries. O.K -> Date: Thu, 11 Feb 1999 20:00:02 +0530 -> From: "Koundinya.K" -> -> /* Note that since the MIPS ABI doesn't provide a means for passing -> * lm from the stub routines, so we must get this information -> * someplace else. Here we just start with the head of the list -> * which is stored in the global variable _ld_loaded. This may -> * not be correct for objects which have DT_SYMBOLIC set. -> * FIXME! -> */ -> lm = _rt_address_to_lm(_ld_loaded,pc); -> -> Can you find out what _ld_loaded is initialized to? -> Yes and no , I am not able to watch the elements of the structure. _ld_loaded contains the value 1074495092 and the address of _ld_loaded is 419304. -> It looks like your dynamic linker expects some sort of structure which -> the GNU linker is not setting up. -> -> Could there be any problems with the start up file like crti, crt1 and crtn used. -> -> I doubt it. -> -> Could using the crtbegin and crtend help. Why don't the MIPS targets use them.. -> -> I doubt this would make any difference either. The Irix targets don't -> use crtbegin and crtend because the Irix linker has another mechanism -> for ensuring that the global constructors will run. Your target may -> need crtbegin and crtend, but using them won't fix the problem you are -> encountering. -> -> Yes as you say, I don't think my target requires the crtbegin and end. THen I then realized this when I saw what my native EPC compiler used. It is very similar to IRIX* ------Clip of what my native compiler uses ------------------------------ $cc -Wl,-note -V t.c -o tt EPC ANSI C 3.0.12 Copyright (c) 1991,1992,1993,1994,1995 EPCL. All Rights Reserved Copyright (c) 1990,1991 UNIX System Laboratories, Inc. Copyright (c) 1988 AT&T ecc: C Development Set (ECCS) (3.0.12) Jun 6 1995 acomp: C Development Set (ECCS) (3.0.12) Jun 7 1995 as: (EPC MIPS-2 Compilation Tools) 3.6.3 Apr 11 1995 ld: EPC MIPS-2 Compilation Tools (3.6.6) Apr 11 1995 ld: /opt/epc/ecc/epctools/crt1.o: notice: reading: ELF flags=0x000003 ld: /opt/epc/ecc/epctools/crti.o: notice: reading: ELF flags=0x000003 ld: /opt/epc/ecc/epctools/values-Xt.o: notice: reading: ELF flags=0x000002 ld: t.o: notice: reading: ELF flags=0x000005 ld: /opt/epc/ecc/epctools/crtn.o: notice: reading: ELF flags=0x000002 ld: /usr/ccs/lib/libc.so(libc.so.1): notice: reading: ELF flags=0x10000003 ----------------------------------------------------------------------------- I am still in the process of debugging. I found out something else. I tried to debug one test program. (both using gas) 1) Using gcc and native linker 2) Using gcc and the gnu linker. I) In the first case as usual I don't have any problem. >From the _exithandle() , _fini is called. __________________ Clip of the debugging __________________________________ 0x40062cc8 in _exithandle () 0x40062ccc in _exithandle () 0x40062cd0 in _exithandle () 0x400744 in _fini () 0x400748 in _fini () 0x400750 in _fini () ____________________ Later stuff not shown _________________________ II) How ever in the second case the _fini () is *not* being called . Instead _etext is being called from where on after return to _exithandle -> _cleanup () -> _rtbinder ........ message "unidentifiable procedure reference (address =0x40062cd8 Killed ___________________ Clip of the debugging ___________________________________ 0x40062ccc in _exithandle () 0x40062cd0 in _exithandle () 0x4009c0 in _etext () 0x4009c4 in _etext () 0x4009cc in _etext () 0x4009d0 in _etext () ... ... ... ... ... ... .. .. .. .. .. .. .. 0x4009ec in _etext () 0x40062cd8 in _exithandle () 0x40062cdc in _exithandle () 0x40062ce0 in _exithandle () 0x40062ce4 in _exithandle () 0x40062cc4 in _exithandle () 0x40062cc8 in _exithandle () 0x40062ccc in _exithandle () 0x40062cd0 in _exithandle () 0x400980 in _cleanup () 0x400984 in _cleanup () 0x400988 in _cleanup () 0x40052f60 in _rtbinder () 0x40052f64 in _rtbinder () 0x40052f68 in _rtbinder () ........ ........ dynamic linker: unidentifiable procedure reference (address = 0x40062cd8) killed _____________________Later stuff not shown __________________________________ So I can see that _fini() is not being called , (which I think should be)... Any pointers on this will help me for further debugging. Or may be this could solve the problem , I suppose. Thanks in advance for any help received. With best regards Koundinya