From: "H.J. Lu" <hjl@lucon.org>
To: gcc-patches@gcc.gnu.org
Cc: binutils@sources.redhat.com
Subject: RFC: PR ld/5303: splay-tree doesn't support 64bit value
Date: Fri, 09 Nov 2007 20:58:00 -0000 [thread overview]
Message-ID: <20071109205830.GA14371@lucon.org> (raw)
splay-tree is supposed to support any scalar:
#ifndef _WIN64
typedef unsigned long int libi_uhostptr_t;
typedef long int libi_shostptr_t;
#else
typedef unsigned long long libi_uhostptr_t;
typedef long long libi_shostptr_t;
#endif
...
/* 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;
But it isn't true since it doesn't support long long and arange-set.c
in bfd may use splay_tree on bfd_vma, which may be long long.
I don't know what is the best way to fix it. This patch works for me.
H.J.
--
bfd/
2007-11-09 H.J. Lu <hongjiu.lu@intel.com>
PR ld/5303
* arange-set.c (arange_set_delete_value_container): Add cast
for unsigned long.
(arange_set_node_high): Likewise.
(arange_set_node_set_high): Likewise.
(arange_set_node_value): Likewise.
(arange_set_node_set_value): Likewise.
(arange_set_splay_tree_insert): Likewise.
include/
2007-11-09 H.J. Lu <hongjiu.lu@intel.com>
PR ld/5303
* splay-tree.h (libi_uhostptr_t): Always defined as unsigned
long long.
(libi_shostptr_t): Always defined as long long.
--- binutils/bfd/arange-set.c.vma 2007-09-26 06:27:07.000000000 -0700
+++ binutils/bfd/arange-set.c 2007-11-09 12:30:56.000000000 -0800
@@ -142,7 +142,7 @@ arange_set_delete_value_container (splay
{
arange_value_container_t *container;
- container = (arange_value_container_t*) value;
+ container = (arange_value_container_t*) (unsigned long) value;
arange_set_delete_value (container->set, container->value);
arange_set_deallocate (container->set, container);
}
@@ -255,7 +255,7 @@ arange_set_node_high (arange_set set, sp
if (set->value_p)
{
- container = (arange_value_container_t*) node->value;
+ container = (arange_value_container_t*) (unsigned long) node->value;
return container->high;
}
@@ -271,7 +271,7 @@ arange_set_node_set_high (arange_set set
if (set->value_p)
{
- container = (arange_value_container_t*) node->value;
+ container = (arange_value_container_t*) (unsigned long) node->value;
container->high = address;
}
else
@@ -296,7 +296,7 @@ arange_set_node_value (arange_set set, s
if (set->value_p)
{
- container = (arange_value_container_t*) node->value;
+ container = (arange_value_container_t*) (unsigned long) node->value;
return container->value;
}
@@ -315,7 +315,7 @@ arange_set_node_set_value (arange_set se
if (set->value_p)
{
- container = (arange_value_container_t*) node->value;
+ container = (arange_value_container_t*) (unsigned long) node->value;
container->value = value;
}
}
@@ -445,7 +445,7 @@ arange_set_splay_tree_insert (arange_set
container->set = set;
container->value = value;
- sp_value = (splay_tree_value) container;
+ sp_value = (splay_tree_value) (unsigned long) container;
}
else
sp_value = (splay_tree_value) high;
--- binutils/include/splay-tree.h.vma 2007-07-27 11:51:13.000000000 -0700
+++ binutils/include/splay-tree.h 2007-11-09 12:26:55.000000000 -0800
@@ -36,13 +36,8 @@ extern "C" {
#include "ansidecl.h"
-#ifndef _WIN64
- typedef unsigned long int libi_uhostptr_t;
- typedef long int libi_shostptr_t;
-#else
- typedef unsigned long long libi_uhostptr_t;
- typedef long long libi_shostptr_t;
-#endif
+typedef unsigned long long libi_uhostptr_t;
+typedef long long libi_shostptr_t;
#ifndef GTY
#define GTY(X)
reply other threads:[~2007-11-09 20:58 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20071109205830.GA14371@lucon.org \
--to=hjl@lucon.org \
--cc=binutils@sources.redhat.com \
--cc=gcc-patches@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).