Problem with shared library generated on Solaris 8 X86

From: Trond Norbye (trond.norbye_at_gmail.com)
Date: 08/11/04


Date: 11 Aug 2004 15:07:35 +0200



I have recently discovered a problem with shared libraries created on
solaris 8 X86. To me it seems that it is a bug introduced in an OS
patch, since I don't have the same problem on some of my more or less
unpatched systems. I have been able to create a small example to
reproduce the problem:

trondn@solsrv2 cctest> uname -a
SunOS solsrv2 5.8 Generic_108529-29 i86pc i386 i86pc

trondn@solsrv2 ~> cc -V
cc: Sun WorkShop 6 update 2 C 5.3 Patch 111680-09 2003/05/18

trondn@solsrv2 cctest> make
cc -v -c main.c
cc -v -c -g -KPIC func.c
cc -v -c -g -KPIC func_ver.c
cc -v -o libfunc.so -G func.o func_ver.o
cc -v -o testprog -R. -L. main.o -lfunc

trondn@solsrv2 cctest> dbx -V testprog
Sun WorkShop 6 update 2 Dbx Debugger 6.2 Patch 111684-14 2003/10/21
Reading testprog
Reading ld.so.1
Reading libfunc.so
dbx: panic: "Objfile::objname"(): Assertion (lo->syms_read) failed -
"objfile.cc":1419

I have attached the files I used to track down the problem.

Note that if I add a funtion to func_ver.c the problem disappears...

I downloaded (and installed) the latest OS recommended patch-cluster
today, but I still have problems :(

Trond Norbye


CC=cc -v

testprog: main.o libfunc.so
        $(LINK.c) -o testprog -R. -L. main.o -lfunc

libfunc.so: func.o func_ver.o
        $(LINK.c) -o libfunc.so -G func.o func_ver.o

main.o: main.c
        $(COMPILE.c) main.c

func.o: func.c
        $(COMPILE.c) -g -KPIC func.c

func_ver.o: func_ver.c
        $(COMPILE.c) -g -KPIC func_ver.c

clean:
        $(RM) testprog libfunc.so main.o func.o func_ver.o


int func(int val) {
   return val * 2;
}


static const char *version = "\nlibfunc.so V1.0.0\n";


extern int func(int);

int main(int argc, char **argv)
{
   return func(2);
}



Relevant Pages

  • Re: fread()
    ... > int i,istat,iaccum,intype; ... reading binary data from standard input? ... Use sizeof (float), or even better, sizeof *floatarray, instead. ... FLOAT, and set istat accordingly? ...
    (comp.lang.c)
  • Re: Opening a PPM file Image
    ... Just create a CFile object and open it in binary mode for reading, ... int height; ... int rowsize = width; ...
    (microsoft.public.vc.mfc)
  • Re: frustrated by fscanf and sscanf
    ... no threads talking about reading a series of numbers. ... The input files, somehow structured, is exemplified below: ... int SIZE; ... Reading 2 12X12 arrays of double. ...
    (comp.lang.c)
  • Re: Two threads reading from same file?
    ... > proper part of the disk file, I filled the disk file with 4-byte ... When reading from disk index 999 ... int loop = 1000; ... void CreateTestFile() ...
    (microsoft.public.win32.programmer.kernel)
  • Re: integers and arrays in Java - how?
    ... But "int" not only does not work, it also prevents reading X and Y coordinates of the mouse. ... Get X and Y mouse coordinates into a variable that i can do real math on. ... If i try "int" in that math, the values are then zero for everything - even those where i do no calculation. ... And i would have no clue as if the code was compilable or not, and i do not think i care, since the jave code is a part of an HTML web page. ...
    (comp.lang.java)