This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
PATCH: PR ld/5303: splay-tree doesn't support 64bit value on 32bit host
- From: "H.J. Lu" <hjl at lucon dot org>
- To: binutils at sources dot redhat dot com
- Date: Tue, 13 Nov 2007 09:18:45 -0800
- Subject: 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.
H.J.
---
2007-11-13 H.J. Lu <hongjiu.lu@intel.com>
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);