* som.h (SUPPORTS_WEAK, SUPPORTS_ONE_ONLY, MAKE_DECL_ONE_ONLY,
authordanglin <danglin@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 16 Jan 2003 00:34:45 +0000 (00:34 +0000)
committerdanglin <danglin@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 16 Jan 2003 00:34:45 +0000 (00:34 +0000)
ASM_WEAKEN_LABEL, GTHREAD_USE_WEAK): Define.
* pa.h (TARGET_SOM_SDEF): Define.
* pa-hpux11.h (TARGET_SOM_SDEF): Define.
* config/os/hpux/os_defines.h (_GLIBCPP_GTHREAD_USE_WEAK): Define for
__hppa__.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@61372 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/config/pa/pa-hpux11.h
gcc/config/pa/pa.h
gcc/config/pa/som.h
libstdc++-v3/ChangeLog
libstdc++-v3/config/os/hpux/os_defines.h

index bf4c0e7..0d7d19c 100644 (file)
@@ -1,3 +1,10 @@
+2003-01-15  John David Anglin  <dave@hiauly1.hia.nrc.ca>
+
+       * som.h (SUPPORTS_WEAK, SUPPORTS_ONE_ONLY, MAKE_DECL_ONE_ONLY,
+       ASM_WEAKEN_LABEL, GTHREAD_USE_WEAK): Define.
+       * pa.h (TARGET_SOM_SDEF): Define.
+       * pa-hpux11.h (TARGET_SOM_SDEF): Define.
+
 2003-01-16  Stephane Carrez  <stcarrez@nerim.fr>
 
        * config/m68hc11/m68hc11.c (expand_prologue): Use push/pop to 
index 3228ee0..502b82b 100644 (file)
@@ -1,5 +1,5 @@
 /* Definitions of target machine for GNU compiler, for HP PA-RISC
-   Copyright (C) 1998, 1999, 2000, 2002 Free Software Foundation, Inc.
+   Copyright (C) 1998, 1999, 2000, 2002, 2003 Free Software Foundation, Inc.
 
 This file is part of GNU CC.
 
@@ -130,3 +130,8 @@ Boston, MA 02111-1307, USA.  */
 #define LD_INIT_SWITCH "+init"
 #undef LD_FINI_SWITCH
 #define LD_FINI_SWITCH "+fini"
+
+/* The HP-UX 11.X SOM linker (ld32) can successfully link shared libraries
+   with secondary definition (weak) symbols.  */
+#undef TARGET_SOM_SDEF
+#define TARGET_SOM_SDEF 1
index a1954e1..2361ba4 100644 (file)
@@ -1,6 +1,6 @@
 /* Definitions of target machine for GNU compiler, for the HP Spectrum.
    Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
-   2001, 2002 Free Software Foundation, Inc.
+   2001, 2002, 2003 Free Software Foundation, Inc.
    Contributed by Michael Tiemann (tiemann@cygnus.com) of Cygnus Support
    and Tim Moore (moore@defmacro.cs.utah.edu) of the Center for
    Software Science at the University of Utah.
@@ -206,6 +206,11 @@ extern int target_flags;
    not for external calls.  */
 #define TARGET_LONG_PIC_PCREL_CALL 0
 
+/* Define to a C expression evaluating to true to use SOM secondary
+   definition symbols for weak support.  Linker support for secondary
+   definition symbols is buggy prior to HP-UX 11.X.  */
+#define TARGET_SOM_SDEF 0
+
 /* Macro to define tables used to set the flags.  This is a
    list in braces of target switches with each switch being
    { "NAME", VALUE, "HELP_STRING" }.  VALUE is the bits to set,
index aa509bd..577a67e 100644 (file)
@@ -1,5 +1,5 @@
 /* Definitions for SOM assembler support.
-   Copyright (C) 1999, 2001, 2002 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2001, 2002, 2003 Free Software Foundation, Inc.
 
 This file is part of GNU CC.
 
@@ -371,3 +371,52 @@ do {                                               \
 /* Aggregates with a single float or double field should be passed and
    returned in the general registers.  */
 #define MEMBER_TYPE_FORCES_BLK(FIELD, MODE) (MODE==SFmode || MODE==DFmode)
+
+/* If GAS supports weak, we can support weak when we have working linker
+   support for secondary definitions and are generating code for GAS.  */
+#ifdef HAVE_GAS_WEAK
+#define SUPPORTS_WEAK (TARGET_SOM_SDEF && TARGET_GAS)
+#else
+#define SUPPORTS_WEAK 0
+#endif
+
+/* We can support one only if we support weak.  */
+#define SUPPORTS_ONE_ONLY SUPPORTS_WEAK
+
+/* Use weak (secondary definitions) to make one only declarations.  */
+#define MAKE_DECL_ONE_ONLY(DECL) (DECL_WEAK (DECL) = 1)
+
+/* This is how we tell the assembler that a symbol is weak.  The SOM
+   weak implementation uses the secondary definition (sdef) flag.
+
+   The behavior of sdef symbols is similar to ELF weak symbols in that
+   multiple definitions can occur without incurring a link error.
+   However, they differ in the following ways:
+     1) Undefined sdef symbols are not allowed.
+     2) The linker searches for undefined sdef symbols and will load an
+       archive library member to resolve an undefined sdef symbol.
+     3) The exported symbol from a shared library is a primary symbol
+        rather than a sdef symbol.  Thus, more care is needed in the
+       ordering of libraries.
+
+   It appears that the linker discards extra copies of "weak" functions
+   when linking shared libraries, independent of whether or not they
+   are in their own section.  In linking final executables, -Wl,-O can
+   be used to remove dead procedures.  Thus, support for named sections
+   is not needed and in previous testing caused problems with various
+   HP tools.  */
+#define ASM_WEAKEN_LABEL(FILE,NAME) \
+  do { fputs ("\t.weak\t", FILE);                              \
+       assemble_name (FILE, NAME);                             \
+       fputc ('\n', FILE);                                     \
+       if (! FUNCTION_NAME_P (NAME))                           \
+        {                                                      \
+          fputs ("\t.EXPORT ", FILE);                          \
+          assemble_name (FILE, NAME);                          \
+          fputs (",DATA\n", FILE);                             \
+        }                                                      \
+  } while (0)
+
+/* We can't handle weak aliases, and therefore can't support pragma weak.
+   Suppress the use of pragma weak in gthr-dce.h and gthr-posix.h.  */
+#define GTHREAD_USE_WEAK 0
index 9929ee8..6a1ef31 100644 (file)
@@ -1,3 +1,8 @@
+2003-01-15  John David Anglin  <dave@hiauly1.hia.nrc.ca>
+
+       * config/os/hpux/os_defines.h (_GLIBCPP_GTHREAD_USE_WEAK): Define for
+       __hppa__.
+
 2003-01-14  Jeffrey D. Oldham  <oldham@codesourcery.com>
 
        Further conform g++'s __vmi_class_type_info to the C++ ABI
index 9dd4fb4..87d9d4f 100644 (file)
@@ -89,4 +89,9 @@ typedef long int __padding_type;
 #if !defined(_GLIBCPP_SUPPORTS_WEAK) && defined (__hppa__)
 #define _GLIBCPP_INST_ATOMICITY_LOCK 1
 #endif
+
+/* Don't use pragma weak in gthread headers.  */
+#ifdef __hppa__
+#define _GLIBCPP_GTHREAD_USE_WEAK 0
+#endif
 #endif