Blame SOURCES/gcc44-ia64-libunwind.patch

dc1507
2004-11-27  Jakub Jelinek  <jakub@redhat.com>
dc1507
dc1507
	* config.gcc (ia64*-*-linux*): If native and libelf is installed,
dc1507
	use ia64/t-glibc-no-libunwind instead of the other t-*unwind*
dc1507
	fragments.
dc1507
	* config/ia64/t-glibc-no-libunwind: New file.
dc1507
	* config/ia64/change-symver.c: New file.
dc1507
	* config/ia64/unwind-ia64.c: If USE_SYMVER_GLOBAL and SHARED,
dc1507
	define _Unwind_* to __symverglobal_Unwind_*.
dc1507
	(alias): Undefine.
dc1507
	(symverglobal): Define.  Use it on _Unwind_*.
dc1507
	* config/ia64/mkmap-symver-multi.awk: New file.
dc1507
	* config/ia64/libgcc-ia64-no-libunwind.ver: New file.
dc1507
dc1507
--- gcc/config.gcc.jj	2004-10-04 08:55:44.000000000 -0400
dc1507
+++ gcc/config.gcc	2004-11-13 05:23:50.000000000 -0500
dc1507
@@ -1185,9 +1185,16 @@ ia64*-*-freebsd*)
dc1507
 	;;
dc1507
 ia64*-*-linux*)
dc1507
 	tm_file="${tm_file} dbxelf.h elfos.h svr4.h linux.h ia64/sysv4.h ia64/linux.h"
dc1507
-	tmake_file="${tmake_file} ia64/t-ia64 t-libunwind ia64/t-glibc"
dc1507
-	if test x$with_system_libunwind != xyes ; then
dc1507
-		tmake_file="${tmake_file} t-libunwind-elf ia64/t-glibc-libunwind"
dc1507
+	tmake_file="${tmake_file} ia64/t-ia64"
dc1507
+	if test x${target} = x${host} && test x${target} = x${build} \
dc1507
+	   && grep gelf_getverdef /usr/include/gelf.h > /dev/null 2>&1 \
dc1507
+	   && test -f /usr/lib/libelf.so; then
dc1507
+		tmake_file="${tmake_file} ia64/t-glibc-no-libunwind"
dc1507
+	else
dc1507
+		tmake_file="${tmake_file} t-libunwind ia64/t-glibc"
dc1507
+		if test x$with_system_libunwind != xyes ; then
dc1507
+			tmake_file="${tmake_file} t-libunwind-elf ia64/t-glibc-libunwind"
dc1507
+		fi
dc1507
 	fi
dc1507
 	target_cpu_default="MASK_GNU_AS|MASK_GNU_LD"
dc1507
 	extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o crtfastmath.o"
