aboutsummaryrefslogtreecommitdiff
path: root/gcc/gcc.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2001-12-15 12:49:18 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2001-12-15 12:49:18 +0100
commit275b60d6d894519cc11ee3cd4f8ad0ba6f92b0d3 (patch)
tree1e290b8253af587309d21dfa2217501a304a75ac /gcc/gcc.c
parent861ef92859ce3681ae24ecac1384e0be2a035c9d (diff)
downloadgcc-275b60d6d894519cc11ee3cd4f8ad0ba6f92b0d3.zip
gcc-275b60d6d894519cc11ee3cd4f8ad0ba6f92b0d3.tar.gz
gcc-275b60d6d894519cc11ee3cd4f8ad0ba6f92b0d3.tar.bz2
configure.in: Check for ld.
* configure.in: Check for ld. (HAVE_LD_EH_FRAME_HDR): Define if ld supports --eh-frame-hdr option. * configure, config.in: Rebuilt. * config.gcc: Add crtbeginT.o to extra_parts where needed. * config/t-linux (LIB2ADDEH, LIB2ADDEHDEP): Use unwind-dw2-fde-glibc frame unwinding on Linux. * config/t-linux-gnulibc1 (LIB2ADDEH, LIB2ADDEHDEP): Use unwind-dw2-fde frame unwinding. * config/linux.h (STARTFILE_SPEC): Use crtbeginT.o for -static. (LINK_EH_SPEC): Define. * config/i386/gnu.h (STARTFILE_SPEC): Use crtbeginT.o for -static. * config/ia64/linux.h (STARTFILE_SPEC, LINK_EH_SPEC): Define. * config/ia64/fde-glibc.c (_Unwind_IteratePhdrCallback): Don't iterate further if pc falls into current library, but fde was not found. * config/sparc/linux.h (STARTFILE_SPEC): Use crtbeginT.o for -static if using glibc. (LINK_EH_SPEC): Define. * config/sparc/linux64.h (STARTFILE_SPEC32, STARTFILE_SPEC64): Use crtbeginT.o for -static. (LINK_EH_SPEC): Define. * config/sparc/t-linux64 (EXTRA_MULTILIB_PARTS): Add crtbeginT.o. * Makefile.in (crtbeginT.o): Add rule. * gcc.c (init_gcc_specs): For -static-libgcc, use -lgcc -lgcc_eh. If neither -static-libgcc nor -shared-libgcc is passed and -shared, use -lgcc if LINK_EH_SPEC is defined and -lgcc_s -lgcc if not. If none of the above switches are passed, use -lgcc -lgcc_eh. (init_spec): If LINK_EH_SPEC is defined, prepend it to link_spec. * mklibgcc.in: Don't include LIB2ADDEH objects into libgcc.a if creating libgcc_s.so, put them into separate libgcc_eh.a instead. * unwind-dw2-fde.c: Don't include any headers if this file is included from other .c file. * unwind-dw2-fde-glibc.c: New file. * crtstuff.c (USE_PT_GNU_EH_FRAME, USE_EH_FRAME_REGISTRY): Define. Use it instead of EH_FRAME_SECTION_NAME where appropriate. From-SVN: r48039
Diffstat (limited to 'gcc/gcc.c')
-rw-r--r--gcc/gcc.c38
1 files changed, 27 insertions, 11 deletions
diff --git a/gcc/gcc.c b/gcc/gcc.c
index 1e150c8..466f6cd 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -323,7 +323,7 @@ static void clear_args PARAMS ((void));
static void fatal_error PARAMS ((int));
#ifdef ENABLE_SHARED_LIBGCC
static void init_gcc_specs PARAMS ((struct obstack *,
- const char *,
+ const char *, const char *,
const char *));
#endif
#if defined(HAVE_TARGET_OBJECT_SUFFIX) || defined(HAVE_TARGET_EXECUTABLE_SUFFIX)
@@ -1416,28 +1416,36 @@ static struct spec_list *specs = (struct spec_list *) 0;
#ifdef ENABLE_SHARED_LIBGCC
static void
-init_gcc_specs (obstack, shared_name, static_name)
+init_gcc_specs (obstack, shared_name, static_name, eh_name)
struct obstack *obstack;
const char *shared_name;
const char *static_name;
+ const char *eh_name;
{
char buffer[128];
+ const char *p;
/* If we see -shared-libgcc, then use the shared version. */
sprintf (buffer, "%%{shared-libgcc:%s %s}", shared_name, static_name);
obstack_grow (obstack, buffer, strlen (buffer));
/* If we see -static-libgcc, then use the static version. */
- sprintf (buffer, "%%{static-libgcc:%s}", static_name);
+ sprintf (buffer, "%%{static-libgcc:%s %s}", static_name, eh_name);
obstack_grow (obstack, buffer, strlen (buffer));
- /* Otherwise, if we see -shared, then use the shared version. */
- sprintf (buffer,
- "%%{!shared-libgcc:%%{!static-libgcc:%%{shared:%s %s}}}",
- shared_name, static_name);
+ /* Otherwise, if we see -shared, then use the shared version
+ if using EH registration routines or static version without
+ exception handling routines otherwise. */
+ p = "%{!shared-libgcc:%{!static-libgcc:%{shared:";
+ obstack_grow (obstack, p, strlen (p));
+#ifdef LINK_EH_SPEC
+ sprintf (buffer, "%s}}}", static_name);
+#else
+ sprintf (buffer, "%s %s}}}", shared_name, static_name);
+#endif
obstack_grow (obstack, buffer, strlen (buffer));
/* Otherwise, use the static version. */
sprintf (buffer,
- "%%{!shared-libgcc:%%{!static-libgcc:%%{!shared:%s}}}",
- static_name);
+ "%%{!shared-libgcc:%%{!static-libgcc:%%{!shared:%s %s}}}",
+ static_name, eh_name);
obstack_grow (obstack, buffer, strlen (buffer));
}
#endif /* ENABLE_SHARED_LIBGCC */
@@ -1525,7 +1533,8 @@ init_spec ()
"-lgcc_s%M"
#endif
,
- "-lgcc");
+ "-lgcc",
+ "-lgcc_eh");
p += 5;
in_sep = 0;
}
@@ -1540,7 +1549,8 @@ init_spec ()
"-lgcc_s%M"
#endif
,
- "libgcc.a%s");
+ "libgcc.a%s",
+ "libgcc_eh.a%s");
p += 10;
in_sep = 0;
}
@@ -1565,6 +1575,12 @@ init_spec ()
asm_spec = obstack_finish (&obstack);
}
#endif
+#ifdef LINK_EH_SPEC
+ /* Prepend LINK_EH_SPEC to whatever link_spec we had before. */
+ obstack_grow (&obstack, LINK_EH_SPEC, sizeof(LINK_EH_SPEC) - 1);
+ obstack_grow0 (&obstack, link_spec, strlen (link_spec));
+ link_spec = obstack_finish (&obstack);
+#endif
specs = sl;
}