[parisc-linux] Program counter from sigcontext, constructurs

John David Anglin dave@hiauly1.hia.nrc.ca
Fri, 25 Apr 2003 15:56:27 -0400 (EDT)

> > > 2) If I mark a C function as a constructor function, and 
> > compile it with -fPIC, it seems to run before globals are 
> > properly accessible.  The retrieval of the address of a 
> > global through the global offset table seems to return a bad 
> > address and the access faults.  Are there known issues in 
> > this area?  (The offending function actually ends up in the 
> > main program, if that matters.)

I'm not aware of any.  All the libstdc++ test pass and this involves
running constructors in a shared library, so it would seem the PIC
register and got table must be setup.  Function pointer canonicalization
involves accessing the got table in some situations.  This can happen
in crtstuff.c which runs constructors.  Do you have a testcase?

It might be a linker issue.  There are some subtle issues with calling
PIC code that's not in a shared library.

J. David Anglin                                  dave.anglin@nrc-cnrc.gc.ca
National Research Council of Canada              (613) 990-0752 (FAX: 952-6602)