dc1507
--- gcc/config/ia64/t-glibc-no-libunwind.jj	2004-02-18 10:27:36.000000000 -0500
dc1507
+++ gcc/config/ia64/t-glibc-no-libunwind	2004-11-15 09:56:33.000000000 -0500
dc1507
@@ -0,0 +1,30 @@
dc1507
+# Don't use system libunwind library on IA-64 GLIBC based system,
dc1507
+# but make _Unwind_* symbols unversioned, so that created programs
dc1507
+# are usable even when libgcc_s uses libunwind.
dc1507
+LIB2ADDEH += $(srcdir)/config/ia64/fde-glibc.c
dc1507
+SHLIB_MAPFILES += $(srcdir)/config/ia64/libgcc-ia64-no-libunwind.ver
dc1507
+SHLIB_MKMAP = $(srcdir)/config/ia64/mkmap-symver-multi.awk
dc1507
+
dc1507
+SHLIB_LINK = $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) -shared -nodefaultlibs \
dc1507
+	-Wl,--soname=$(SHLIB_SONAME) \
dc1507
+	-Wl,--version-script=$(SHLIB_MAP) \
dc1507
+	-o $(SHLIB_DIR)/$(SHLIB_SONAME).tmp @multilib_flags@ $(SHLIB_OBJS) -lc && \
dc1507
+	rm -f $(SHLIB_DIR)/$(SHLIB_SOLINK) && \
dc1507
+	if [ -f $(SHLIB_DIR)/$(SHLIB_SONAME) ]; then \
dc1507
+	  mv -f $(SHLIB_DIR)/$(SHLIB_SONAME) \
dc1507
+		$(SHLIB_DIR)/$(SHLIB_SONAME).backup; \
dc1507
+	else true; fi && \
dc1507
+	gcc -O2 -o $(SHLIB_DIR)/$(SHLIB_SONAME).tweak \
dc1507
+	  $$(gcc_srcdir)/config/ia64/change-symver.c -lelf && \
dc1507
+	$(SHLIB_DIR)/$(SHLIB_SONAME).tweak $(SHLIB_DIR)/$(SHLIB_SONAME).tmp \
dc1507
+	GCC_3.4.2 _GLOBAL_ \
dc1507
+	_Unwind_GetGR _Unwind_RaiseException _Unwind_GetRegionStart _Unwind_SetIP \
dc1507
+	_Unwind_GetIP _Unwind_GetLanguageSpecificData _Unwind_Resume \
dc1507
+	_Unwind_DeleteException _Unwind_SetGR _Unwind_ForcedUnwind \
dc1507
+	_Unwind_Backtrace _Unwind_FindEnclosingFunction _Unwind_GetCFA \
dc1507
+	_Unwind_Resume_or_Rethrow _Unwind_GetBSP && \
dc1507
+	rm -f $(SHLIB_DIR)/$(SHLIB_SONAME).tweak && \
dc1507
+	mv $(SHLIB_DIR)/$(SHLIB_SONAME).tmp $(SHLIB_DIR)/$(SHLIB_SONAME) && \
dc1507
+	$(LN_S) $(SHLIB_SONAME) $(SHLIB_DIR)/$(SHLIB_SOLINK)
dc1507
+
dc1507
+TARGET_LIBGCC2_CFLAGS += -DUSE_SYMVER_GLOBAL
dc1507
--- gcc/config/ia64/change-symver.c.jj	2004-02-18 10:27:36.000000000 -0500
dc1507
+++ gcc/config/ia64/change-symver.c	2004-11-13 05:23:50.000000000 -0500
dc1507
@@ -0,0 +1,211 @@
dc1507
+#define _GNU_SOURCE 1
dc1507
+#define _FILE_OFFSET_BITS 64
dc1507
+#include <endian.h>
dc1507
+#include <errno.h>
dc1507
+#include <error.h>
dc1507
+#include <fcntl.h>
dc1507
+#include <fnmatch.h>
dc1507
+#include <gelf.h>
dc1507
+#include <stdlib.h>
dc1507
+#include <string.h>
dc1507
+#include <unistd.h>
dc1507
+
dc1507
+int
dc1507
+compute_veridx (const char *name, Elf *elf, Elf_Data *verd, GElf_Shdr *verd_shdr)
dc1507
+{
dc1507
+  if (strcmp (name, "_GLOBAL_") == 0)
dc1507
+    return 1;
dc1507
+
dc1507
+  int cnt;
dc1507
+  size_t offset = 0;
dc1507
+  for (cnt = verd_shdr->sh_info; --cnt >= 0; )
dc1507
+    {
dc1507
+      GElf_Verdef defmem;
dc1507
+      GElf_Verdef *def;
dc1507
+      GElf_Verdaux auxmem;
dc1507
+      GElf_Verdaux *aux;
dc1507
+      unsigned int auxoffset;
dc1507
+
dc1507
+      /* Get the data at the next offset.  */
dc1507
+      def = gelf_getverdef (verd, offset, &defmem);
dc1507
+      if (def == NULL)
dc1507
+	break;
dc1507
+
dc1507
+      auxoffset = offset + def->vd_aux;
dc1507
+      aux = gelf_getverdaux (verd, auxoffset, &auxmem);
dc1507
+      if (aux == NULL)
dc1507
+	break;
dc1507
+
dc1507
+      if (strcmp (name, elf_strptr (elf, verd_shdr->sh_link,
dc1507
+		  aux->vda_name)) == 0)
dc1507
+	return def->vd_ndx;
dc1507
+
dc1507
+      /* Find the next offset.  */
dc1507
+      offset += def->vd_next;
dc1507
+    }
dc1507
+
dc1507
+  return -1;
dc1507
+}
dc1507
+
dc1507
+int
dc1507
+main (int argc, char **argv)
dc1507
+{
dc1507
+  if (argc < 4)
dc1507
+    error (1, 0, "Usage: change_symver library from_symver to_symver symbol...\nExample: change_symver libfoo.so FOO_1.0 *global* bar baz");
dc1507
+
dc1507
+  const char *fname = argv[1];
dc1507
+
dc1507
+  /* Open the file.  */
dc1507
+  int fd;
dc1507
+  fd = open (fname, O_RDWR);
dc1507
+  if (fd == -1)
dc1507
+    error (1, errno, fname);
dc1507
+
dc1507
+  elf_version (EV_CURRENT);
dc1507
+
dc1507
+  /* Now get the ELF descriptor.  */
dc1507
+  Elf *elf = elf_begin (fd, ELF_C_READ_MMAP, NULL);
dc1507
+  if (elf == NULL || elf_kind (elf) != ELF_K_ELF)
dc1507
+    error (1, 0, "Couldn't open %s: %s", fname, elf_errmsg (-1));
dc1507
+
dc1507
+  size_t shstrndx;
dc1507
+  /* Get the section header string table index.  */
dc1507
+  if (elf_getshstrndx (elf, &shstrndx) < 0)
dc1507
+    error (1, 0, "cannot get shstrndx from %s", fname);
dc1507
+
dc1507
+  GElf_Ehdr ehdr_mem;
dc1507
+  GElf_Ehdr *ehdr;
dc1507
+
dc1507
+  /* We need the ELF header in a few places.  */
dc1507
+  ehdr = gelf_getehdr (elf, &ehdr_mem);
dc1507
+  if (ehdr == NULL)
dc1507
+    error (1, 0, "couldn't get ELF headers %s: %s", fname, elf_errmsg (-1));
dc1507
+
dc1507
+  Elf_Scn *scn = NULL;
dc1507
+  GElf_Shdr shdr_mem, verd_shdr, ver_shdr, dynsym_shdr;
dc1507
+  Elf_Data *ver = NULL, *verd = NULL, *dynsym = NULL;
dc1507
+
dc1507
+  while ((scn = elf_nextscn (elf, scn)) != NULL)
dc1507
+    {
dc1507
+      GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem);
dc1507
+
dc1507
+      if (shdr == NULL)
dc1507
+	error (1, 0, "couldn't get shdr from %s", fname);
dc1507
+
dc1507
+      if ((shdr->sh_flags & SHF_ALLOC) != 0)
dc1507
+	{
dc1507
+	  const char *name = elf_strptr (elf, shstrndx, shdr->sh_name);
dc1507
+	  Elf_Data **p;
dc1507
+
dc1507
+	  if (strcmp (name, ".gnu.version") == 0)
dc1507
+	    {
dc1507
+	      p = &ver;
dc1507
+	      ver_shdr = *shdr;
dc1507
+	    }
dc1507
+	  else if (strcmp (name, ".gnu.version_d") == 0)
dc1507
+	    {
dc1507
+	      p = &verd;
dc1507
+	      verd_shdr = *shdr;
dc1507
+	    }
dc1507
+	  else if (strcmp (name, ".dynsym") == 0)
dc1507
+	    {
dc1507
+	      p = &dynsym;
dc1507
+	      dynsym_shdr = *shdr;
dc1507
+	    }
dc1507
+	  else
dc1507
+	    continue;
dc1507
+
dc1507
+	  if (*p != NULL)
dc1507
+	    error (1, 0, "Two %s sections in %s", name, fname);
dc1507
+	  *p = elf_getdata (scn, NULL);
dc1507
+	  if (*p == NULL || elf_getdata (scn, *p) != NULL)
dc1507
+	    error (1, 0, "No data or non-contiguous data in %s section in %s",
dc1507
+		   name, fname);
dc1507
+	}
dc1507
+    }
dc1507
+
dc1507
+  if (ver == NULL || verd == NULL || dynsym == NULL)
dc1507
+    error (1, 0, "Couldn't find one of the needed sections in %s", fname);
dc1507
+
dc1507
+  int from_idx = compute_veridx (argv[2], elf, verd, &verd_shdr);
dc1507
+  if (from_idx == -1)
dc1507
+    error (1, 0, "Could not find symbol version %s in %s", argv[2], fname);
dc1507
+
dc1507
+  int to_idx = compute_veridx (argv[3], elf, verd, &verd_shdr);
dc1507
+  if (to_idx == -1)
dc1507
+    error (1, 0, "Could not find symbol version %s in %s", argv[3], fname);
dc1507
+
dc1507
+  if (dynsym_shdr.sh_entsize != gelf_fsize (elf, ELF_T_SYM, 1, ehdr->e_version)
dc1507
+      || dynsym_shdr.sh_size % dynsym_shdr.sh_entsize
dc1507
+      || ver_shdr.sh_entsize != 2
dc1507
+      || (ver_shdr.sh_size & 1)
dc1507
+      || dynsym_shdr.sh_size / dynsym_shdr.sh_entsize != ver_shdr.sh_size / 2)
dc1507
+    error (1, 0, "Unexpected sh_size or sh_entsize in %s", fname);
dc1507
+
dc1507
+  size_t nentries = ver_shdr.sh_size / 2;
dc1507
+  size_t cnt;
dc1507
+  GElf_Versym array[nentries];
dc1507
+  for (cnt = 0; cnt < nentries; ++cnt)
dc1507
+    {
dc1507
+      GElf_Versym vsymmem;
dc1507
+      GElf_Versym *vsym;
dc1507
+
dc1507
+      vsym = gelf_getversym (ver, cnt, &vsymmem);
dc1507
+      if (vsym == NULL)
dc1507
+	error (1, 0, "gelt_getversym failed in %s: %s", fname, elf_errmsg (-1));
dc1507
+
dc1507
+      array[cnt] = *vsym;
dc1507
+      if (*vsym != from_idx)
dc1507
+	continue;
dc1507
+
dc1507
+      GElf_Sym sym_mem;
dc1507
+      GElf_Sym *sym;
dc1507
+      sym = gelf_getsym (dynsym, cnt, &sym_mem);
dc1507
+      if (sym == NULL)
dc1507
+	error (1, 0, "gelt_getsym failed in %s: %s", fname, elf_errmsg (-1));
dc1507
+
dc1507
+      const char *name = elf_strptr (elf, dynsym_shdr.sh_link, sym->st_name);
dc1507
+
dc1507
+      int argn;
dc1507
+      for (argn = 4; argn < argc; ++argn)
dc1507
+	if (fnmatch (argv[argn], name, 0) == 0)
dc1507
+	  {
dc1507
+	    array[cnt] = to_idx;
dc1507
+	    break;
dc1507
+	  }
dc1507
+    }
dc1507
+
dc1507
+  if (sizeof (array[0]) != 2)
dc1507
+    abort ();
dc1507
+
dc1507
+#if __BYTE_ORDER == __LITTLE_ENDIAN
dc1507
+  if (ehdr->e_ident[EI_DATA] == ELFDATA2LSB)
dc1507
+    ;
dc1507
+  else if (ehdr->e_ident[EI_DATA] == ELFDATA2MSB)
dc1507
+#elif __BYTE_ORDER == __BIG_ENDIAN
dc1507
+  if (ehdr->e_ident[EI_DATA] == ELFDATA2MSB)
dc1507
+    ;
dc1507
+  else if (ehdr->e_ident[EI_DATA] == ELFDATA2LSB)
dc1507
+#else
dc1507
+# error Unsupported endianity
dc1507
+#endif
dc1507
+    {
dc1507
+      for (cnt = 0; cnt < nentries; ++cnt)
dc1507
+	array[cnt] = ((array[cnt] & 0xff) << 8) | ((array[cnt] & 0xff00) >> 8);
dc1507
+    }
dc1507
+  else
dc1507
+    error (1, 0, "Unknown EI_DATA %d in %s", ehdr->e_ident[EI_DATA], fname);
dc1507
+
dc1507
+  if (elf_end (elf) != 0)
dc1507
+    error (1, 0, "couldn't close %s: %s", fname, elf_errmsg (-1));
dc1507
+
dc1507
+  if (lseek (fd, ver_shdr.sh_offset, SEEK_SET) != (off_t) ver_shdr.sh_offset)
dc1507
+    error (1, 0, "failed to seek to %zd in %s", (size_t) ver_shdr.sh_offset,
dc1507
+	   fname);
dc1507
+
dc1507
+  if (write (fd, array, 2 * nentries) != (ssize_t) (2 * nentries))
dc1507
+    error (1, 0, "failed to write .gnu.version section into %s", fname);
dc1507
+
dc1507
+  close (fd);
dc1507
+  return 0;
dc1507
+}
dc1507
--- gcc/config/ia64/unwind-ia64.c.jj	2004-10-04 08:55:57.000000000 -0400
dc1507
+++ gcc/config/ia64/unwind-ia64.c	2004-11-15 09:07:45.000000000 -0500
dc1507
@@ -51,6 +51,51 @@
dc1507
 #define UNW_FLAG_UHANDLER(x)	((x) & 0x0000000200000000L)
