1999-06-02 23:22:50 +00:00
|
|
|
/* hash.h -- header file for gas hash table routines
|
2016-01-01 11:25:12 +00:00
|
|
|
Copyright (C) 1987-2016 Free Software Foundation, Inc.
|
1999-05-03 07:29:11 +00:00
|
|
|
|
|
|
|
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 11:01:12 +00:00
|
|
|
the Free Software Foundation; either version 3, or (at your option)
|
1999-05-03 07:29:11 +00: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-02 23:22:50 +00:00
|
|
|
along with GAS; see the file COPYING. If not, write to the Free
|
2005-05-05 09:13:19 +00:00
|
|
|
Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
|
|
|
|
02110-1301, USA. */
|
1999-05-03 07:29:11 +00:00
|
|
|
|
1999-06-02 23:22:50 +00:00
|
|
|
#ifndef HASH_H
|
|
|
|
#define HASH_H
|
1999-05-03 07:29:11 +00:00
|
|
|
|
|
|
|
struct hash_control;
|
|
|
|
|
2005-04-12 08:42:41 +00:00
|
|
|
/* Set the size of the hash table used. */
|
|
|
|
|
2005-04-14 09:00:35 +00:00
|
|
|
void set_gas_hash_table_size (unsigned long);
|
2005-04-12 08:42:41 +00:00
|
|
|
|
1999-06-02 23:22:50 +00:00
|
|
|
/* Create a hash table. This return a control block. */
|
|
|
|
|
2003-11-24 03:37:58 +00:00
|
|
|
extern struct hash_control *hash_new (void);
|
2013-01-10 17:11:17 +00:00
|
|
|
extern struct hash_control *hash_new_sized (unsigned long);
|
1999-06-02 23:22:50 +00:00
|
|
|
|
|
|
|
/* Delete a hash table, freeing all allocated memory. */
|
|
|
|
|
2003-11-24 03:37:58 +00:00
|
|
|
extern void hash_die (struct hash_control *);
|
1999-06-02 23:22:50 +00: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. */
|
|
|
|
|
2003-11-24 03:37:58 +00:00
|
|
|
extern const char *hash_insert (struct hash_control *,
|
2008-08-11 07:40:22 +00:00
|
|
|
const char *key, void *value);
|
1999-06-02 23:22:50 +00: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. */
|
|
|
|
|
2003-11-24 03:37:58 +00:00
|
|
|
extern const char *hash_jam (struct hash_control *,
|
2008-08-11 07:40:22 +00:00
|
|
|
const char *key, void *value);
|
1999-06-02 23:22:50 +00:00
|
|
|
|
2005-04-29 16:56:12 +00: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. */
|
|
|
|
|
2008-08-11 07:40:22 +00:00
|
|
|
extern void *hash_replace (struct hash_control *, const char *key,
|
|
|
|
void *value);
|
2005-04-29 16:56:12 +00:00
|
|
|
|
1999-06-02 23:22:50 +00:00
|
|
|
/* Find an entry in a hash table, returning its value. Returns NULL
|
|
|
|
if the entry is not found. */
|
|
|
|
|
2008-08-11 07:40:22 +00:00
|
|
|
extern void *hash_find (struct hash_control *, const char *key);
|
1999-06-02 23:22:50 +00: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 05:40:12 +00:00
|
|
|
/* As hash_find, but KEY is of length LEN and is not guaranteed to be
|
|
|
|
NUL-terminated. */
|
|
|
|
|
2008-08-11 07:40:22 +00:00
|
|
|
extern void *hash_find_n (struct hash_control *, const char *key, size_t len);
|
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 05:40:12 +00:00
|
|
|
|
2005-04-29 16:56:12 +00:00
|
|
|
/* Delete an entry from a hash table. This returns the value stored
|
|
|
|
for that entry, or NULL if there is no such entry. */
|
|
|
|
|
2008-08-11 07:40:22 +00:00
|
|
|
extern void *hash_delete (struct hash_control *, const char *key, int);
|
2005-04-29 16:56:12 +00:00
|
|
|
|
1999-06-02 23:22:50 +00:00
|
|
|
/* Traverse a hash table. Call the function on every entry in the
|
|
|
|
hash table. */
|
|
|
|
|
2003-11-24 03:37:58 +00:00
|
|
|
extern void hash_traverse (struct hash_control *,
|
2008-08-11 07:40:22 +00:00
|
|
|
void (*pfn) (const char *key, void *value));
|
1999-06-02 23:22:50 +00:00
|
|
|
|
|
|
|
/* Print hash table statistics on the specified file. NAME is the
|
|
|
|
name of the hash table, used for printing a header. */
|
|
|
|
|
2003-11-24 03:37:58 +00:00
|
|
|
extern void hash_print_statistics (FILE *, const char *name,
|
|
|
|
struct hash_control *);
|
1999-06-02 23:22:50 +00:00
|
|
|
|
|
|
|
#endif /* HASH_H */
|