Blame SOURCES/gcc44-ia64-libunwind.patch

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