1999-06-03 01:22:50 +02:00
|
|
|
|
/* hash.c -- gas hash table code
|
2001-03-09 00:24:26 +01:00
|
|
|
|
Copyright 1987, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999,
|
2007-07-03 13:01:12 +02:00
|
|
|
|
2000, 2001, 2002, 2003, 2005, 2007
|
1999-05-03 09:29:11 +02:00
|
|
|
|
Free Software Foundation, Inc.
|
|
|
|
|
|
|
|
|
|
This file is part of GAS, the GNU Assembler.
|
|
|
|
|
|
|
|
|
|
GAS is free software; you can redistribute it and/or modify
|
|
|
|
|
it under the terms of the GNU General Public License as published by
|
2007-07-03 13:01:12 +02:00
|
|
|
|
the Free Software Foundation; either version 3, or (at your option)
|
1999-05-03 09:29:11 +02:00
|
|
|
|
any later version.
|
|
|
|
|
|
|
|
|
|
GAS is distributed in the hope that it will be useful,
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
1999-06-03 01:22:50 +02:00
|
|
|
|
along with GAS; see the file COPYING. If not, write to the Free
|
2005-05-05 11:13:19 +02:00
|
|
|
|
Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
|
|
|
|
|
02110-1301, USA. */
|
1999-06-03 01:22:50 +02:00
|
|
|
|
|
|
|
|
|
/* This version of the hash table code is a wholescale replacement of
|
|
|
|
|
the old hash table code, which was fairly bad. This is based on
|
|
|
|
|
the hash table code in BFD, but optimized slightly for the
|
2003-11-23 03:14:21 +01:00
|
|
|
|
assembler. The assembler does not need to derive structures that
|
1999-06-03 01:22:50 +02:00
|
|
|
|
are stored in the hash table. Instead, it always stores a pointer.
|
|
|
|
|
The assembler uses the hash table mostly to store symbols, and we
|
|
|
|
|
don't need to confuse the symbol structure with a hash table
|
|
|
|
|
structure. */
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
|
|
|
|
#include "as.h"
|
2001-09-19 07:33:36 +02:00
|
|
|
|
#include "safe-ctype.h"
|
1999-06-03 01:22:50 +02:00
|
|
|
|
#include "obstack.h"
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
1999-06-03 01:22:50 +02:00
|
|
|
|
/* An entry in a hash table. */
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
2000-10-30 22:59:01 +01:00
|
|
|
|
struct hash_entry {
|
1999-06-03 01:22:50 +02:00
|
|
|
|
/* Next entry for this hash code. */
|
|
|
|
|
struct hash_entry *next;
|
|
|
|
|
/* String being hashed. */
|
|
|
|
|
const char *string;
|
|
|
|
|
/* Hash code. This is the full hash code, not the index into the
|
|
|
|
|
table. */
|
|
|
|
|
unsigned long hash;
|
|
|
|
|
/* Pointer being stored in the hash table. */
|
|
|
|
|
PTR data;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
};
|
|
|
|
|
|
1999-06-03 01:22:50 +02:00
|
|
|
|
/* A hash table. */
|
|
|
|
|
|
2000-10-30 22:59:01 +01:00
|
|
|
|
struct hash_control {
|
1999-06-03 01:22:50 +02:00
|
|
|
|
/* The hash array. */
|
|
|
|
|
struct hash_entry **table;
|
|
|
|
|
/* The number of slots in the hash table. */
|
|
|
|
|
unsigned int size;
|
|
|
|
|
/* An obstack for this hash table. */
|
|
|
|
|
struct obstack memory;
|
|
|
|
|
|
|
|
|
|
#ifdef HASH_STATISTICS
|
|
|
|
|
/* Statistics. */
|
|
|
|
|
unsigned long lookups;
|
|
|
|
|
unsigned long hash_compares;
|
|
|
|
|
unsigned long string_compares;
|
|
|
|
|
unsigned long insertions;
|
|
|
|
|
unsigned long replacements;
|
|
|
|
|
unsigned long deletions;
|
|
|
|
|
#endif /* HASH_STATISTICS */
|
1999-05-03 09:29:11 +02:00
|
|
|
|
};
|
1999-06-03 01:22:50 +02:00
|
|
|
|
|
2005-04-12 10:42:41 +02:00
|
|
|
|
/* The default number of entries to use when creating a hash table.
|
|
|
|
|
Note this value can be reduced to 4051 by using the command line
|
|
|
|
|
switch --reduce-memory-overheads, or set to other values by using
|
|
|
|
|
the --hash-size=<NUMBER> switch. */
|
|
|
|
|
|
2005-04-14 11:00:35 +02:00
|
|
|
|
static unsigned long gas_hash_table_size = 65537;
|
2005-04-12 10:42:41 +02:00
|
|
|
|
|
|
|
|
|
void
|
2005-04-14 11:00:35 +02:00
|
|
|
|
set_gas_hash_table_size (unsigned long size)
|
2005-04-12 10:42:41 +02:00
|
|
|
|
{
|
|
|
|
|
gas_hash_table_size = size;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* FIXME: This function should be amalgmated with bfd/hash.c:bfd_hash_set_default_size(). */
|
2005-04-14 11:00:35 +02:00
|
|
|
|
static unsigned long
|
2005-04-12 10:42:41 +02:00
|
|
|
|
get_gas_hash_table_size (void)
|
|
|
|
|
{
|
|
|
|
|
/* Extend this prime list if you want more granularity of hash table size. */
|
2005-04-14 11:00:35 +02:00
|
|
|
|
static const unsigned long hash_size_primes[] =
|
2005-04-12 10:42:41 +02:00
|
|
|
|
{
|
|
|
|
|
1021, 4051, 8599, 16699, 65537
|
|
|
|
|
};
|
|
|
|
|
unsigned int index;
|
|
|
|
|
|
|
|
|
|
/* Work out the best prime number near the hash_size.
|
|
|
|
|
FIXME: This could be a more sophisticated algorithm,
|
|
|
|
|
but is it really worth implementing it ? */
|
|
|
|
|
for (index = 0; index < ARRAY_SIZE (hash_size_primes) - 1; ++index)
|
|
|
|
|
if (gas_hash_table_size <= hash_size_primes[index])
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
return hash_size_primes[index];
|
|
|
|
|
}
|
|
|
|
|
|
1999-06-03 01:22:50 +02:00
|
|
|
|
/* Create a hash table. This return a control block. */
|
|
|
|
|
|
1999-05-03 09:29:11 +02:00
|
|
|
|
struct hash_control *
|
2003-11-24 04:37:58 +01:00
|
|
|
|
hash_new (void)
|
1999-05-03 09:29:11 +02:00
|
|
|
|
{
|
2005-04-14 11:00:35 +02:00
|
|
|
|
unsigned long size;
|
|
|
|
|
unsigned long alloc;
|
1999-06-03 01:22:50 +02:00
|
|
|
|
struct hash_control *ret;
|
|
|
|
|
|
2005-04-12 10:42:41 +02:00
|
|
|
|
size = get_gas_hash_table_size ();
|
1999-06-03 01:22:50 +02:00
|
|
|
|
|
2005-04-12 10:42:41 +02:00
|
|
|
|
ret = xmalloc (sizeof *ret);
|
1999-06-03 01:22:50 +02:00
|
|
|
|
obstack_begin (&ret->memory, chunksize);
|
|
|
|
|
alloc = size * sizeof (struct hash_entry *);
|
2005-04-12 10:42:41 +02:00
|
|
|
|
ret->table = obstack_alloc (&ret->memory, alloc);
|
1999-06-03 01:22:50 +02:00
|
|
|
|
memset (ret->table, 0, alloc);
|
|
|
|
|
ret->size = size;
|
|
|
|
|
|
|
|
|
|
#ifdef HASH_STATISTICS
|
|
|
|
|
ret->lookups = 0;
|
|
|
|
|
ret->hash_compares = 0;
|
|
|
|
|
ret->string_compares = 0;
|
|
|
|
|
ret->insertions = 0;
|
|
|
|
|
ret->replacements = 0;
|
|
|
|
|
ret->deletions = 0;
|
|
|
|
|
#endif
|
|
|
|
|
|
2000-08-08 23:42:59 +02:00
|
|
|
|
return ret;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
}
|
|
|
|
|
|
1999-06-03 01:22:50 +02:00
|
|
|
|
/* Delete a hash table, freeing all allocated memory. */
|
|
|
|
|
|
1999-05-03 09:29:11 +02:00
|
|
|
|
void
|
2003-11-24 04:37:58 +01:00
|
|
|
|
hash_die (struct hash_control *table)
|
1999-05-03 09:29:11 +02:00
|
|
|
|
{
|
1999-06-03 01:22:50 +02:00
|
|
|
|
obstack_free (&table->memory, 0);
|
|
|
|
|
free (table);
|
1999-05-03 09:29:11 +02:00
|
|
|
|
}
|
1999-06-03 01:22:50 +02:00
|
|
|
|
|
|
|
|
|
/* Look up a string in a hash table. This returns a pointer to the
|
|
|
|
|
hash_entry, or NULL if the string is not in the table. If PLIST is
|
|
|
|
|
not NULL, this sets *PLIST to point to the start of the list which
|
|
|
|
|
would hold this hash entry. If PHASH is not NULL, this sets *PHASH
|
|
|
|
|
to the hash code for KEY.
|
|
|
|
|
|
|
|
|
|
Each time we look up a string, we move it to the start of the list
|
|
|
|
|
for its hash code, to take advantage of referential locality. */
|
|
|
|
|
|
|
|
|
|
static struct hash_entry *
|
include/elf:
* arm.h: Import complete list of official relocation names
and numbers from AAELF. Define FAKE_RELOCs for old names.
Remove a few old names no longer used anywhere.
bfd:
* elf32-arm.c: Wherever possible, use official reloc names
from AAELF.
(elf32_arm_howto_table, elf32_arm_tls_gd32_howto)
(elf32_arm_tls_ldo32_howto, elf32_arm_tls_ldm32_howto)
(elf32_arm_tls_le32_howto, elf32_arm_tls_ie32_howto)
(elf32_arm_vtinherit_howto, elf32_arm_vtentry_howto)
(elf32_arm_pc11_howto, elf32_arm_thm_pc9_howto, elf32_arm_got_prel)
(elf32_arm_r_howto): Replace with elf32_arm_howto_table_1,
elf32_arm_howto_table_2, and elf32_arm_howto_table_3.
Add many new relocations from AAELF.
(elf32_arm_howto_from_type): Update to match.
(elf32_arm_reloc_map): Add entries for R_ARM_THM_JUMP24,
R_ARM_THM_JUMP11, R_ARM_THM_JUMP19, R_ARM_THM_JUMP8,
R_ARM_THM_JUMP6, R_ARM_GNU_VTINHERIT, and R_ARM_GNU_VTENTRY.
(elf32_arm_reloc_type_lookup): Use elf32_arm_howto_from_type.
(elf32_arm_final_link_relocate): Add support for
R_ARM_THM_JUMP24, R_ARM_THM_JUMP19, R_ARM_THM_JUMP6. Remove
case entries redundant with default.
* reloc.c: Reorganize ARM relocations. Add Thumb
assembler-internal relocations BFD_RELOC_ARM_T32_OFFSET_U8,
BFD_RELOC_ARM_T32_OFFSET_IMM, BFD_RELOC_ARM_T32_IMMEDIATE.
Add visible relocations BFD_RELOC_THUMB_PCREL_BRANCH7,
BFD_RELOC_THUMB_BRANCH20, BFD_RELOC_THUMB_BRANCH25.
Delete unused relocations BFD_RELOC_ARM_GOT12, BFD_RELOC_ARM_COPY.
* bfd-in2.h, libbfd.h: Regenerate.
opcodes:
* arm-dis.c (thumb_opcodes): Add disassembly for V6T2 16-bit
instructions. Adjust disassembly of some opcodes to match
unified syntax.
(thumb32_opcodes): New table.
(print_insn_thumb): Rename print_insn_thumb16; don't handle
two-halfword branches here.
(print_insn_thumb32): New function.
(print_insn): Choose among print_insn_arm, print_insn_thumb16,
and print_insn_thumb32. Be consistent about order of
halfwords when printing 32-bit instructions.
gas:
* hash.c (hash_lookup): Add len parameter. All callers changed.
(hash_find_n): New interface.
* hash.h: Prototype hash_find_n.
* sb.c: Include as.h.
(scrub_from_sb, sb_to_scrub, scrub_position): New statics.
(sb_scrub_and_add_sb): New interface.
* sb.h: Prototype sb_scrub_and_add_sb.
* input-scrub.c (input_scrub_include_sb): Use sb_scrub_and_add_sb.
* config/tc-arm.h (TC_FORCE_RELOCATION_LOCAL): Remove
reference to BFD_RELOC_ARM_GOT12 which is never generated.
* config/tc-arm.c: Rewrite, adding Thumb-2 support.
gas/testsuite:
* gas/arm/arm.exp: Convert all existing "gas_test" tests to
"run_dump_test" tests. Run more tests unconditionally. Run new tests.
* gas/arm/arch4t.s, gas/arm/arch6zk.s, gas/arm/arm3.s, gas/arm/arm6.s
* gas/arm/arm7dm.s, gas/arm/bignum1.s, gas/arm/float.s
* gas/arm/immed.s, gas/arm/iwmmxt.s, gas/arm/offset.s, gas/arm/thumb.s:
Adjust to work as a dump test.
* gas/arm/arch4t.d, gas/arm/arch6zk.d, gas/arm/arm3.d, gas/arm/arm6.d
* gas/arm/arm7dm.d, gas/arm/bignum1.d, gas/arm/float.d
* gas/arm/immed.d, gas/arm/iwmmxt.d, gas/arm/offset.d, gas/arm/thumb.d:
New files.
* gas/arm/armv1-bad.l, gas/arm/armv1-bad.s: Remove tests for
diagnostics that don't happen in the first pass anymore.
* gas/arm/iwmmxt-bad.l, gas/arm/r15-bad.l, gas/arm/req.l
* gas/arm/vfp-bad.l:
Update expected diagnostics.
* gas/arm/pic.d: Update expected reloc name.
* gas/arm/thumbv6.d: CPY no longer appears in disassembly.
* gas/arm/r15-bad.s: Avoid two-argument mul.
* gas/arm/req.s: Adjust comments.
* gas/arm/maverick.d, gas/arm/maverick.s: Avoid inappropriate
use of PC.
* gas/arm/macro-1.d, gas/arm/macro1.s
* gas/arm/t16-bad.l, gas/arm/t16-bad.s
* gas/arm/tcompat.d, gas/arm/tcompat.s
* gas/arm/tcompat2.d, gas/arm/tcompat2.s
* gas/arm/thumb32.d, gas/arm/thumb32.s
New test pair.
ld/testsuite:
* ld-arm/mixed-app.d: Adjust expected disassembly a little.
2005-05-18 07:40:12 +02:00
|
|
|
|
hash_lookup (struct hash_control *table, const char *key, size_t len,
|
2003-11-24 04:37:58 +01:00
|
|
|
|
struct hash_entry ***plist, unsigned long *phash)
|
1999-05-03 09:29:11 +02:00
|
|
|
|
{
|
include/elf:
* arm.h: Import complete list of official relocation names
and numbers from AAELF. Define FAKE_RELOCs for old names.
Remove a few old names no longer used anywhere.
bfd:
* elf32-arm.c: Wherever possible, use official reloc names
from AAELF.
(elf32_arm_howto_table, elf32_arm_tls_gd32_howto)
(elf32_arm_tls_ldo32_howto, elf32_arm_tls_ldm32_howto)
(elf32_arm_tls_le32_howto, elf32_arm_tls_ie32_howto)
(elf32_arm_vtinherit_howto, elf32_arm_vtentry_howto)
(elf32_arm_pc11_howto, elf32_arm_thm_pc9_howto, elf32_arm_got_prel)
(elf32_arm_r_howto): Replace with elf32_arm_howto_table_1,
elf32_arm_howto_table_2, and elf32_arm_howto_table_3.
Add many new relocations from AAELF.
(elf32_arm_howto_from_type): Update to match.
(elf32_arm_reloc_map): Add entries for R_ARM_THM_JUMP24,
R_ARM_THM_JUMP11, R_ARM_THM_JUMP19, R_ARM_THM_JUMP8,
R_ARM_THM_JUMP6, R_ARM_GNU_VTINHERIT, and R_ARM_GNU_VTENTRY.
(elf32_arm_reloc_type_lookup): Use elf32_arm_howto_from_type.
(elf32_arm_final_link_relocate): Add support for
R_ARM_THM_JUMP24, R_ARM_THM_JUMP19, R_ARM_THM_JUMP6. Remove
case entries redundant with default.
* reloc.c: Reorganize ARM relocations. Add Thumb
assembler-internal relocations BFD_RELOC_ARM_T32_OFFSET_U8,
BFD_RELOC_ARM_T32_OFFSET_IMM, BFD_RELOC_ARM_T32_IMMEDIATE.
Add visible relocations BFD_RELOC_THUMB_PCREL_BRANCH7,
BFD_RELOC_THUMB_BRANCH20, BFD_RELOC_THUMB_BRANCH25.
Delete unused relocations BFD_RELOC_ARM_GOT12, BFD_RELOC_ARM_COPY.
* bfd-in2.h, libbfd.h: Regenerate.
opcodes:
* arm-dis.c (thumb_opcodes): Add disassembly for V6T2 16-bit
instructions. Adjust disassembly of some opcodes to match
unified syntax.
(thumb32_opcodes): New table.
(print_insn_thumb): Rename print_insn_thumb16; don't handle
two-halfword branches here.
(print_insn_thumb32): New function.
(print_insn): Choose among print_insn_arm, print_insn_thumb16,
and print_insn_thumb32. Be consistent about order of
halfwords when printing 32-bit instructions.
gas:
* hash.c (hash_lookup): Add len parameter. All callers changed.
(hash_find_n): New interface.
* hash.h: Prototype hash_find_n.
* sb.c: Include as.h.
(scrub_from_sb, sb_to_scrub, scrub_position): New statics.
(sb_scrub_and_add_sb): New interface.
* sb.h: Prototype sb_scrub_and_add_sb.
* input-scrub.c (input_scrub_include_sb): Use sb_scrub_and_add_sb.
* config/tc-arm.h (TC_FORCE_RELOCATION_LOCAL): Remove
reference to BFD_RELOC_ARM_GOT12 which is never generated.
* config/tc-arm.c: Rewrite, adding Thumb-2 support.
gas/testsuite:
* gas/arm/arm.exp: Convert all existing "gas_test" tests to
"run_dump_test" tests. Run more tests unconditionally. Run new tests.
* gas/arm/arch4t.s, gas/arm/arch6zk.s, gas/arm/arm3.s, gas/arm/arm6.s
* gas/arm/arm7dm.s, gas/arm/bignum1.s, gas/arm/float.s
* gas/arm/immed.s, gas/arm/iwmmxt.s, gas/arm/offset.s, gas/arm/thumb.s:
Adjust to work as a dump test.
* gas/arm/arch4t.d, gas/arm/arch6zk.d, gas/arm/arm3.d, gas/arm/arm6.d
* gas/arm/arm7dm.d, gas/arm/bignum1.d, gas/arm/float.d
* gas/arm/immed.d, gas/arm/iwmmxt.d, gas/arm/offset.d, gas/arm/thumb.d:
New files.
* gas/arm/armv1-bad.l, gas/arm/armv1-bad.s: Remove tests for
diagnostics that don't happen in the first pass anymore.
* gas/arm/iwmmxt-bad.l, gas/arm/r15-bad.l, gas/arm/req.l
* gas/arm/vfp-bad.l:
Update expected diagnostics.
* gas/arm/pic.d: Update expected reloc name.
* gas/arm/thumbv6.d: CPY no longer appears in disassembly.
* gas/arm/r15-bad.s: Avoid two-argument mul.
* gas/arm/req.s: Adjust comments.
* gas/arm/maverick.d, gas/arm/maverick.s: Avoid inappropriate
use of PC.
* gas/arm/macro-1.d, gas/arm/macro1.s
* gas/arm/t16-bad.l, gas/arm/t16-bad.s
* gas/arm/tcompat.d, gas/arm/tcompat.s
* gas/arm/tcompat2.d, gas/arm/tcompat2.s
* gas/arm/thumb32.d, gas/arm/thumb32.s
New test pair.
ld/testsuite:
* ld-arm/mixed-app.d: Adjust expected disassembly a little.
2005-05-18 07:40:12 +02:00
|
|
|
|
unsigned long hash;
|
|
|
|
|
size_t n;
|
|
|
|
|
unsigned int c;
|
1999-06-03 01:22:50 +02:00
|
|
|
|
unsigned int index;
|
|
|
|
|
struct hash_entry **list;
|
|
|
|
|
struct hash_entry *p;
|
|
|
|
|
struct hash_entry *prev;
|
|
|
|
|
|
|
|
|
|
#ifdef HASH_STATISTICS
|
|
|
|
|
++table->lookups;
|
|
|
|
|
#endif
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
1999-06-03 01:22:50 +02:00
|
|
|
|
hash = 0;
|
include/elf:
* arm.h: Import complete list of official relocation names
and numbers from AAELF. Define FAKE_RELOCs for old names.
Remove a few old names no longer used anywhere.
bfd:
* elf32-arm.c: Wherever possible, use official reloc names
from AAELF.
(elf32_arm_howto_table, elf32_arm_tls_gd32_howto)
(elf32_arm_tls_ldo32_howto, elf32_arm_tls_ldm32_howto)
(elf32_arm_tls_le32_howto, elf32_arm_tls_ie32_howto)
(elf32_arm_vtinherit_howto, elf32_arm_vtentry_howto)
(elf32_arm_pc11_howto, elf32_arm_thm_pc9_howto, elf32_arm_got_prel)
(elf32_arm_r_howto): Replace with elf32_arm_howto_table_1,
elf32_arm_howto_table_2, and elf32_arm_howto_table_3.
Add many new relocations from AAELF.
(elf32_arm_howto_from_type): Update to match.
(elf32_arm_reloc_map): Add entries for R_ARM_THM_JUMP24,
R_ARM_THM_JUMP11, R_ARM_THM_JUMP19, R_ARM_THM_JUMP8,
R_ARM_THM_JUMP6, R_ARM_GNU_VTINHERIT, and R_ARM_GNU_VTENTRY.
(elf32_arm_reloc_type_lookup): Use elf32_arm_howto_from_type.
(elf32_arm_final_link_relocate): Add support for
R_ARM_THM_JUMP24, R_ARM_THM_JUMP19, R_ARM_THM_JUMP6. Remove
case entries redundant with default.
* reloc.c: Reorganize ARM relocations. Add Thumb
assembler-internal relocations BFD_RELOC_ARM_T32_OFFSET_U8,
BFD_RELOC_ARM_T32_OFFSET_IMM, BFD_RELOC_ARM_T32_IMMEDIATE.
Add visible relocations BFD_RELOC_THUMB_PCREL_BRANCH7,
BFD_RELOC_THUMB_BRANCH20, BFD_RELOC_THUMB_BRANCH25.
Delete unused relocations BFD_RELOC_ARM_GOT12, BFD_RELOC_ARM_COPY.
* bfd-in2.h, libbfd.h: Regenerate.
opcodes:
* arm-dis.c (thumb_opcodes): Add disassembly for V6T2 16-bit
instructions. Adjust disassembly of some opcodes to match
unified syntax.
(thumb32_opcodes): New table.
(print_insn_thumb): Rename print_insn_thumb16; don't handle
two-halfword branches here.
(print_insn_thumb32): New function.
(print_insn): Choose among print_insn_arm, print_insn_thumb16,
and print_insn_thumb32. Be consistent about order of
halfwords when printing 32-bit instructions.
gas:
* hash.c (hash_lookup): Add len parameter. All callers changed.
(hash_find_n): New interface.
* hash.h: Prototype hash_find_n.
* sb.c: Include as.h.
(scrub_from_sb, sb_to_scrub, scrub_position): New statics.
(sb_scrub_and_add_sb): New interface.
* sb.h: Prototype sb_scrub_and_add_sb.
* input-scrub.c (input_scrub_include_sb): Use sb_scrub_and_add_sb.
* config/tc-arm.h (TC_FORCE_RELOCATION_LOCAL): Remove
reference to BFD_RELOC_ARM_GOT12 which is never generated.
* config/tc-arm.c: Rewrite, adding Thumb-2 support.
gas/testsuite:
* gas/arm/arm.exp: Convert all existing "gas_test" tests to
"run_dump_test" tests. Run more tests unconditionally. Run new tests.
* gas/arm/arch4t.s, gas/arm/arch6zk.s, gas/arm/arm3.s, gas/arm/arm6.s
* gas/arm/arm7dm.s, gas/arm/bignum1.s, gas/arm/float.s
* gas/arm/immed.s, gas/arm/iwmmxt.s, gas/arm/offset.s, gas/arm/thumb.s:
Adjust to work as a dump test.
* gas/arm/arch4t.d, gas/arm/arch6zk.d, gas/arm/arm3.d, gas/arm/arm6.d
* gas/arm/arm7dm.d, gas/arm/bignum1.d, gas/arm/float.d
* gas/arm/immed.d, gas/arm/iwmmxt.d, gas/arm/offset.d, gas/arm/thumb.d:
New files.
* gas/arm/armv1-bad.l, gas/arm/armv1-bad.s: Remove tests for
diagnostics that don't happen in the first pass anymore.
* gas/arm/iwmmxt-bad.l, gas/arm/r15-bad.l, gas/arm/req.l
* gas/arm/vfp-bad.l:
Update expected diagnostics.
* gas/arm/pic.d: Update expected reloc name.
* gas/arm/thumbv6.d: CPY no longer appears in disassembly.
* gas/arm/r15-bad.s: Avoid two-argument mul.
* gas/arm/req.s: Adjust comments.
* gas/arm/maverick.d, gas/arm/maverick.s: Avoid inappropriate
use of PC.
* gas/arm/macro-1.d, gas/arm/macro1.s
* gas/arm/t16-bad.l, gas/arm/t16-bad.s
* gas/arm/tcompat.d, gas/arm/tcompat.s
* gas/arm/tcompat2.d, gas/arm/tcompat2.s
* gas/arm/thumb32.d, gas/arm/thumb32.s
New test pair.
ld/testsuite:
* ld-arm/mixed-app.d: Adjust expected disassembly a little.
2005-05-18 07:40:12 +02:00
|
|
|
|
for (n = 0; n < len; n++)
|
1999-05-03 09:29:11 +02:00
|
|
|
|
{
|
include/elf:
* arm.h: Import complete list of official relocation names
and numbers from AAELF. Define FAKE_RELOCs for old names.
Remove a few old names no longer used anywhere.
bfd:
* elf32-arm.c: Wherever possible, use official reloc names
from AAELF.
(elf32_arm_howto_table, elf32_arm_tls_gd32_howto)
(elf32_arm_tls_ldo32_howto, elf32_arm_tls_ldm32_howto)
(elf32_arm_tls_le32_howto, elf32_arm_tls_ie32_howto)
(elf32_arm_vtinherit_howto, elf32_arm_vtentry_howto)
(elf32_arm_pc11_howto, elf32_arm_thm_pc9_howto, elf32_arm_got_prel)
(elf32_arm_r_howto): Replace with elf32_arm_howto_table_1,
elf32_arm_howto_table_2, and elf32_arm_howto_table_3.
Add many new relocations from AAELF.
(elf32_arm_howto_from_type): Update to match.
(elf32_arm_reloc_map): Add entries for R_ARM_THM_JUMP24,
R_ARM_THM_JUMP11, R_ARM_THM_JUMP19, R_ARM_THM_JUMP8,
R_ARM_THM_JUMP6, R_ARM_GNU_VTINHERIT, and R_ARM_GNU_VTENTRY.
(elf32_arm_reloc_type_lookup): Use elf32_arm_howto_from_type.
(elf32_arm_final_link_relocate): Add support for
R_ARM_THM_JUMP24, R_ARM_THM_JUMP19, R_ARM_THM_JUMP6. Remove
case entries redundant with default.
* reloc.c: Reorganize ARM relocations. Add Thumb
assembler-internal relocations BFD_RELOC_ARM_T32_OFFSET_U8,
BFD_RELOC_ARM_T32_OFFSET_IMM, BFD_RELOC_ARM_T32_IMMEDIATE.
Add visible relocations BFD_RELOC_THUMB_PCREL_BRANCH7,
BFD_RELOC_THUMB_BRANCH20, BFD_RELOC_THUMB_BRANCH25.
Delete unused relocations BFD_RELOC_ARM_GOT12, BFD_RELOC_ARM_COPY.
* bfd-in2.h, libbfd.h: Regenerate.
opcodes:
* arm-dis.c (thumb_opcodes): Add disassembly for V6T2 16-bit
instructions. Adjust disassembly of some opcodes to match
unified syntax.
(thumb32_opcodes): New table.
(print_insn_thumb): Rename print_insn_thumb16; don't handle
two-halfword branches here.
(print_insn_thumb32): New function.
(print_insn): Choose among print_insn_arm, print_insn_thumb16,
and print_insn_thumb32. Be consistent about order of
halfwords when printing 32-bit instructions.
gas:
* hash.c (hash_lookup): Add len parameter. All callers changed.
(hash_find_n): New interface.
* hash.h: Prototype hash_find_n.
* sb.c: Include as.h.
(scrub_from_sb, sb_to_scrub, scrub_position): New statics.
(sb_scrub_and_add_sb): New interface.
* sb.h: Prototype sb_scrub_and_add_sb.
* input-scrub.c (input_scrub_include_sb): Use sb_scrub_and_add_sb.
* config/tc-arm.h (TC_FORCE_RELOCATION_LOCAL): Remove
reference to BFD_RELOC_ARM_GOT12 which is never generated.
* config/tc-arm.c: Rewrite, adding Thumb-2 support.
gas/testsuite:
* gas/arm/arm.exp: Convert all existing "gas_test" tests to
"run_dump_test" tests. Run more tests unconditionally. Run new tests.
* gas/arm/arch4t.s, gas/arm/arch6zk.s, gas/arm/arm3.s, gas/arm/arm6.s
* gas/arm/arm7dm.s, gas/arm/bignum1.s, gas/arm/float.s
* gas/arm/immed.s, gas/arm/iwmmxt.s, gas/arm/offset.s, gas/arm/thumb.s:
Adjust to work as a dump test.
* gas/arm/arch4t.d, gas/arm/arch6zk.d, gas/arm/arm3.d, gas/arm/arm6.d
* gas/arm/arm7dm.d, gas/arm/bignum1.d, gas/arm/float.d
* gas/arm/immed.d, gas/arm/iwmmxt.d, gas/arm/offset.d, gas/arm/thumb.d:
New files.
* gas/arm/armv1-bad.l, gas/arm/armv1-bad.s: Remove tests for
diagnostics that don't happen in the first pass anymore.
* gas/arm/iwmmxt-bad.l, gas/arm/r15-bad.l, gas/arm/req.l
* gas/arm/vfp-bad.l:
Update expected diagnostics.
* gas/arm/pic.d: Update expected reloc name.
* gas/arm/thumbv6.d: CPY no longer appears in disassembly.
* gas/arm/r15-bad.s: Avoid two-argument mul.
* gas/arm/req.s: Adjust comments.
* gas/arm/maverick.d, gas/arm/maverick.s: Avoid inappropriate
use of PC.
* gas/arm/macro-1.d, gas/arm/macro1.s
* gas/arm/t16-bad.l, gas/arm/t16-bad.s
* gas/arm/tcompat.d, gas/arm/tcompat.s
* gas/arm/tcompat2.d, gas/arm/tcompat2.s
* gas/arm/thumb32.d, gas/arm/thumb32.s
New test pair.
ld/testsuite:
* ld-arm/mixed-app.d: Adjust expected disassembly a little.
2005-05-18 07:40:12 +02:00
|
|
|
|
c = key[n];
|
1999-06-03 01:22:50 +02:00
|
|
|
|
hash += c + (c << 17);
|
|
|
|
|
hash ^= hash >> 2;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
}
|
1999-06-03 01:22:50 +02:00
|
|
|
|
hash += len + (len << 17);
|
|
|
|
|
hash ^= hash >> 2;
|
|
|
|
|
|
|
|
|
|
if (phash != NULL)
|
|
|
|
|
*phash = hash;
|
|
|
|
|
|
|
|
|
|
index = hash % table->size;
|
|
|
|
|
list = table->table + index;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
1999-06-03 01:22:50 +02:00
|
|
|
|
if (plist != NULL)
|
|
|
|
|
*plist = list;
|
|
|
|
|
|
|
|
|
|
prev = NULL;
|
|
|
|
|
for (p = *list; p != NULL; p = p->next)
|
1999-05-03 09:29:11 +02:00
|
|
|
|
{
|
1999-06-03 01:22:50 +02:00
|
|
|
|
#ifdef HASH_STATISTICS
|
|
|
|
|
++table->hash_compares;
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
if (p->hash == hash)
|
1999-05-03 09:29:11 +02:00
|
|
|
|
{
|
1999-06-03 01:22:50 +02:00
|
|
|
|
#ifdef HASH_STATISTICS
|
|
|
|
|
++table->string_compares;
|
|
|
|
|
#endif
|
|
|
|
|
|
include/elf:
* arm.h: Import complete list of official relocation names
and numbers from AAELF. Define FAKE_RELOCs for old names.
Remove a few old names no longer used anywhere.
bfd:
* elf32-arm.c: Wherever possible, use official reloc names
from AAELF.
(elf32_arm_howto_table, elf32_arm_tls_gd32_howto)
(elf32_arm_tls_ldo32_howto, elf32_arm_tls_ldm32_howto)
(elf32_arm_tls_le32_howto, elf32_arm_tls_ie32_howto)
(elf32_arm_vtinherit_howto, elf32_arm_vtentry_howto)
(elf32_arm_pc11_howto, elf32_arm_thm_pc9_howto, elf32_arm_got_prel)
(elf32_arm_r_howto): Replace with elf32_arm_howto_table_1,
elf32_arm_howto_table_2, and elf32_arm_howto_table_3.
Add many new relocations from AAELF.
(elf32_arm_howto_from_type): Update to match.
(elf32_arm_reloc_map): Add entries for R_ARM_THM_JUMP24,
R_ARM_THM_JUMP11, R_ARM_THM_JUMP19, R_ARM_THM_JUMP8,
R_ARM_THM_JUMP6, R_ARM_GNU_VTINHERIT, and R_ARM_GNU_VTENTRY.
(elf32_arm_reloc_type_lookup): Use elf32_arm_howto_from_type.
(elf32_arm_final_link_relocate): Add support for
R_ARM_THM_JUMP24, R_ARM_THM_JUMP19, R_ARM_THM_JUMP6. Remove
case entries redundant with default.
* reloc.c: Reorganize ARM relocations. Add Thumb
assembler-internal relocations BFD_RELOC_ARM_T32_OFFSET_U8,
BFD_RELOC_ARM_T32_OFFSET_IMM, BFD_RELOC_ARM_T32_IMMEDIATE.
Add visible relocations BFD_RELOC_THUMB_PCREL_BRANCH7,
BFD_RELOC_THUMB_BRANCH20, BFD_RELOC_THUMB_BRANCH25.
Delete unused relocations BFD_RELOC_ARM_GOT12, BFD_RELOC_ARM_COPY.
* bfd-in2.h, libbfd.h: Regenerate.
opcodes:
* arm-dis.c (thumb_opcodes): Add disassembly for V6T2 16-bit
instructions. Adjust disassembly of some opcodes to match
unified syntax.
(thumb32_opcodes): New table.
(print_insn_thumb): Rename print_insn_thumb16; don't handle
two-halfword branches here.
(print_insn_thumb32): New function.
(print_insn): Choose among print_insn_arm, print_insn_thumb16,
and print_insn_thumb32. Be consistent about order of
halfwords when printing 32-bit instructions.
gas:
* hash.c (hash_lookup): Add len parameter. All callers changed.
(hash_find_n): New interface.
* hash.h: Prototype hash_find_n.
* sb.c: Include as.h.
(scrub_from_sb, sb_to_scrub, scrub_position): New statics.
(sb_scrub_and_add_sb): New interface.
* sb.h: Prototype sb_scrub_and_add_sb.
* input-scrub.c (input_scrub_include_sb): Use sb_scrub_and_add_sb.
* config/tc-arm.h (TC_FORCE_RELOCATION_LOCAL): Remove
reference to BFD_RELOC_ARM_GOT12 which is never generated.
* config/tc-arm.c: Rewrite, adding Thumb-2 support.
gas/testsuite:
* gas/arm/arm.exp: Convert all existing "gas_test" tests to
"run_dump_test" tests. Run more tests unconditionally. Run new tests.
* gas/arm/arch4t.s, gas/arm/arch6zk.s, gas/arm/arm3.s, gas/arm/arm6.s
* gas/arm/arm7dm.s, gas/arm/bignum1.s, gas/arm/float.s
* gas/arm/immed.s, gas/arm/iwmmxt.s, gas/arm/offset.s, gas/arm/thumb.s:
Adjust to work as a dump test.
* gas/arm/arch4t.d, gas/arm/arch6zk.d, gas/arm/arm3.d, gas/arm/arm6.d
* gas/arm/arm7dm.d, gas/arm/bignum1.d, gas/arm/float.d
* gas/arm/immed.d, gas/arm/iwmmxt.d, gas/arm/offset.d, gas/arm/thumb.d:
New files.
* gas/arm/armv1-bad.l, gas/arm/armv1-bad.s: Remove tests for
diagnostics that don't happen in the first pass anymore.
* gas/arm/iwmmxt-bad.l, gas/arm/r15-bad.l, gas/arm/req.l
* gas/arm/vfp-bad.l:
Update expected diagnostics.
* gas/arm/pic.d: Update expected reloc name.
* gas/arm/thumbv6.d: CPY no longer appears in disassembly.
* gas/arm/r15-bad.s: Avoid two-argument mul.
* gas/arm/req.s: Adjust comments.
* gas/arm/maverick.d, gas/arm/maverick.s: Avoid inappropriate
use of PC.
* gas/arm/macro-1.d, gas/arm/macro1.s
* gas/arm/t16-bad.l, gas/arm/t16-bad.s
* gas/arm/tcompat.d, gas/arm/tcompat.s
* gas/arm/tcompat2.d, gas/arm/tcompat2.s
* gas/arm/thumb32.d, gas/arm/thumb32.s
New test pair.
ld/testsuite:
* ld-arm/mixed-app.d: Adjust expected disassembly a little.
2005-05-18 07:40:12 +02:00
|
|
|
|
if (strncmp (p->string, key, len) == 0 && p->string[len] == '\0')
|
1999-06-03 01:22:50 +02:00
|
|
|
|
{
|
|
|
|
|
if (prev != NULL)
|
|
|
|
|
{
|
|
|
|
|
prev->next = p->next;
|
|
|
|
|
p->next = *list;
|
|
|
|
|
*list = p;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return p;
|
|
|
|
|
}
|
1999-05-03 09:29:11 +02:00
|
|
|
|
}
|
|
|
|
|
|
1999-06-03 01:22:50 +02:00
|
|
|
|
prev = p;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
}
|
1999-06-03 01:22:50 +02:00
|
|
|
|
|
|
|
|
|
return NULL;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
}
|
1999-06-03 01:22:50 +02:00
|
|
|
|
|
|
|
|
|
/* Insert an entry into a hash table. This returns NULL on success.
|
|
|
|
|
On error, it returns a printable string indicating the error. It
|
|
|
|
|
is considered to be an error if the entry already exists in the
|
|
|
|
|
hash table. */
|
|
|
|
|
|
|
|
|
|
const char *
|
2003-11-24 04:37:58 +01:00
|
|
|
|
hash_insert (struct hash_control *table, const char *key, PTR value)
|
1999-05-03 09:29:11 +02:00
|
|
|
|
{
|
1999-06-03 01:22:50 +02:00
|
|
|
|
struct hash_entry *p;
|
|
|
|
|
struct hash_entry **list;
|
|
|
|
|
unsigned long hash;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
include/elf:
* arm.h: Import complete list of official relocation names
and numbers from AAELF. Define FAKE_RELOCs for old names.
Remove a few old names no longer used anywhere.
bfd:
* elf32-arm.c: Wherever possible, use official reloc names
from AAELF.
(elf32_arm_howto_table, elf32_arm_tls_gd32_howto)
(elf32_arm_tls_ldo32_howto, elf32_arm_tls_ldm32_howto)
(elf32_arm_tls_le32_howto, elf32_arm_tls_ie32_howto)
(elf32_arm_vtinherit_howto, elf32_arm_vtentry_howto)
(elf32_arm_pc11_howto, elf32_arm_thm_pc9_howto, elf32_arm_got_prel)
(elf32_arm_r_howto): Replace with elf32_arm_howto_table_1,
elf32_arm_howto_table_2, and elf32_arm_howto_table_3.
Add many new relocations from AAELF.
(elf32_arm_howto_from_type): Update to match.
(elf32_arm_reloc_map): Add entries for R_ARM_THM_JUMP24,
R_ARM_THM_JUMP11, R_ARM_THM_JUMP19, R_ARM_THM_JUMP8,
R_ARM_THM_JUMP6, R_ARM_GNU_VTINHERIT, and R_ARM_GNU_VTENTRY.
(elf32_arm_reloc_type_lookup): Use elf32_arm_howto_from_type.
(elf32_arm_final_link_relocate): Add support for
R_ARM_THM_JUMP24, R_ARM_THM_JUMP19, R_ARM_THM_JUMP6. Remove
case entries redundant with default.
* reloc.c: Reorganize ARM relocations. Add Thumb
assembler-internal relocations BFD_RELOC_ARM_T32_OFFSET_U8,
BFD_RELOC_ARM_T32_OFFSET_IMM, BFD_RELOC_ARM_T32_IMMEDIATE.
Add visible relocations BFD_RELOC_THUMB_PCREL_BRANCH7,
BFD_RELOC_THUMB_BRANCH20, BFD_RELOC_THUMB_BRANCH25.
Delete unused relocations BFD_RELOC_ARM_GOT12, BFD_RELOC_ARM_COPY.
* bfd-in2.h, libbfd.h: Regenerate.
opcodes:
* arm-dis.c (thumb_opcodes): Add disassembly for V6T2 16-bit
instructions. Adjust disassembly of some opcodes to match
unified syntax.
(thumb32_opcodes): New table.
(print_insn_thumb): Rename print_insn_thumb16; don't handle
two-halfword branches here.
(print_insn_thumb32): New function.
(print_insn): Choose among print_insn_arm, print_insn_thumb16,
and print_insn_thumb32. Be consistent about order of
halfwords when printing 32-bit instructions.
gas:
* hash.c (hash_lookup): Add len parameter. All callers changed.
(hash_find_n): New interface.
* hash.h: Prototype hash_find_n.
* sb.c: Include as.h.
(scrub_from_sb, sb_to_scrub, scrub_position): New statics.
(sb_scrub_and_add_sb): New interface.
* sb.h: Prototype sb_scrub_and_add_sb.
* input-scrub.c (input_scrub_include_sb): Use sb_scrub_and_add_sb.
* config/tc-arm.h (TC_FORCE_RELOCATION_LOCAL): Remove
reference to BFD_RELOC_ARM_GOT12 which is never generated.
* config/tc-arm.c: Rewrite, adding Thumb-2 support.
gas/testsuite:
* gas/arm/arm.exp: Convert all existing "gas_test" tests to
"run_dump_test" tests. Run more tests unconditionally. Run new tests.
* gas/arm/arch4t.s, gas/arm/arch6zk.s, gas/arm/arm3.s, gas/arm/arm6.s
* gas/arm/arm7dm.s, gas/arm/bignum1.s, gas/arm/float.s
* gas/arm/immed.s, gas/arm/iwmmxt.s, gas/arm/offset.s, gas/arm/thumb.s:
Adjust to work as a dump test.
* gas/arm/arch4t.d, gas/arm/arch6zk.d, gas/arm/arm3.d, gas/arm/arm6.d
* gas/arm/arm7dm.d, gas/arm/bignum1.d, gas/arm/float.d
* gas/arm/immed.d, gas/arm/iwmmxt.d, gas/arm/offset.d, gas/arm/thumb.d:
New files.
* gas/arm/armv1-bad.l, gas/arm/armv1-bad.s: Remove tests for
diagnostics that don't happen in the first pass anymore.
* gas/arm/iwmmxt-bad.l, gas/arm/r15-bad.l, gas/arm/req.l
* gas/arm/vfp-bad.l:
Update expected diagnostics.
* gas/arm/pic.d: Update expected reloc name.
* gas/arm/thumbv6.d: CPY no longer appears in disassembly.
* gas/arm/r15-bad.s: Avoid two-argument mul.
* gas/arm/req.s: Adjust comments.
* gas/arm/maverick.d, gas/arm/maverick.s: Avoid inappropriate
use of PC.
* gas/arm/macro-1.d, gas/arm/macro1.s
* gas/arm/t16-bad.l, gas/arm/t16-bad.s
* gas/arm/tcompat.d, gas/arm/tcompat.s
* gas/arm/tcompat2.d, gas/arm/tcompat2.s
* gas/arm/thumb32.d, gas/arm/thumb32.s
New test pair.
ld/testsuite:
* ld-arm/mixed-app.d: Adjust expected disassembly a little.
2005-05-18 07:40:12 +02:00
|
|
|
|
p = hash_lookup (table, key, strlen (key), &list, &hash);
|
1999-06-03 01:22:50 +02:00
|
|
|
|
if (p != NULL)
|
|
|
|
|
return "exists";
|
|
|
|
|
|
|
|
|
|
#ifdef HASH_STATISTICS
|
|
|
|
|
++table->insertions;
|
|
|
|
|
#endif
|
|
|
|
|
|
2000-08-08 23:42:59 +02:00
|
|
|
|
p = (struct hash_entry *) obstack_alloc (&table->memory, sizeof (*p));
|
1999-06-03 01:22:50 +02:00
|
|
|
|
p->string = key;
|
|
|
|
|
p->hash = hash;
|
|
|
|
|
p->data = value;
|
|
|
|
|
|
|
|
|
|
p->next = *list;
|
|
|
|
|
*list = p;
|
|
|
|
|
|
|
|
|
|
return NULL;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
}
|
1999-06-03 01:22:50 +02:00
|
|
|
|
|
|
|
|
|
/* Insert or replace an entry in a hash table. This returns NULL on
|
|
|
|
|
success. On error, it returns a printable string indicating the
|
|
|
|
|
error. If an entry already exists, its value is replaced. */
|
|
|
|
|
|
1999-05-03 09:29:11 +02:00
|
|
|
|
const char *
|
2003-11-24 04:37:58 +01:00
|
|
|
|
hash_jam (struct hash_control *table, const char *key, PTR value)
|
1999-05-03 09:29:11 +02:00
|
|
|
|
{
|
1999-06-03 01:22:50 +02:00
|
|
|
|
struct hash_entry *p;
|
|
|
|
|
struct hash_entry **list;
|
|
|
|
|
unsigned long hash;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
include/elf:
* arm.h: Import complete list of official relocation names
and numbers from AAELF. Define FAKE_RELOCs for old names.
Remove a few old names no longer used anywhere.
bfd:
* elf32-arm.c: Wherever possible, use official reloc names
from AAELF.
(elf32_arm_howto_table, elf32_arm_tls_gd32_howto)
(elf32_arm_tls_ldo32_howto, elf32_arm_tls_ldm32_howto)
(elf32_arm_tls_le32_howto, elf32_arm_tls_ie32_howto)
(elf32_arm_vtinherit_howto, elf32_arm_vtentry_howto)
(elf32_arm_pc11_howto, elf32_arm_thm_pc9_howto, elf32_arm_got_prel)
(elf32_arm_r_howto): Replace with elf32_arm_howto_table_1,
elf32_arm_howto_table_2, and elf32_arm_howto_table_3.
Add many new relocations from AAELF.
(elf32_arm_howto_from_type): Update to match.
(elf32_arm_reloc_map): Add entries for R_ARM_THM_JUMP24,
R_ARM_THM_JUMP11, R_ARM_THM_JUMP19, R_ARM_THM_JUMP8,
R_ARM_THM_JUMP6, R_ARM_GNU_VTINHERIT, and R_ARM_GNU_VTENTRY.
(elf32_arm_reloc_type_lookup): Use elf32_arm_howto_from_type.
(elf32_arm_final_link_relocate): Add support for
R_ARM_THM_JUMP24, R_ARM_THM_JUMP19, R_ARM_THM_JUMP6. Remove
case entries redundant with default.
* reloc.c: Reorganize ARM relocations. Add Thumb
assembler-internal relocations BFD_RELOC_ARM_T32_OFFSET_U8,
BFD_RELOC_ARM_T32_OFFSET_IMM, BFD_RELOC_ARM_T32_IMMEDIATE.
Add visible relocations BFD_RELOC_THUMB_PCREL_BRANCH7,
BFD_RELOC_THUMB_BRANCH20, BFD_RELOC_THUMB_BRANCH25.
Delete unused relocations BFD_RELOC_ARM_GOT12, BFD_RELOC_ARM_COPY.
* bfd-in2.h, libbfd.h: Regenerate.
opcodes:
* arm-dis.c (thumb_opcodes): Add disassembly for V6T2 16-bit
instructions. Adjust disassembly of some opcodes to match
unified syntax.
(thumb32_opcodes): New table.
(print_insn_thumb): Rename print_insn_thumb16; don't handle
two-halfword branches here.
(print_insn_thumb32): New function.
(print_insn): Choose among print_insn_arm, print_insn_thumb16,
and print_insn_thumb32. Be consistent about order of
halfwords when printing 32-bit instructions.
gas:
* hash.c (hash_lookup): Add len parameter. All callers changed.
(hash_find_n): New interface.
* hash.h: Prototype hash_find_n.
* sb.c: Include as.h.
(scrub_from_sb, sb_to_scrub, scrub_position): New statics.
(sb_scrub_and_add_sb): New interface.
* sb.h: Prototype sb_scrub_and_add_sb.
* input-scrub.c (input_scrub_include_sb): Use sb_scrub_and_add_sb.
* config/tc-arm.h (TC_FORCE_RELOCATION_LOCAL): Remove
reference to BFD_RELOC_ARM_GOT12 which is never generated.
* config/tc-arm.c: Rewrite, adding Thumb-2 support.
gas/testsuite:
* gas/arm/arm.exp: Convert all existing "gas_test" tests to
"run_dump_test" tests. Run more tests unconditionally. Run new tests.
* gas/arm/arch4t.s, gas/arm/arch6zk.s, gas/arm/arm3.s, gas/arm/arm6.s
* gas/arm/arm7dm.s, gas/arm/bignum1.s, gas/arm/float.s
* gas/arm/immed.s, gas/arm/iwmmxt.s, gas/arm/offset.s, gas/arm/thumb.s:
Adjust to work as a dump test.
* gas/arm/arch4t.d, gas/arm/arch6zk.d, gas/arm/arm3.d, gas/arm/arm6.d
* gas/arm/arm7dm.d, gas/arm/bignum1.d, gas/arm/float.d
* gas/arm/immed.d, gas/arm/iwmmxt.d, gas/arm/offset.d, gas/arm/thumb.d:
New files.
* gas/arm/armv1-bad.l, gas/arm/armv1-bad.s: Remove tests for
diagnostics that don't happen in the first pass anymore.
* gas/arm/iwmmxt-bad.l, gas/arm/r15-bad.l, gas/arm/req.l
* gas/arm/vfp-bad.l:
Update expected diagnostics.
* gas/arm/pic.d: Update expected reloc name.
* gas/arm/thumbv6.d: CPY no longer appears in disassembly.
* gas/arm/r15-bad.s: Avoid two-argument mul.
* gas/arm/req.s: Adjust comments.
* gas/arm/maverick.d, gas/arm/maverick.s: Avoid inappropriate
use of PC.
* gas/arm/macro-1.d, gas/arm/macro1.s
* gas/arm/t16-bad.l, gas/arm/t16-bad.s
* gas/arm/tcompat.d, gas/arm/tcompat.s
* gas/arm/tcompat2.d, gas/arm/tcompat2.s
* gas/arm/thumb32.d, gas/arm/thumb32.s
New test pair.
ld/testsuite:
* ld-arm/mixed-app.d: Adjust expected disassembly a little.
2005-05-18 07:40:12 +02:00
|
|
|
|
p = hash_lookup (table, key, strlen (key), &list, &hash);
|
1999-06-03 01:22:50 +02:00
|
|
|
|
if (p != NULL)
|
1999-05-03 09:29:11 +02:00
|
|
|
|
{
|
1999-06-03 01:22:50 +02:00
|
|
|
|
#ifdef HASH_STATISTICS
|
|
|
|
|
++table->replacements;
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
p->data = value;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
}
|
1999-06-03 01:22:50 +02:00
|
|
|
|
else
|
1999-05-03 09:29:11 +02:00
|
|
|
|
{
|
1999-06-03 01:22:50 +02:00
|
|
|
|
#ifdef HASH_STATISTICS
|
|
|
|
|
++table->insertions;
|
|
|
|
|
#endif
|
|
|
|
|
|
2000-08-08 23:42:59 +02:00
|
|
|
|
p = (struct hash_entry *) obstack_alloc (&table->memory, sizeof (*p));
|
1999-06-03 01:22:50 +02:00
|
|
|
|
p->string = key;
|
|
|
|
|
p->hash = hash;
|
|
|
|
|
p->data = value;
|
|
|
|
|
|
|
|
|
|
p->next = *list;
|
|
|
|
|
*list = p;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
}
|
1999-06-03 01:22:50 +02:00
|
|
|
|
|
|
|
|
|
return NULL;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
}
|
|
|
|
|
|
2005-04-29 18:56:12 +02:00
|
|
|
|
/* Replace an existing entry in a hash table. This returns the old
|
|
|
|
|
value stored for the entry. If the entry is not found in the hash
|
|
|
|
|
table, this does nothing and returns NULL. */
|
|
|
|
|
|
|
|
|
|
PTR
|
|
|
|
|
hash_replace (struct hash_control *table, const char *key, PTR value)
|
|
|
|
|
{
|
|
|
|
|
struct hash_entry *p;
|
|
|
|
|
PTR ret;
|
|
|
|
|
|
include/elf:
* arm.h: Import complete list of official relocation names
and numbers from AAELF. Define FAKE_RELOCs for old names.
Remove a few old names no longer used anywhere.
bfd:
* elf32-arm.c: Wherever possible, use official reloc names
from AAELF.
(elf32_arm_howto_table, elf32_arm_tls_gd32_howto)
(elf32_arm_tls_ldo32_howto, elf32_arm_tls_ldm32_howto)
(elf32_arm_tls_le32_howto, elf32_arm_tls_ie32_howto)
(elf32_arm_vtinherit_howto, elf32_arm_vtentry_howto)
(elf32_arm_pc11_howto, elf32_arm_thm_pc9_howto, elf32_arm_got_prel)
(elf32_arm_r_howto): Replace with elf32_arm_howto_table_1,
elf32_arm_howto_table_2, and elf32_arm_howto_table_3.
Add many new relocations from AAELF.
(elf32_arm_howto_from_type): Update to match.
(elf32_arm_reloc_map): Add entries for R_ARM_THM_JUMP24,
R_ARM_THM_JUMP11, R_ARM_THM_JUMP19, R_ARM_THM_JUMP8,
R_ARM_THM_JUMP6, R_ARM_GNU_VTINHERIT, and R_ARM_GNU_VTENTRY.
(elf32_arm_reloc_type_lookup): Use elf32_arm_howto_from_type.
(elf32_arm_final_link_relocate): Add support for
R_ARM_THM_JUMP24, R_ARM_THM_JUMP19, R_ARM_THM_JUMP6. Remove
case entries redundant with default.
* reloc.c: Reorganize ARM relocations. Add Thumb
assembler-internal relocations BFD_RELOC_ARM_T32_OFFSET_U8,
BFD_RELOC_ARM_T32_OFFSET_IMM, BFD_RELOC_ARM_T32_IMMEDIATE.
Add visible relocations BFD_RELOC_THUMB_PCREL_BRANCH7,
BFD_RELOC_THUMB_BRANCH20, BFD_RELOC_THUMB_BRANCH25.
Delete unused relocations BFD_RELOC_ARM_GOT12, BFD_RELOC_ARM_COPY.
* bfd-in2.h, libbfd.h: Regenerate.
opcodes:
* arm-dis.c (thumb_opcodes): Add disassembly for V6T2 16-bit
instructions. Adjust disassembly of some opcodes to match
unified syntax.
(thumb32_opcodes): New table.
(print_insn_thumb): Rename print_insn_thumb16; don't handle
two-halfword branches here.
(print_insn_thumb32): New function.
(print_insn): Choose among print_insn_arm, print_insn_thumb16,
and print_insn_thumb32. Be consistent about order of
halfwords when printing 32-bit instructions.
gas:
* hash.c (hash_lookup): Add len parameter. All callers changed.
(hash_find_n): New interface.
* hash.h: Prototype hash_find_n.
* sb.c: Include as.h.
(scrub_from_sb, sb_to_scrub, scrub_position): New statics.
(sb_scrub_and_add_sb): New interface.
* sb.h: Prototype sb_scrub_and_add_sb.
* input-scrub.c (input_scrub_include_sb): Use sb_scrub_and_add_sb.
* config/tc-arm.h (TC_FORCE_RELOCATION_LOCAL): Remove
reference to BFD_RELOC_ARM_GOT12 which is never generated.
* config/tc-arm.c: Rewrite, adding Thumb-2 support.
gas/testsuite:
* gas/arm/arm.exp: Convert all existing "gas_test" tests to
"run_dump_test" tests. Run more tests unconditionally. Run new tests.
* gas/arm/arch4t.s, gas/arm/arch6zk.s, gas/arm/arm3.s, gas/arm/arm6.s
* gas/arm/arm7dm.s, gas/arm/bignum1.s, gas/arm/float.s
* gas/arm/immed.s, gas/arm/iwmmxt.s, gas/arm/offset.s, gas/arm/thumb.s:
Adjust to work as a dump test.
* gas/arm/arch4t.d, gas/arm/arch6zk.d, gas/arm/arm3.d, gas/arm/arm6.d
* gas/arm/arm7dm.d, gas/arm/bignum1.d, gas/arm/float.d
* gas/arm/immed.d, gas/arm/iwmmxt.d, gas/arm/offset.d, gas/arm/thumb.d:
New files.
* gas/arm/armv1-bad.l, gas/arm/armv1-bad.s: Remove tests for
diagnostics that don't happen in the first pass anymore.
* gas/arm/iwmmxt-bad.l, gas/arm/r15-bad.l, gas/arm/req.l
* gas/arm/vfp-bad.l:
Update expected diagnostics.
* gas/arm/pic.d: Update expected reloc name.
* gas/arm/thumbv6.d: CPY no longer appears in disassembly.
* gas/arm/r15-bad.s: Avoid two-argument mul.
* gas/arm/req.s: Adjust comments.
* gas/arm/maverick.d, gas/arm/maverick.s: Avoid inappropriate
use of PC.
* gas/arm/macro-1.d, gas/arm/macro1.s
* gas/arm/t16-bad.l, gas/arm/t16-bad.s
* gas/arm/tcompat.d, gas/arm/tcompat.s
* gas/arm/tcompat2.d, gas/arm/tcompat2.s
* gas/arm/thumb32.d, gas/arm/thumb32.s
New test pair.
ld/testsuite:
* ld-arm/mixed-app.d: Adjust expected disassembly a little.
2005-05-18 07:40:12 +02:00
|
|
|
|
p = hash_lookup (table, key, strlen (key), NULL, NULL);
|
2005-04-29 18:56:12 +02:00
|
|
|
|
if (p == NULL)
|
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
|
|
#ifdef HASH_STATISTICS
|
|
|
|
|
++table->replacements;
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
ret = p->data;
|
|
|
|
|
|
|
|
|
|
p->data = value;
|
|
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
1999-06-03 01:22:50 +02:00
|
|
|
|
/* Find an entry in a hash table, returning its value. Returns NULL
|
|
|
|
|
if the entry is not found. */
|
|
|
|
|
|
1999-05-03 09:29:11 +02:00
|
|
|
|
PTR
|
2003-11-24 04:37:58 +01:00
|
|
|
|
hash_find (struct hash_control *table, const char *key)
|
1999-05-03 09:29:11 +02:00
|
|
|
|
{
|
1999-06-03 01:22:50 +02:00
|
|
|
|
struct hash_entry *p;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
include/elf:
* arm.h: Import complete list of official relocation names
and numbers from AAELF. Define FAKE_RELOCs for old names.
Remove a few old names no longer used anywhere.
bfd:
* elf32-arm.c: Wherever possible, use official reloc names
from AAELF.
(elf32_arm_howto_table, elf32_arm_tls_gd32_howto)
(elf32_arm_tls_ldo32_howto, elf32_arm_tls_ldm32_howto)
(elf32_arm_tls_le32_howto, elf32_arm_tls_ie32_howto)
(elf32_arm_vtinherit_howto, elf32_arm_vtentry_howto)
(elf32_arm_pc11_howto, elf32_arm_thm_pc9_howto, elf32_arm_got_prel)
(elf32_arm_r_howto): Replace with elf32_arm_howto_table_1,
elf32_arm_howto_table_2, and elf32_arm_howto_table_3.
Add many new relocations from AAELF.
(elf32_arm_howto_from_type): Update to match.
(elf32_arm_reloc_map): Add entries for R_ARM_THM_JUMP24,
R_ARM_THM_JUMP11, R_ARM_THM_JUMP19, R_ARM_THM_JUMP8,
R_ARM_THM_JUMP6, R_ARM_GNU_VTINHERIT, and R_ARM_GNU_VTENTRY.
(elf32_arm_reloc_type_lookup): Use elf32_arm_howto_from_type.
(elf32_arm_final_link_relocate): Add support for
R_ARM_THM_JUMP24, R_ARM_THM_JUMP19, R_ARM_THM_JUMP6. Remove
case entries redundant with default.
* reloc.c: Reorganize ARM relocations. Add Thumb
assembler-internal relocations BFD_RELOC_ARM_T32_OFFSET_U8,
BFD_RELOC_ARM_T32_OFFSET_IMM, BFD_RELOC_ARM_T32_IMMEDIATE.
Add visible relocations BFD_RELOC_THUMB_PCREL_BRANCH7,
BFD_RELOC_THUMB_BRANCH20, BFD_RELOC_THUMB_BRANCH25.
Delete unused relocations BFD_RELOC_ARM_GOT12, BFD_RELOC_ARM_COPY.
* bfd-in2.h, libbfd.h: Regenerate.
opcodes:
* arm-dis.c (thumb_opcodes): Add disassembly for V6T2 16-bit
instructions. Adjust disassembly of some opcodes to match
unified syntax.
(thumb32_opcodes): New table.
(print_insn_thumb): Rename print_insn_thumb16; don't handle
two-halfword branches here.
(print_insn_thumb32): New function.
(print_insn): Choose among print_insn_arm, print_insn_thumb16,
and print_insn_thumb32. Be consistent about order of
halfwords when printing 32-bit instructions.
gas:
* hash.c (hash_lookup): Add len parameter. All callers changed.
(hash_find_n): New interface.
* hash.h: Prototype hash_find_n.
* sb.c: Include as.h.
(scrub_from_sb, sb_to_scrub, scrub_position): New statics.
(sb_scrub_and_add_sb): New interface.
* sb.h: Prototype sb_scrub_and_add_sb.
* input-scrub.c (input_scrub_include_sb): Use sb_scrub_and_add_sb.
* config/tc-arm.h (TC_FORCE_RELOCATION_LOCAL): Remove
reference to BFD_RELOC_ARM_GOT12 which is never generated.
* config/tc-arm.c: Rewrite, adding Thumb-2 support.
gas/testsuite:
* gas/arm/arm.exp: Convert all existing "gas_test" tests to
"run_dump_test" tests. Run more tests unconditionally. Run new tests.
* gas/arm/arch4t.s, gas/arm/arch6zk.s, gas/arm/arm3.s, gas/arm/arm6.s
* gas/arm/arm7dm.s, gas/arm/bignum1.s, gas/arm/float.s
* gas/arm/immed.s, gas/arm/iwmmxt.s, gas/arm/offset.s, gas/arm/thumb.s:
Adjust to work as a dump test.
* gas/arm/arch4t.d, gas/arm/arch6zk.d, gas/arm/arm3.d, gas/arm/arm6.d
* gas/arm/arm7dm.d, gas/arm/bignum1.d, gas/arm/float.d
* gas/arm/immed.d, gas/arm/iwmmxt.d, gas/arm/offset.d, gas/arm/thumb.d:
New files.
* gas/arm/armv1-bad.l, gas/arm/armv1-bad.s: Remove tests for
diagnostics that don't happen in the first pass anymore.
* gas/arm/iwmmxt-bad.l, gas/arm/r15-bad.l, gas/arm/req.l
* gas/arm/vfp-bad.l:
Update expected diagnostics.
* gas/arm/pic.d: Update expected reloc name.
* gas/arm/thumbv6.d: CPY no longer appears in disassembly.
* gas/arm/r15-bad.s: Avoid two-argument mul.
* gas/arm/req.s: Adjust comments.
* gas/arm/maverick.d, gas/arm/maverick.s: Avoid inappropriate
use of PC.
* gas/arm/macro-1.d, gas/arm/macro1.s
* gas/arm/t16-bad.l, gas/arm/t16-bad.s
* gas/arm/tcompat.d, gas/arm/tcompat.s
* gas/arm/tcompat2.d, gas/arm/tcompat2.s
* gas/arm/thumb32.d, gas/arm/thumb32.s
New test pair.
ld/testsuite:
* ld-arm/mixed-app.d: Adjust expected disassembly a little.
2005-05-18 07:40:12 +02:00
|
|
|
|
p = hash_lookup (table, key, strlen (key), NULL, NULL);
|
|
|
|
|
if (p == NULL)
|
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
|
|
return p->data;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* As hash_find, but KEY is of length LEN and is not guaranteed to be
|
|
|
|
|
NUL-terminated. */
|
|
|
|
|
|
|
|
|
|
PTR
|
|
|
|
|
hash_find_n (struct hash_control *table, const char *key, size_t len)
|
|
|
|
|
{
|
|
|
|
|
struct hash_entry *p;
|
|
|
|
|
|
|
|
|
|
p = hash_lookup (table, key, len, NULL, NULL);
|
1999-06-03 01:22:50 +02:00
|
|
|
|
if (p == NULL)
|
1999-05-03 09:29:11 +02:00
|
|
|
|
return NULL;
|
1999-06-03 01:22:50 +02:00
|
|
|
|
|
|
|
|
|
return p->data;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
}
|
1999-06-03 01:22:50 +02:00
|
|
|
|
|
2005-04-29 18:56:12 +02:00
|
|
|
|
/* Delete an entry from a hash table. This returns the value stored
|
|
|
|
|
for that entry, or NULL if there is no such entry. */
|
|
|
|
|
|
|
|
|
|
PTR
|
|
|
|
|
hash_delete (struct hash_control *table, const char *key)
|
|
|
|
|
{
|
|
|
|
|
struct hash_entry *p;
|
|
|
|
|
struct hash_entry **list;
|
|
|
|
|
|
include/elf:
* arm.h: Import complete list of official relocation names
and numbers from AAELF. Define FAKE_RELOCs for old names.
Remove a few old names no longer used anywhere.
bfd:
* elf32-arm.c: Wherever possible, use official reloc names
from AAELF.
(elf32_arm_howto_table, elf32_arm_tls_gd32_howto)
(elf32_arm_tls_ldo32_howto, elf32_arm_tls_ldm32_howto)
(elf32_arm_tls_le32_howto, elf32_arm_tls_ie32_howto)
(elf32_arm_vtinherit_howto, elf32_arm_vtentry_howto)
(elf32_arm_pc11_howto, elf32_arm_thm_pc9_howto, elf32_arm_got_prel)
(elf32_arm_r_howto): Replace with elf32_arm_howto_table_1,
elf32_arm_howto_table_2, and elf32_arm_howto_table_3.
Add many new relocations from AAELF.
(elf32_arm_howto_from_type): Update to match.
(elf32_arm_reloc_map): Add entries for R_ARM_THM_JUMP24,
R_ARM_THM_JUMP11, R_ARM_THM_JUMP19, R_ARM_THM_JUMP8,
R_ARM_THM_JUMP6, R_ARM_GNU_VTINHERIT, and R_ARM_GNU_VTENTRY.
(elf32_arm_reloc_type_lookup): Use elf32_arm_howto_from_type.
(elf32_arm_final_link_relocate): Add support for
R_ARM_THM_JUMP24, R_ARM_THM_JUMP19, R_ARM_THM_JUMP6. Remove
case entries redundant with default.
* reloc.c: Reorganize ARM relocations. Add Thumb
assembler-internal relocations BFD_RELOC_ARM_T32_OFFSET_U8,
BFD_RELOC_ARM_T32_OFFSET_IMM, BFD_RELOC_ARM_T32_IMMEDIATE.
Add visible relocations BFD_RELOC_THUMB_PCREL_BRANCH7,
BFD_RELOC_THUMB_BRANCH20, BFD_RELOC_THUMB_BRANCH25.
Delete unused relocations BFD_RELOC_ARM_GOT12, BFD_RELOC_ARM_COPY.
* bfd-in2.h, libbfd.h: Regenerate.
opcodes:
* arm-dis.c (thumb_opcodes): Add disassembly for V6T2 16-bit
instructions. Adjust disassembly of some opcodes to match
unified syntax.
(thumb32_opcodes): New table.
(print_insn_thumb): Rename print_insn_thumb16; don't handle
two-halfword branches here.
(print_insn_thumb32): New function.
(print_insn): Choose among print_insn_arm, print_insn_thumb16,
and print_insn_thumb32. Be consistent about order of
halfwords when printing 32-bit instructions.
gas:
* hash.c (hash_lookup): Add len parameter. All callers changed.
(hash_find_n): New interface.
* hash.h: Prototype hash_find_n.
* sb.c: Include as.h.
(scrub_from_sb, sb_to_scrub, scrub_position): New statics.
(sb_scrub_and_add_sb): New interface.
* sb.h: Prototype sb_scrub_and_add_sb.
* input-scrub.c (input_scrub_include_sb): Use sb_scrub_and_add_sb.
* config/tc-arm.h (TC_FORCE_RELOCATION_LOCAL): Remove
reference to BFD_RELOC_ARM_GOT12 which is never generated.
* config/tc-arm.c: Rewrite, adding Thumb-2 support.
gas/testsuite:
* gas/arm/arm.exp: Convert all existing "gas_test" tests to
"run_dump_test" tests. Run more tests unconditionally. Run new tests.
* gas/arm/arch4t.s, gas/arm/arch6zk.s, gas/arm/arm3.s, gas/arm/arm6.s
* gas/arm/arm7dm.s, gas/arm/bignum1.s, gas/arm/float.s
* gas/arm/immed.s, gas/arm/iwmmxt.s, gas/arm/offset.s, gas/arm/thumb.s:
Adjust to work as a dump test.
* gas/arm/arch4t.d, gas/arm/arch6zk.d, gas/arm/arm3.d, gas/arm/arm6.d
* gas/arm/arm7dm.d, gas/arm/bignum1.d, gas/arm/float.d
* gas/arm/immed.d, gas/arm/iwmmxt.d, gas/arm/offset.d, gas/arm/thumb.d:
New files.
* gas/arm/armv1-bad.l, gas/arm/armv1-bad.s: Remove tests for
diagnostics that don't happen in the first pass anymore.
* gas/arm/iwmmxt-bad.l, gas/arm/r15-bad.l, gas/arm/req.l
* gas/arm/vfp-bad.l:
Update expected diagnostics.
* gas/arm/pic.d: Update expected reloc name.
* gas/arm/thumbv6.d: CPY no longer appears in disassembly.
* gas/arm/r15-bad.s: Avoid two-argument mul.
* gas/arm/req.s: Adjust comments.
* gas/arm/maverick.d, gas/arm/maverick.s: Avoid inappropriate
use of PC.
* gas/arm/macro-1.d, gas/arm/macro1.s
* gas/arm/t16-bad.l, gas/arm/t16-bad.s
* gas/arm/tcompat.d, gas/arm/tcompat.s
* gas/arm/tcompat2.d, gas/arm/tcompat2.s
* gas/arm/thumb32.d, gas/arm/thumb32.s
New test pair.
ld/testsuite:
* ld-arm/mixed-app.d: Adjust expected disassembly a little.
2005-05-18 07:40:12 +02:00
|
|
|
|
p = hash_lookup (table, key, strlen (key), &list, NULL);
|
2005-04-29 18:56:12 +02:00
|
|
|
|
if (p == NULL)
|
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
|
|
if (p != *list)
|
|
|
|
|
abort ();
|
|
|
|
|
|
|
|
|
|
#ifdef HASH_STATISTICS
|
|
|
|
|
++table->deletions;
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
*list = p->next;
|
|
|
|
|
|
|
|
|
|
/* Note that we never reclaim the memory for this entry. If gas
|
|
|
|
|
ever starts deleting hash table entries in a big way, this will
|
|
|
|
|
have to change. */
|
|
|
|
|
|
|
|
|
|
return p->data;
|
|
|
|
|
}
|
|
|
|
|
|
1999-06-03 01:22:50 +02:00
|
|
|
|
/* Traverse a hash table. Call the function on every entry in the
|
|
|
|
|
hash table. */
|
|
|
|
|
|
1999-05-03 09:29:11 +02:00
|
|
|
|
void
|
2003-11-24 04:37:58 +01:00
|
|
|
|
hash_traverse (struct hash_control *table,
|
|
|
|
|
void (*pfn) (const char *key, PTR value))
|
1999-05-03 09:29:11 +02:00
|
|
|
|
{
|
1999-06-03 01:22:50 +02:00
|
|
|
|
unsigned int i;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
1999-06-03 01:22:50 +02:00
|
|
|
|
for (i = 0; i < table->size; ++i)
|
|
|
|
|
{
|
|
|
|
|
struct hash_entry *p;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
1999-06-03 01:22:50 +02:00
|
|
|
|
for (p = table->table[i]; p != NULL; p = p->next)
|
|
|
|
|
(*pfn) (p->string, p->data);
|
|
|
|
|
}
|
|
|
|
|
}
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
1999-06-03 01:22:50 +02:00
|
|
|
|
/* Print hash table statistics on the specified file. NAME is the
|
|
|
|
|
name of the hash table, used for printing a header. */
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
1999-06-03 01:22:50 +02:00
|
|
|
|
void
|
2003-11-24 04:37:58 +01:00
|
|
|
|
hash_print_statistics (FILE *f ATTRIBUTE_UNUSED,
|
|
|
|
|
const char *name ATTRIBUTE_UNUSED,
|
|
|
|
|
struct hash_control *table ATTRIBUTE_UNUSED)
|
1999-06-03 01:22:50 +02:00
|
|
|
|
{
|
|
|
|
|
#ifdef HASH_STATISTICS
|
|
|
|
|
unsigned int i;
|
|
|
|
|
unsigned long total;
|
|
|
|
|
unsigned long empty;
|
|
|
|
|
|
|
|
|
|
fprintf (f, "%s hash statistics:\n", name);
|
|
|
|
|
fprintf (f, "\t%lu lookups\n", table->lookups);
|
|
|
|
|
fprintf (f, "\t%lu hash comparisons\n", table->hash_compares);
|
|
|
|
|
fprintf (f, "\t%lu string comparisons\n", table->string_compares);
|
|
|
|
|
fprintf (f, "\t%lu insertions\n", table->insertions);
|
|
|
|
|
fprintf (f, "\t%lu replacements\n", table->replacements);
|
|
|
|
|
fprintf (f, "\t%lu deletions\n", table->deletions);
|
|
|
|
|
|
|
|
|
|
total = 0;
|
|
|
|
|
empty = 0;
|
|
|
|
|
for (i = 0; i < table->size; ++i)
|
|
|
|
|
{
|
|
|
|
|
struct hash_entry *p;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
1999-06-03 01:22:50 +02:00
|
|
|
|
if (table->table[i] == NULL)
|
|
|
|
|
++empty;
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
for (p = table->table[i]; p != NULL; p = p->next)
|
|
|
|
|
++total;
|
|
|
|
|
}
|
|
|
|
|
}
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
1999-06-03 01:22:50 +02:00
|
|
|
|
fprintf (f, "\t%g average chain length\n", (double) total / table->size);
|
|
|
|
|
fprintf (f, "\t%lu empty slots\n", empty);
|
|
|
|
|
#endif
|
1999-05-03 09:29:11 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#ifdef TEST
|
|
|
|
|
|
1999-06-03 01:22:50 +02:00
|
|
|
|
/* This test program is left over from the old hash table code. */
|
|
|
|
|
|
2000-08-08 23:42:59 +02:00
|
|
|
|
/* Number of hash tables to maintain (at once) in any testing. */
|
|
|
|
|
#define TABLES (6)
|
|
|
|
|
|
|
|
|
|
/* We can have 12 statistics. */
|
|
|
|
|
#define STATBUFSIZE (12)
|
|
|
|
|
|
|
|
|
|
/* Display statistics here. */
|
|
|
|
|
int statbuf[STATBUFSIZE];
|
|
|
|
|
|
|
|
|
|
/* Human farts here. */
|
|
|
|
|
char answer[100];
|
|
|
|
|
|
|
|
|
|
/* We test many hash tables at once. */
|
|
|
|
|
char *hashtable[TABLES];
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
2003-10-27 13:45:17 +01:00
|
|
|
|
/* Points to current hash_control. */
|
2000-08-08 23:42:59 +02:00
|
|
|
|
char *h;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
char **pp;
|
|
|
|
|
char *p;
|
|
|
|
|
char *name;
|
|
|
|
|
char *value;
|
|
|
|
|
int size;
|
|
|
|
|
int used;
|
|
|
|
|
char command;
|
2000-08-08 23:42:59 +02:00
|
|
|
|
|
|
|
|
|
/* Number 0:TABLES-1 of current hashed symbol table. */
|
|
|
|
|
int number;
|
1999-05-03 09:29:11 +02:00
|
|
|
|
|
1999-06-03 01:22:50 +02:00
|
|
|
|
int
|
1999-05-03 09:29:11 +02:00
|
|
|
|
main ()
|
|
|
|
|
{
|
|
|
|
|
void applicatee ();
|
|
|
|
|
void destroy ();
|
|
|
|
|
char *what ();
|
|
|
|
|
int *ip;
|
|
|
|
|
|
|
|
|
|
number = 0;
|
|
|
|
|
h = 0;
|
|
|
|
|
printf ("type h <RETURN> for help\n");
|
|
|
|
|
for (;;)
|
|
|
|
|
{
|
|
|
|
|
printf ("hash_test command: ");
|
|
|
|
|
gets (answer);
|
|
|
|
|
command = answer[0];
|
2001-09-19 07:33:36 +02:00
|
|
|
|
command = TOLOWER (command); /* Ecch! */
|
1999-05-03 09:29:11 +02:00
|
|
|
|
switch (command)
|
|
|
|
|
{
|
|
|
|
|
case '#':
|
|
|
|
|
printf ("old hash table #=%d.\n", number);
|
|
|
|
|
whattable ();
|
|
|
|
|
break;
|
|
|
|
|
case '?':
|
|
|
|
|
for (pp = hashtable; pp < hashtable + TABLES; pp++)
|
|
|
|
|
{
|
2000-08-08 23:42:59 +02:00
|
|
|
|
printf ("address of hash table #%d control block is %xx\n",
|
|
|
|
|
pp - hashtable, *pp);
|
1999-05-03 09:29:11 +02:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 'a':
|
1999-06-03 01:22:50 +02:00
|
|
|
|
hash_traverse (h, applicatee);
|
1999-05-03 09:29:11 +02:00
|
|
|
|
break;
|
|
|
|
|
case 'd':
|
1999-06-03 01:22:50 +02:00
|
|
|
|
hash_traverse (h, destroy);
|
1999-05-03 09:29:11 +02:00
|
|
|
|
hash_die (h);
|
|
|
|
|
break;
|
|
|
|
|
case 'f':
|
|
|
|
|
p = hash_find (h, name = what ("symbol"));
|
|
|
|
|
printf ("value of \"%s\" is \"%s\"\n", name, p ? p : "NOT-PRESENT");
|
|
|
|
|
break;
|
|
|
|
|
case 'h':
|
|
|
|
|
printf ("# show old, select new default hash table number\n");
|
|
|
|
|
printf ("? display all hashtable control block addresses\n");
|
|
|
|
|
printf ("a apply a simple display-er to each symbol in table\n");
|
|
|
|
|
printf ("d die: destroy hashtable\n");
|
|
|
|
|
printf ("f find value of nominated symbol\n");
|
|
|
|
|
printf ("h this help\n");
|
|
|
|
|
printf ("i insert value into symbol\n");
|
|
|
|
|
printf ("j jam value into symbol\n");
|
|
|
|
|
printf ("n new hashtable\n");
|
|
|
|
|
printf ("r replace a value with another\n");
|
|
|
|
|
printf ("s say what %% of table is used\n");
|
|
|
|
|
printf ("q exit this program\n");
|
|
|
|
|
printf ("x delete a symbol from table, report its value\n");
|
|
|
|
|
break;
|
|
|
|
|
case 'i':
|
|
|
|
|
p = hash_insert (h, name = what ("symbol"), value = what ("value"));
|
|
|
|
|
if (p)
|
|
|
|
|
{
|
|
|
|
|
printf ("symbol=\"%s\" value=\"%s\" error=%s\n", name, value,
|
|
|
|
|
p);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 'j':
|
|
|
|
|
p = hash_jam (h, name = what ("symbol"), value = what ("value"));
|
|
|
|
|
if (p)
|
|
|
|
|
{
|
|
|
|
|
printf ("symbol=\"%s\" value=\"%s\" error=%s\n", name, value, p);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 'n':
|
|
|
|
|
h = hashtable[number] = (char *) hash_new ();
|
|
|
|
|
break;
|
|
|
|
|
case 'q':
|
|
|
|
|
exit (EXIT_SUCCESS);
|
|
|
|
|
case 'r':
|
|
|
|
|
p = hash_replace (h, name = what ("symbol"), value = what ("value"));
|
|
|
|
|
printf ("old value was \"%s\"\n", p ? p : "{}");
|
|
|
|
|
break;
|
|
|
|
|
case 's':
|
|
|
|
|
hash_say (h, statbuf, STATBUFSIZE);
|
|
|
|
|
for (ip = statbuf; ip < statbuf + STATBUFSIZE; ip++)
|
|
|
|
|
{
|
|
|
|
|
printf ("%d ", *ip);
|
|
|
|
|
}
|
|
|
|
|
printf ("\n");
|
|
|
|
|
break;
|
|
|
|
|
case 'x':
|
|
|
|
|
p = hash_delete (h, name = what ("symbol"));
|
|
|
|
|
printf ("old value was \"%s\"\n", p ? p : "{}");
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
printf ("I can't understand command \"%c\"\n", command);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
char *
|
|
|
|
|
what (description)
|
|
|
|
|
char *description;
|
|
|
|
|
{
|
|
|
|
|
printf (" %s : ", description);
|
|
|
|
|
gets (answer);
|
2002-06-26 03:18:42 +02:00
|
|
|
|
return xstrdup (answer);
|
1999-05-03 09:29:11 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
destroy (string, value)
|
|
|
|
|
char *string;
|
|
|
|
|
char *value;
|
|
|
|
|
{
|
|
|
|
|
free (string);
|
|
|
|
|
free (value);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
applicatee (string, value)
|
|
|
|
|
char *string;
|
|
|
|
|
char *value;
|
|
|
|
|
{
|
|
|
|
|
printf ("%.20s-%.20s\n", string, value);
|
|
|
|
|
}
|
|
|
|
|
|
2000-08-08 23:42:59 +02:00
|
|
|
|
/* Determine number: what hash table to use.
|
|
|
|
|
Also determine h: points to hash_control. */
|
|
|
|
|
|
1999-06-03 01:22:50 +02:00
|
|
|
|
void
|
2000-08-08 23:42:59 +02:00
|
|
|
|
whattable ()
|
1999-05-03 09:29:11 +02:00
|
|
|
|
{
|
|
|
|
|
for (;;)
|
|
|
|
|
{
|
|
|
|
|
printf (" what hash table (%d:%d) ? ", 0, TABLES - 1);
|
|
|
|
|
gets (answer);
|
|
|
|
|
sscanf (answer, "%d", &number);
|
|
|
|
|
if (number >= 0 && number < TABLES)
|
|
|
|
|
{
|
|
|
|
|
h = hashtable[number];
|
|
|
|
|
if (!h)
|
|
|
|
|
{
|
|
|
|
|
printf ("warning: current hash-table-#%d. has no hash-control\n", number);
|
|
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
printf ("invalid hash table number: %d\n", number);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2000-08-08 23:42:59 +02:00
|
|
|
|
#endif /* TEST */
|