From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f678f,8ac481635e3078d4,start X-Google-Attributes: gidf678f,public X-Google-Thread: fee84,8ac481635e3078d4,start X-Google-Attributes: gidfee84,public From: fjh@mundook.cs.mu.OZ.AU (Fergus Henderson) Subject: bug in shared library implementation? Date: 1996/03/24 Message-ID: <4j3g6b$s94@mulga.cs.mu.OZ.AU>#1/1 X-Deja-AN: 144035805 organization: Comp Sci, University of Melbourne newsgroups: comp.unix.osf.osf1,comp.unix.osf.misc I've been building an application on an alpha-dec-osf3.2 system using shared libraries. The problem is that my application gets a segmentation violation when loading in the shared libraries, before main() is entered. The application consists of four components, each of which are written in C, and compiled using gcc version 2.6.3. Three of these components are compiled into three shared libraries, and the fourth component is the main program which I link with these shared libraries. When I try to debug the program using `dbx', it reports $ dbx string_test dbx: fatal error: can't continue because process state is AT SIGNAL and needs to be DSO and then exits. (What does that error message mean?) If I try to debug the core file produced, dbx gets rather confused: $ dbx string_test core dbx version 3.11.8 Type 'help' for help. Core file created by program "string_test" warning: load address unavailable for /home/mercury/public/mercury-latest/alpha-dec-osf3.2/lib/mercury/lib/alpha-dec-osf3.2/libgc_prof.so signal Segmentation fault at warning: PC value 0x3ff80019ecc not valid, trying RA warning: RA value 0x3ff80015878 not valid, trying text start warning: text start 0x120000000 not valid, trying data start warning: Using data start as a text address -- traceback will not work > [., 0x140000000] call_pal cflush When I try to debug the program using `gdb', it reports /proc/18164: Bad file number. PIOCSTATUS or PIOCWSTOP failed. before main is entered. This is probably because the process has already died before that point. So the next thing I tried was setting the _RLD_ARGS variable, so that I could debug the loading of shared libraries. Setting _RLD_ARGS to `-v' showed that it got as far as loading the first shared library, and then died: $ _RLD_ARGS=-v ./string_test 18345:./string_test: /sbin/loader: _RLD_ARGS = "-v" 18345:./string_test: /sbin/loader: _RLD_ROOT = / 18345:./string_test: /sbin/loader: mapped Main at 0x120000000 18345:./string_test: /sbin/loader: mapped /home/mercury/public/mercury-latest/alpha-dec-osf3.2/lib/mercury/lib/reg.gc.prof/alpha-dec-osf3.2/libmercury.so at 0x3ffbff10000 Segmentation fault - core dumped Now the wierdest thing of all is that if I set _RLD_ARGS=-interact, it works! Unfortunately, however, that's only true for this particular test case -- I have some other programs which are linked with the same libraries that work only if _RLD_ARGS is *not* set to `-interact'. The problems go away if I link statically. The same application works fine with shared libraries on IRIX 5 and Solaris. Does anyone have any idea what could be causing this, or how to fix it (other than by linking statically)? I'm totally stumped by this one. Any hints or even guesses would be greatly appreciated. -- Fergus Henderson WWW: http://www.cs.mu.oz.au/~fjh fjh@cs.mu.oz.au PGP: finger fjh@128.250.37.3