aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn David Anglin <dave@hiauly1.hia.nrc.ca>2003-01-16 00:34:45 +0000
committerJohn David Anglin <danglin@gcc.gnu.org>2003-01-16 00:34:45 +0000
commit4af6a063722d474da500dd104b1e4a9687430857 (patch)
tree2cb9964dd1c8c5cce2af849f133edc3faab40ab1
parentf826d5952cbea7d361f5e7869868acb7cce47d95 (diff)
downloadgcc-4af6a063722d474da500dd104b1e4a9687430857.zip
gcc-4af6a063722d474da500dd104b1e4a9687430857.tar.gz
gcc-4af6a063722d474da500dd104b1e4a9687430857.tar.bz2
som.h (SUPPORTS_WEAK, [...]): Define.
* 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. * config/os/hpux/os_defines.h (_GLIBCPP_GTHREAD_USE_WEAK): Define for __hppa__. From-SVN: r61372
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/config/pa/pa-hpux11.h7
-rw-r--r--gcc/config/pa/pa.h7
-rw-r--r--gcc/config/pa/som.h51
-rw-r--r--libstdc++-v3/ChangeLog5
-rw-r--r--libstdc++-v3/config/os/hpux/os_defines.h5
6 files changed, 79 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index bf4c0e7..0d7d19c 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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
diff --git a/gcc/config/pa/pa-hpux11.h b/gcc/config/pa/pa-hpux11.h
index 3228ee0..502b82b 100644
--- a/gcc/config/pa/pa-hpux11.h
+++ b/gcc/config/pa/pa-hpux11.h
@@ -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
diff --git a/gcc/config/pa/pa.h b/gcc/config/pa/pa.h
index a1954e1..2361ba4 100644
--- a/gcc/config/pa/pa.h
+++ b/gcc/config/pa/pa.h
@@ -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,
diff --git a/gcc/config/pa/som.h b/gcc/config/pa/som.h
index aa509bd..577a67e 100644
--- a/gcc/config/pa/som.h
+++ b/gcc/config/pa/som.h
@@ -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
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 9929ee8..6a1ef31 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -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
diff --git a/libstdc++-v3/config/os/hpux/os_defines.h b/libstdc++-v3/config/os/hpux/os_defines.h
index 9dd4fb4..87d9d4f 100644
--- a/libstdc++-v3/config/os/hpux/os_defines.h
+++ b/libstdc++-v3/config/os/hpux/os_defines.h
@@ -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