Commit 08ec53e7 by John David Anglin Committed by John David Anglin

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
parent 61d31826
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> 2002-11-13 Kazu Hirata <kazu@cs.umass.edu>
* gthr-solaris.h: Fix formatting. * gthr-solaris.h: Fix formatting.
......
...@@ -31,14 +31,16 @@ Boston, MA 02111-1307, USA. */ ...@@ -31,14 +31,16 @@ Boston, MA 02111-1307, USA. */
N_("Assume code will be linked by HP ld") }, N_("Assume code will be linked by HP ld") },
/* We can debug dynamically linked executables on hpux11; we also /* 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 #undef LINK_SPEC
#if ((TARGET_DEFAULT | TARGET_CPU_DEFAULT) & MASK_GNU_LD) #if ((TARGET_DEFAULT | TARGET_CPU_DEFAULT) & MASK_GNU_LD)
#define LINK_SPEC \ #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 #else
#define LINK_SPEC \ #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 #endif
/* Like the default, except no -lg. */ /* Like the default, except no -lg. */
...@@ -252,19 +254,26 @@ do { \ ...@@ -252,19 +254,26 @@ do { \
/* Since we are not yet using .init and .fini sections, we need to /* Since we are not yet using .init and .fini sections, we need to
explicitly arrange to run the global constructors and destructors. explicitly arrange to run the global constructors and destructors.
HPUX 11 has ldd and we use it to determine the dependencies of We could use ldd for this but it depends on LD_LIBRARY_PATH being
dynamic objects. It might be possible to use the ld options for correctly set. So, we use the ld init and fini switches. However,
running initializers and terminators and thereby avoid the necessity we need to support different switches for the GNU and HP linkers.
of running ldd, but unfortunately the options are different for We can't check TARGET_GNU_LD in collect2, so we need a different
the two linkers. */ test. The +Accept switch is always the first switch when we are
#define LDD_SUFFIX "/usr/ccs/bin/ldd" using the HP linker (see define for LINK_SPEC). Checking for it
is a somewhat fragile as it depends on internal details of the
/* Skip to first '>' then advance to '/' at the beginning of the filename. */ collect2 program but it is better than testing ld_file_name.
#define PARSE_LDD_OUTPUT(PTR) \
do { \ FIXME: The GNU linker is broken. The -init/-fini switches don't
while (*PTR != '>') PTR++; \ work and ldd can't determine the dynamic dependences of executables
while (*PTR != '/') PTR++; \ linked with GNU ld. The init and fini routines are not executed
} while (0) 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 /* 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 and returns 0. /bin/true cannot be used because it is a script without
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment