aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJohn David Anglin <dave@hiauly1.hia.nrc.ca>2002-11-13 20:38:13 +0000
committerJohn David Anglin <danglin@gcc.gnu.org>2002-11-13 20:38:13 +0000
commit08ec53e7980ab9f5d4e9e6a7152684580b78bad8 (patch)
treec7149cfedd6aea2ba2fd3e475d7cbc693005b6f8 /gcc
parent61d318260a1c726f818da770f2e425411d9a5880 (diff)
downloadgcc-08ec53e7980ab9f5d4e9e6a7152684580b78bad8.zip
gcc-08ec53e7980ab9f5d4e9e6a7152684580b78bad8.tar.gz
gcc-08ec53e7980ab9f5d4e9e6a7152684580b78bad8.tar.bz2
pa64-hpux.h (LINK_SPEC): Move "+Accept TypeMismatch" switch to the beginning of the spec.
* pa64-hpux.h (LINK_SPEC): Move "+Accept TypeMismatch" switch to the beginning of the spec. (LDD_SUFFIX, PARSE_LDD_OUTPUT): Delete. (LD_INIT_SWITCH, LD_FINI_SWITCH): Define but don't enable. Add comment regarding problems with global constructors when using GNU ld. From-SVN: r59084
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/config/pa/pa64-hpux.h41
2 files changed, 33 insertions, 16 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 671c86e..23e98e5 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,11 @@
+2002-11-13 John David Anglin <dave@hiauly1.hia.nrc.ca>
+
+ * pa64-hpux.h (LINK_SPEC): Move "+Accept TypeMismatch" switch to the
+ beginning of the spec.
+ (LDD_SUFFIX, PARSE_LDD_OUTPUT): Delete.
+ (LD_INIT_SWITCH, LD_FINI_SWITCH): Define but don't enable. Add comment
+ regarding problems with global constructors when using GNU ld.
+
2002-11-13 Kazu Hirata <kazu@cs.umass.edu>
* gthr-solaris.h: Fix formatting.
diff --git a/gcc/config/pa/pa64-hpux.h b/gcc/config/pa/pa64-hpux.h
index 1966a40..aa7dac7 100644
--- a/gcc/config/pa/pa64-hpux.h
+++ b/gcc/config/pa/pa64-hpux.h
@@ -31,14 +31,16 @@ Boston, MA 02111-1307, USA. */
N_("Assume code will be linked by HP ld") },
/* We can debug dynamically linked executables on hpux11; we also
- want dereferencing of a NULL pointer to cause a SEGV. */
+ want dereferencing of a NULL pointer to cause a SEGV. Do not move
+ the "+Accept TypeMismatch" switch. We check for it in collect2
+ to determine which init/fini is needed. */
#undef LINK_SPEC
#if ((TARGET_DEFAULT | TARGET_CPU_DEFAULT) & MASK_GNU_LD)
#define LINK_SPEC \
- "-E %{mlinker-opt:-O} %{!shared:-u main} %{static:-a archive} %{shared:%{mhp-ld:-b}%{!mhp-ld:-shared}} %{mhp-ld:+Accept TypeMismatch}"
+ "%{mhp-ld:+Accept TypeMismatch} -E %{mlinker-opt:-O} %{!shared:-u main} %{static:-a archive} %{shared:%{mhp-ld:-b}%{!mhp-ld:-shared}}"
#else
#define LINK_SPEC \
- "-E %{mlinker-opt:-O} %{!shared:-u main} %{static:-a archive} %{shared:%{mgnu-ld:-shared}%{!mgnu-ld:-b}} %{!mgnu-ld:+Accept TypeMismatch}"
+ "%{!mgnu-ld:+Accept TypeMismatch} -E %{mlinker-opt:-O} %{!shared:-u main} %{static:-a archive} %{shared:%{mgnu-ld:-shared}%{!mgnu-ld:-b}}"
#endif
/* Like the default, except no -lg. */
@@ -252,19 +254,26 @@ do { \
/* 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)
+ We could use ldd for this but it depends on LD_LIBRARY_PATH being
+ correctly set. So, we use the ld init and fini switches. However,
+ we need to support different switches for the GNU and HP linkers.
+ We can't check TARGET_GNU_LD in collect2, so we need a different
+ test. The +Accept switch is always the first switch when we are
+ using the HP linker (see define for LINK_SPEC). Checking for it
+ is a somewhat fragile as it depends on internal details of the
+ collect2 program but it is better than testing ld_file_name.
+
+ FIXME: The GNU linker is broken. The -init/-fini switches don't
+ work and ldd can't determine the dynamic dependences of executables
+ linked with GNU ld. The init and fini routines are not executed
+ although DT_INIT and DT_FINI appear ok. As a result, defining
+ LD_INIT_SWITCH and LD_FINI_SWITCH causes more harm than good when
+ using GNU ld. However, the definitions appear to work fine with
+ the HP linker. */
+#if 0
+#define LD_INIT_SWITCH (strcmp ("+Accept", ld2_argv[1]) ? "-init" : "+init")
+#define LD_FINI_SWITCH (strcmp ("+Accept", ld2_argv[1]) ? "-fini" : "+fini")
+#endif
/* If using HP ld do not call pxdb. Use size as a program that does nothing
and returns 0. /bin/true cannot be used because it is a script without