This is the mail archive of the mailing list for the binutils project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

PATCH: PR ld/5303: splay-tree doesn't support 64bit value on 32bit host

Current linker is broken on 32bit host with 64bit BFD. The problem
is splay-tree doesn't support 64bit value on bit host, but arange-set.c
uses splay-tree on bfd_vma. Fixing it isn't easy since splay-tree is
also used in gcc. We can't use #ifdef in splay-tree.h in gcc due
to lack of #ifdef in gengtype in gcc. This patch will abort the
linker if it detects such situation.

2007-11-13  H.J. Lu  <>

	PR ld/5303
	* arange-set.c (arange_set_new): Abort if size of bfd_vma >
	size of splay_tree types.

--- bfd/arange-set.c.vma	2007-09-21 09:16:17.000000000 -0700
+++ bfd/arange-set.c	2007-11-13 09:11:23.000000000 -0800
@@ -194,6 +194,14 @@ arange_set_new (arange_set_allocate_fn a
   splay_tree sp;
   splay_tree_delete_value_fn fn;
+  if (sizeof (bfd_vma) > sizeof (splay_tree_key)
+      || sizeof (bfd_vma) > sizeof (splay_tree_value))
+    {
+      (*_bfd_error_handler)
+	(_("size of bfd_vma > size of splay_tree types"));
+      abort ();
+    }
   /* Allocate space for arange structure.  */
   set = (arange_set)
     (*allocate_fn) (sizeof (struct arange_set_s), data);

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]