This is the mail archive of the gcc@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]
Other format: [Raw text]

Re: HP-UX 11 and ld +init


>   2003-01-04  John David Anglin  <dave.anglin@nrc.ca>
> 
> 	* config.gcc (hppa*64*-*-hpux11*): Define extra_parts.  Don't use
> 	collect2.
> 	* pa-hpux11.h (LDD_SUFFIX, PARSE_LDD_OUTPUT): Undefine.
> 	(HAS_INIT_SECTION, LD_INIT_SWITCH, LD_FINI_SWITCH): Define.
> 
> you turned on "+init" and "+fini" for the 32-bit linker on HP-UX 11.
> According to the man pages on the system we have, those are only
> supported in the 64-bit linker.  Was using +init with the 32-bit
> linker intentional?  Or should those changes just be moved to
> pa64-hpux.h?

Yes, this was intentional.  The ld man page that I have lists these
as common 32 and 64-bit options.  I have tested this feature and
there was some previous discussion on the list.  The advantage of
using these two options is that they work with shared libraries
loaded with shl_load.

There is some wierdness with these options.  The initializers and
finalizers execute in opposite order on 32-bit and 64-bit systems.

We don't use HAS_INIT_SECTION, LD_INIT_SWITCH, LD_FINI_SWITCH on
hppa64-hpux.  There we use the DT_INIT_ARRAY and the DT_FINI_ARRAY
features of the HP and GNU loaders.  This is done using a somewhat
horrible hack to the macros used by crtstuff.c.  The GNU loader
doesn't support "+init" and "+fini" and there is no simple way to
switch to the GNU syntax.  So, I worked out a technique use the array
init/fini that works with both linkers.  On the 32-bit port, we only
have the HP linker.

In summary, these changes give us very much improved handling of
initializers and finalizers under HP-UX 11.

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


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