dc1507
 #define UNW_LENGTH(x)		((x) & 0x00000000ffffffffL)
dc1507
 
dc1507
+#if defined (USE_SYMVER_GLOBAL) && defined (SHARED)
dc1507
+extern _Unwind_Reason_Code __symverglobal_Unwind_Backtrace
dc1507
+  (_Unwind_Trace_Fn, void *);
dc1507
+extern void __symverglobal_Unwind_DeleteException
dc1507
+  (struct _Unwind_Exception *);
dc1507
+extern void * __symverglobal_Unwind_FindEnclosingFunction (void *);
dc1507
+extern _Unwind_Reason_Code __symverglobal_Unwind_ForcedUnwind
dc1507
+  (struct _Unwind_Exception *, _Unwind_Stop_Fn, void *);
dc1507
+extern _Unwind_Word __symverglobal_Unwind_GetCFA
dc1507
+  (struct _Unwind_Context *);
dc1507
+extern _Unwind_Word __symverglobal_Unwind_GetBSP
dc1507
+  (struct _Unwind_Context *);
dc1507
+extern _Unwind_Word __symverglobal_Unwind_GetGR
dc1507
+  (struct _Unwind_Context *, int );
dc1507
+extern _Unwind_Ptr __symverglobal_Unwind_GetIP (struct _Unwind_Context *);
dc1507
+extern void *__symverglobal_Unwind_GetLanguageSpecificData
dc1507
+  (struct _Unwind_Context *);
dc1507
+extern _Unwind_Ptr __symverglobal_Unwind_GetRegionStart
dc1507
+  (struct _Unwind_Context *);
dc1507
+extern _Unwind_Reason_Code __symverglobal_Unwind_RaiseException
dc1507
+  (struct _Unwind_Exception *);
dc1507
+extern void __symverglobal_Unwind_Resume (struct _Unwind_Exception *);
dc1507
+extern _Unwind_Reason_Code __symverglobal_Unwind_Resume_or_Rethrow
dc1507
+   (struct _Unwind_Exception *);
dc1507
+extern void __symverglobal_Unwind_SetGR
dc1507
+  (struct _Unwind_Context *, int, _Unwind_Word);
dc1507
+extern void __symverglobal_Unwind_SetIP
dc1507
+  (struct _Unwind_Context *, _Unwind_Ptr);
dc1507
+#define _Unwind_Backtrace __symverglobal_Unwind_Backtrace
dc1507
+#define _Unwind_DeleteException __symverglobal_Unwind_DeleteException
dc1507
+#define _Unwind_FindEnclosingFunction __symverglobal_Unwind_FindEnclosingFunction
dc1507
+#define _Unwind_ForcedUnwind __symverglobal_Unwind_ForcedUnwind
dc1507
+#define _Unwind_GetBSP __symverglobal_Unwind_GetBSP
dc1507
+#define _Unwind_GetCFA __symverglobal_Unwind_GetCFA
dc1507
+#define _Unwind_GetGR __symverglobal_Unwind_GetGR
dc1507
+#define _Unwind_GetIP __symverglobal_Unwind_GetIP
dc1507
+#define _Unwind_GetLanguageSpecificData __symverglobal_Unwind_GetLanguageSpecificData
dc1507
+#define _Unwind_GetRegionStart __symverglobal_Unwind_GetRegionStart
dc1507
+#define _Unwind_RaiseException __symverglobal_Unwind_RaiseException
dc1507
+#define _Unwind_Resume __symverglobal_Unwind_Resume
dc1507
+#define _Unwind_Resume_or_Rethrow __symverglobal_Unwind_Resume_or_Rethrow
dc1507
+#define _Unwind_SetGR __symverglobal_Unwind_SetGR
dc1507
+#define _Unwind_SetIP __symverglobal_Unwind_SetIP
dc1507
+#endif
dc1507
+
dc1507
 enum unw_application_register
