Bug 5303 - splay-tree doesn't support 64bit value on 32bit host
Summary: splay-tree doesn't support 64bit value on 32bit host
Alias: None
Product: binutils
Classification: Unclassified
Component: ld (show other bugs)
Version: 2.19
: P1 critical
Target Milestone: ---
Assignee: unassigned
Depends on:
Blocks: 5755
  Show dependency treegraph
Reported: 2007-11-09 20:26 UTC by H.J. Lu
Modified: 2008-02-17 15:11 UTC (History)
1 user (show)

See Also:
Last reconfirmed:

This patch works for me. (747 bytes, patch)
2007-11-09 20:54 UTC, H.J. Lu
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description H.J. Lu 2007-11-09 20:26:06 UTC
There are

#ifndef _WIN64
  typedef unsigned long int libi_uhostptr_t;
  typedef long int libi_shostptr_t;
  typedef unsigned long long libi_uhostptr_t;
  typedef long long libi_shostptr_t;


/* Use typedefs for the key and data types to facilitate changing
   these types, if necessary.  These types should be sufficiently wide
   that any pointer or scalar can be cast to these types, and then
   cast back, without loss of precision.  */
typedef libi_uhostptr_t splay_tree_key;
typedef libi_uhostptr_t splay_tree_value;

However, arange-set.c in BFD uses splay-tree on bfd_vma:

/* Get the low VMA address of a node.  */

static bfd_vma
arange_set_node_low (splay_tree_node node)
  return (bfd_vma) node->key;

It doesn't work on 32bit host with 64bit VMA.
Comment 1 H.J. Lu 2007-11-09 20:54:24 UTC
Created attachment 2083 [details]
This patch works for me.
Comment 2 H.J. Lu 2007-11-10 00:01:37 UTC
One way to fix it is to provide both long and long long interfaces for
splay-tree with the old interface as default. Applications can choose which
one to use. We can skip the long long one if compiler doesn't support
long long.
Comment 3 H.J. Lu 2007-11-13 17:19:19 UTC
A patch is posted at

Comment 5 H.J. Lu 2008-02-09 16:22:40 UTC
A patch is posted at

Comment 6 Alan Modra 2008-02-12 00:34:25 UTC
As of
BFD no longer uses splay-tree.c, so this is no longer a ld bug.