This is the mail archive of the gcc-patches@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]

Constructors/Destructors on hppa64-hp-hpux11


Constructors and destructors were not being run for the dependencies
of dynamic objects.  We need to define LDD_SUFFIX and PARSE_LDD_OUTPUT,
or possibly LD_INIT_SWITCH and LD_FINI_SWITCH.  Using LDD_SUFFIX and
PARSE_LDD_OUTPUT works with both the HP and GNU linkers, so that's the
approach I adopted.  This patch is an interim fix until the linker
issues with using .init/.fini sections are resolved.

Tested on hppa64-hp-hpux11.11.  There were no regressions.  It fixes
several hundred objc FAILs.

Applied to main.

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

2002-11-06  John David Anglin  <dave@hiauly1.hia.nrc.ca>

	* pa64-hpux.h (LDD_SUFFIX, PARSE_LDD_OUTPUT): Define.

Index: config/pa/pa64-hpux.h
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/config/pa/pa64-hpux.h,v
retrieving revision 1.16
diff -u -3 -p -r1.16 pa64-hpux.h
--- config/pa/pa64-hpux.h	5 Nov 2002 16:51:10 -0000	1.16
+++ config/pa/pa64-hpux.h	6 Nov 2002 06:50:59 -0000
@@ -135,6 +135,21 @@ do {  \
 
 #undef STARTFILE_SPEC
 
+
+/* Since we are not yet using .init and .fini sections, we need to
+   explicitly arrange to run the global constructors and destructors.
+   HPUX 11 has ldd and we use it to determine the dependencies of
+   dynamic objects.  It might be possible to use the ld options for
+   running initializers and terminators and thereby avoid the necessity
+   of running ldd, but unfortunately the options are different for
+   the two linkers.  */
+#define LDD_SUFFIX "/usr/ccs/bin/ldd"
+/* Skip to first '>' then advance to '/' at the beginning of the filename.  */
+#define PARSE_LDD_OUTPUT(PTR)					\
+do {								\
+  while (*PTR != '>') PTR++;					\
+  while (*PTR != '/') PTR++;					\
+} while (0)
 #endif
 
 /* Switch into a generic section.  */


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