dc1507
 {
dc1507
   UNW_AR_BSP,
dc1507
@@ -2402,4 +2447,44 @@ alias (_Unwind_SetGR);
dc1507
 alias (_Unwind_SetIP);
dc1507
 #endif
dc1507
 
dc1507
+#if defined (USE_SYMVER_GLOBAL) && defined (SHARED)
dc1507
+#undef alias
dc1507
+#define symverglobal(name, version) \
dc1507
+__typeof (__symverglobal##name) __symverlocal##name		\
dc1507
+  __attribute__ ((alias ("__symverglobal" #name)));		\
dc1507
+__asm__ (".symver __symverglobal" #name"," #name "@@GCC_3.4.2");\
dc1507
+__asm__ (".symver __symverlocal" #name"," #name "@" #version)
dc1507
+
dc1507
+#undef _Unwind_Backtrace
dc1507
+#undef _Unwind_DeleteException
dc1507
+#undef _Unwind_FindEnclosingFunction
dc1507
+#undef _Unwind_ForcedUnwind
dc1507
+#undef _Unwind_GetBSP
dc1507
+#undef _Unwind_GetCFA
dc1507
+#undef _Unwind_GetGR
dc1507
+#undef _Unwind_GetIP
dc1507
+#undef _Unwind_GetLanguageSpecificData
dc1507
+#undef _Unwind_GetRegionStart
dc1507
+#undef _Unwind_RaiseException
dc1507
+#undef _Unwind_Resume
dc1507
+#undef _Unwind_Resume_or_Rethrow
dc1507
+#undef _Unwind_SetGR
dc1507
+#undef _Unwind_SetIP
dc1507
+symverglobal (_Unwind_Backtrace, GCC_3.3);
dc1507
+symverglobal (_Unwind_DeleteException, GCC_3.0);
dc1507
+symverglobal (_Unwind_FindEnclosingFunction, GCC_3.3);
dc1507
+symverglobal (_Unwind_ForcedUnwind, GCC_3.0);
dc1507
+symverglobal (_Unwind_GetBSP, GCC_3.3.2);
dc1507
+symverglobal (_Unwind_GetCFA, GCC_3.3);
dc1507
+symverglobal (_Unwind_GetGR, GCC_3.0);
dc1507
+symverglobal (_Unwind_GetIP, GCC_3.0);
dc1507
+symverglobal (_Unwind_GetLanguageSpecificData, GCC_3.0);
dc1507
+symverglobal (_Unwind_GetRegionStart, GCC_3.0);
dc1507
+symverglobal (_Unwind_RaiseException, GCC_3.0);
dc1507
+symverglobal (_Unwind_Resume, GCC_3.0);
dc1507
+symverglobal (_Unwind_Resume_or_Rethrow, GCC_3.3);
dc1507
+symverglobal (_Unwind_SetGR, GCC_3.0);
dc1507
+symverglobal (_Unwind_SetIP, GCC_3.0);
dc1507
+#endif
dc1507
+
dc1507
 #endif
dc1507
--- gcc/config/ia64/mkmap-symver-multi.awk.jj	2004-02-18 10:27:36.000000000 -0500
dc1507
+++ gcc/config/ia64/mkmap-symver-multi.awk	2004-11-15 09:46:50.000000000 -0500
dc1507
@@ -0,0 +1,133 @@
dc1507
+# Generate an ELF symbol version map a-la Solaris and GNU ld.
dc1507
+#	Contributed by Richard Henderson <rth@cygnus.com>
dc1507
+#
dc1507
+# This file is part of GCC.
dc1507
+#
dc1507
+# GCC is free software; you can redistribute it and/or modify it under
dc1507
+# the terms of the GNU General Public License as published by the Free
dc1507
+# Software Foundation; either version 2, or (at your option) any later
dc1507
+# version.
dc1507
+#
dc1507
+# GCC is distributed in the hope that it will be useful, but WITHOUT
dc1507
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
dc1507
+# or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
dc1507
+# License for more details.
dc1507
+#
dc1507
+# You should have received a copy of the GNU General Public License
dc1507
+# along with GCC; see the file COPYING.  If not, write to the Free
dc1507
+# Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
dc1507
+# 02110-1301, USA.
dc1507
+
dc1507
+BEGIN {
dc1507
+  state = "nm";
dc1507
+  sawsymbol = 0;
dc1507
+}
dc1507
+
dc1507
+# Remove comment and blank lines.
dc1507
+/^ *#/ || /^ *$/ {
dc1507
+  next;
dc1507
+}
dc1507
+
dc1507
+# We begin with nm input.  Collect the set of symbols that are present
dc1507
+# so that we can not emit them into the final version script -- Solaris
dc1507
+# complains at us if we do.
dc1507
+
dc1507
+state == "nm" && /^%%/ {
dc1507
+  state = "ver";
dc1507
+  next;
dc1507
+}
dc1507
+
dc1507
+state == "nm" && ($1 == "U" || $2 == "U") {
dc1507
+  next;
dc1507
+}
dc1507
+
dc1507
+state == "nm" && NF == 3 {
dc1507
+  if ($3 ~ /^[^@]*@GCC_[0-9.]*$/) {
dc1507
+    def[$3] = 1
dc1507
+    tl=$3
dc1507
+    sub(/^.*@/,"",tl)
dc1507
+    ver[$3] = tl
dc1507
+  } else {
dc1507
+    sub(/@@?GCC_[0-9.]*$/,"",$3)
dc1507
+    def[$3] = 1;
dc1507
+  }
dc1507
+  sawsymbol = 1;
dc1507
+  next;
dc1507
+}
dc1507
+
dc1507
+state == "nm" {
dc1507
+  next;
dc1507
+}
dc1507
+
dc1507
+# Now we process a simplified variant of the Solaris symbol version
dc1507
+# script.  We have one symbol per line, no semicolons, simple markers
dc1507
+# for beginning and ending each section, and %inherit markers for
dc1507
+# describing version inheritence.  A symbol may appear in more than
dc1507
+# one symbol version, and the last seen takes effect.
dc1507
+
dc1507
+NF == 3 && $1 == "%inherit" {
dc1507
+  inherit[$2] = $3;
dc1507
+  next;
dc1507
+}
dc1507
+
dc1507
+NF == 2 && $2 == "{" {
dc1507
+  libs[$1] = 1;
dc1507
+  thislib = $1;
dc1507
+  next;
dc1507
+}
dc1507
+
dc1507
+$1 == "}" {
dc1507
+  thislib = "";
dc1507
+  next;
dc1507
+}
dc1507
+
dc1507
+{
dc1507
+  ver[$1] = thislib;
dc1507
+  next;
dc1507
+}
dc1507
+
dc1507
+END {
dc1507
+  if (!sawsymbol)
dc1507
+    {
dc1507
+      print "No symbols seen -- broken or mis-installed nm?" | "cat 1>&2;;
dc1507
+      exit 1;
dc1507
+    }
dc1507
+  for (l in libs)
dc1507
+    output(l);
dc1507
+}
dc1507
+
dc1507
+function output(lib) {
dc1507
+  if (done[lib])
dc1507
+    return;
dc1507
+  done[lib] = 1;
dc1507
+  if (inherit[lib])
dc1507
+    output(inherit[lib]);
dc1507
+
dc1507
+  empty=1
dc1507
+  for (sym in ver)
dc1507
+    if ((ver[sym] == lib) && (sym in def))
dc1507
+      {
dc1507
+	if (empty)
dc1507
+	  {
dc1507
+	    printf("%s {\n", lib);
dc1507
+	    printf("  global:\n");
dc1507
+	    empty = 0;
dc1507
+	  }
dc1507
+	symp = sym;
dc1507
+	sub(/@GCC_[0-9.]*$/,"",symp);
dc1507
+	printf("\t%s;\n", symp);
dc1507
+	if (dotsyms)
dc1507
+	  printf("\t.%s;\n", symp);
dc1507
+      }
dc1507
+
dc1507
+  if (empty)
dc1507
+    {
dc1507
+      for (l in libs)
dc1507
+	if (inherit[l] == lib)
dc1507
+	  inherit[l] = inherit[lib];
dc1507
+    }
dc1507
+  else if (inherit[lib])
dc1507
+    printf("} %s;\n", inherit[lib]);
dc1507
+  else
dc1507
+    printf ("\n  local:\n\t*;\n};\n");
dc1507
+}
dc1507
--- gcc/config/ia64/libgcc-ia64-no-libunwind.ver.jj	2004-02-18 10:27:36.000000000 -0500
dc1507
+++ gcc/config/ia64/libgcc-ia64-no-libunwind.ver	2004-11-15 09:19:56.000000000 -0500
dc1507
@@ -0,0 +1,17 @@
dc1507
+GCC_3.4.2 {
dc1507
+  _Unwind_GetGR
dc1507
+  _Unwind_RaiseException
dc1507
+  _Unwind_GetRegionStart
dc1507
+  _Unwind_SetIP
dc1507
+  _Unwind_GetIP
dc1507
+  _Unwind_GetLanguageSpecificData
dc1507
+  _Unwind_Resume
dc1507
+  _Unwind_DeleteException
dc1507
+  _Unwind_SetGR
dc1507
+  _Unwind_ForcedUnwind
dc1507
+  _Unwind_Backtrace
dc1507
+  _Unwind_FindEnclosingFunction
dc1507
+  _Unwind_GetCFA
dc1507
+  _Unwind_Resume_or_Rethrow
dc1507
+  _Unwind_GetBSP
dc1507
+}