summaryrefslogtreecommitdiff
path: root/gas/config
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2009-09-11 15:27:38 +0000
committerNick Clifton <nickc@redhat.com>2009-09-11 15:27:38 +0000
commit519e3c677c975c186dc605f172840cafad875ff7 (patch)
tree1979a9538f4f0fbe7197641b4e3f87d574314f82 /gas/config
parent79eec5eda1b569595878141a3e37b16a5aa4844f (diff)
downloadbinutils-redhat-519e3c677c975c186dc605f172840cafad875ff7.tar.gz
* po/bfd.pot: Updated by the Translation project.
* po/binutils.pot: Updated by the Translation project. * po/gold.pot: Updated by the Translation project. * po/gold.pot: Updated by the Translation project. * po/gprof.pot: Updated by the Translation project. * po/sv.po: Updated Swedish translation. * po/ld.pot: Updated by the Translation project. * po/fi.po: Updated Finnish translation. * po/ld.pot: Updated by the Translation project. * po/fi.po: Updated Finnish translation. Updated sources to compile cleanly with -Wc++-compat: * basic_blocks.c: Add casts. * cg_dfn.c: Add cast. * corefile.c: Add casts. * gmon_io.c: Add casts. * hist.c: Add cast. * source.c: Add cast. * sym_ids.c (struct match): Moved to top level. Updated soruces in ld/* to compile cleanly with -Wc++-compat: * ld.h (enum endian_enum,enum symbolic_enum,enum dynamic_list_enum): Move to top level. * ldcref.c: Add casts. * ldctor.c: Add casts. * ldexp.c * ldexp.h (enum node_tree_enum,enum phase_enum): Move to top level. * ldlang.c: Add casts. (lang_insert_orphan): Use enum name instead of integer. * ldlang.h (enum statement_enum): Move to top level. * ldmain.c: Add casts. * ldwrite.c: Add casts. * lexsup.c: Add casts. (enum control_enum): Move to top level. * mri.c: Add casts. (mri_draw_tree): Use enum name instead of integer. Updated sources to compile cleanly with -Wc++-compat: * basic_blocks.c: Add casts. * cg_dfn.c: Add cast. * corefile.c: Add casts. * gmon_io.c: Add casts. * hist.c: Add cast. * source.c: Add cast. * sym_ids.c (struct match): Moved to top level. * as.c (main): Call dwarf2_init. * config/obj-elf.c (struct group_list): New field. (build_group_lists): Use hash lookup. (free_section_idx): New function. (elf_frob_file): Adjust. * dwarf2dbg.c (all_segs_hash, last_seg_ptr): New variables. (get_line_subseg): Adjust. (dwarf2_init): New function. * dwarf2dbg.h (dwarf2_init): New declaration.
Diffstat (limited to 'gas/config')
-rw-r--r--gas/config/obj-elf.c108
-rw-r--r--gas/config/tc-i386-intel.c8
-rw-r--r--gas/config/tc-i386.c30
3 files changed, 82 insertions, 64 deletions
diff --git a/gas/config/obj-elf.c b/gas/config/obj-elf.c
index c7e2a836fb..d477b4e31c 100644
--- a/gas/config/obj-elf.c
+++ b/gas/config/obj-elf.c
@@ -269,7 +269,7 @@ elf_file_symbol (const char *s, int appfile)
if (name_length > strlen (S_GET_NAME (sym)))
{
obstack_grow (&notes, s, name_length + 1);
- S_SET_NAME (sym, obstack_finish (&notes));
+ S_SET_NAME (sym, (const char *) obstack_finish (&notes));
}
else
strcpy ((char *) S_GET_NAME (sym), s);
@@ -505,7 +505,7 @@ static struct section_stack *section_stack;
static bfd_boolean
get_section (bfd *abfd ATTRIBUTE_UNUSED, asection *sec, void *inf)
{
- const char *gname = inf;
+ const char *gname = (const char *) inf;
const char *group_name = elf_group_name (sec);
return (group_name == gname
@@ -555,7 +555,7 @@ obj_elf_change_section (const char *name,
if (push)
{
struct section_stack *elt;
- elt = xmalloc (sizeof (struct section_stack));
+ elt = (struct section_stack *) xmalloc (sizeof (struct section_stack));
elt->next = section_stack;
elt->seg = now_seg;
elt->prev_seg = previous_section;
@@ -885,7 +885,7 @@ obj_elf_section_name (void)
return NULL;
}
- name = xmalloc (end - input_line_pointer + 1);
+ name = (char *) xmalloc (end - input_line_pointer + 1);
memcpy (name, input_line_pointer, end - input_line_pointer);
name[end - input_line_pointer] = '\0';
#ifdef tc_canonicalize_section_name
@@ -1441,7 +1441,7 @@ elf_copy_symbol_attributes (symbolS *dest, symbolS *src)
if (srcelf->size)
{
if (destelf->size == NULL)
- destelf->size = xmalloc (sizeof (expressionS));
+ destelf->size = (expressionS *) xmalloc (sizeof (expressionS));
*destelf->size = *srcelf->size;
}
else
@@ -1558,7 +1558,8 @@ obj_elf_size (int ignore ATTRIBUTE_UNUSED)
}
else
{
- symbol_get_obj (sym)->size = xmalloc (sizeof (expressionS));
+ symbol_get_obj (sym)->size =
+ (expressionS *) xmalloc (sizeof (expressionS));
*symbol_get_obj (sym)->size = exp;
}
demand_empty_rest_of_line ();
@@ -1609,7 +1610,7 @@ obj_elf_type (int ignore ATTRIBUTE_UNUSED)
char *name;
char c;
int type;
- const char *typename;
+ const char *type_name;
symbolS *sym;
elf_symbol_type *elfsym;
@@ -1630,28 +1631,28 @@ obj_elf_type (int ignore ATTRIBUTE_UNUSED)
|| *input_line_pointer == '%')
++input_line_pointer;
- typename = obj_elf_type_name (& c);
+ type_name = obj_elf_type_name (& c);
type = 0;
- if (strcmp (typename, "function") == 0
- || strcmp (typename, "2") == 0
- || strcmp (typename, "STT_FUNC") == 0)
+ if (strcmp (type_name, "function") == 0
+ || strcmp (type_name, "2") == 0
+ || strcmp (type_name, "STT_FUNC") == 0)
type = BSF_FUNCTION;
- else if (strcmp (typename, "object") == 0
- || strcmp (typename, "1") == 0
- || strcmp (typename, "STT_OBJECT") == 0)
+ else if (strcmp (type_name, "object") == 0
+ || strcmp (type_name, "1") == 0
+ || strcmp (type_name, "STT_OBJECT") == 0)
type = BSF_OBJECT;
- else if (strcmp (typename, "tls_object") == 0
- || strcmp (typename, "6") == 0
- || strcmp (typename, "STT_TLS") == 0)
+ else if (strcmp (type_name, "tls_object") == 0
+ || strcmp (type_name, "6") == 0
+ || strcmp (type_name, "STT_TLS") == 0)
type = BSF_OBJECT | BSF_THREAD_LOCAL;
- else if (strcmp (typename, "notype") == 0
- || strcmp (typename, "0") == 0
- || strcmp (typename, "STT_NOTYPE") == 0)
+ else if (strcmp (type_name, "notype") == 0
+ || strcmp (type_name, "0") == 0
+ || strcmp (type_name, "STT_NOTYPE") == 0)
;
- else if (strcmp (typename, "common") == 0
- || strcmp (typename, "5") == 0
- || strcmp (typename, "STT_COMMON") == 0)
+ else if (strcmp (type_name, "common") == 0
+ || strcmp (type_name, "5") == 0
+ || strcmp (type_name, "STT_COMMON") == 0)
{
type = BSF_OBJECT;
@@ -1677,9 +1678,9 @@ obj_elf_type (int ignore ATTRIBUTE_UNUSED)
}
}
}
- else if (strcmp (typename, "gnu_indirect_function") == 0
- || strcmp (typename, "10") == 0
- || strcmp (typename, "STT_GNU_IFUNC") == 0)
+ else if (strcmp (type_name, "gnu_indirect_function") == 0
+ || strcmp (type_name, "10") == 0
+ || strcmp (type_name, "STT_GNU_IFUNC") == 0)
{
const struct elf_backend_data *bed;
@@ -1688,10 +1689,10 @@ obj_elf_type (int ignore ATTRIBUTE_UNUSED)
/* GNU/Linux is still using the default value 0. */
|| bed->elf_osabi == ELFOSABI_NONE))
as_bad (_("symbol type \"%s\" is supported only by GNU targets"),
- typename);
+ type_name);
type = BSF_FUNCTION | BSF_GNU_INDIRECT_FUNCTION;
}
- else if (strcmp (typename, "gnu_unique_object") == 0)
+ else if (strcmp (type_name, "gnu_unique_object") == 0)
{
struct elf_backend_data *bed;
@@ -1700,17 +1701,17 @@ obj_elf_type (int ignore ATTRIBUTE_UNUSED)
/* GNU/Linux is still using the default value 0. */
|| bed->elf_osabi == ELFOSABI_NONE))
as_bad (_("symbol type \"%s\" is supported only by GNU targets"),
- typename);
+ type_name);
type = BSF_OBJECT | BSF_GNU_UNIQUE;
/* PR 10549: Always set OSABI field to LINUX for objects containing unique symbols. */
bed->elf_osabi = ELFOSABI_LINUX;
}
#ifdef md_elf_symbol_type
- else if ((type = md_elf_symbol_type (typename, sym, elfsym)) != -1)
+ else if ((type = md_elf_symbol_type (type_name, sym, elfsym)) != -1)
;
#endif
else
- as_bad (_("unrecognized symbol type \"%s\""), typename);
+ as_bad (_("unrecognized symbol type \"%s\""), type_name);
*input_line_pointer = c;
@@ -1774,7 +1775,7 @@ obj_elf_init_stab_section (segT seg)
/* Zero it out. */
memset (p, 0, 12);
as_where (&file, NULL);
- stabstr_name = xmalloc (strlen (segment_name (seg)) + 4);
+ stabstr_name = (char *) xmalloc (strlen (segment_name (seg)) + 4);
strcpy (stabstr_name, segment_name (seg));
strcat (stabstr_name, "str");
stroff = get_stab_string_offset (file, stabstr_name);
@@ -1800,7 +1801,7 @@ adjust_stab_sections (bfd *abfd, asection *sec, void *xxx ATTRIBUTE_UNUSED)
if (!strcmp ("str", sec->name + strlen (sec->name) - 3))
return;
- name = alloca (strlen (sec->name) + 4);
+ name = (char *) alloca (strlen (sec->name) + 4);
strcpy (name, sec->name);
strcat (name, "str");
strsec = bfd_get_section_by_name (abfd, name);
@@ -2006,6 +2007,7 @@ struct group_list
asection **head; /* Section lists. */
unsigned int *elt_count; /* Number of sections in each list. */
unsigned int num_group; /* Number of lists. */
+ struct hash_control *indexes; /* Maps group name to index in head array. */
};
/* Called via bfd_map_over_sections. If SEC is a member of a group,
@@ -2016,24 +2018,24 @@ struct group_list
static void
build_group_lists (bfd *abfd ATTRIBUTE_UNUSED, asection *sec, void *inf)
{
- struct group_list *list = inf;
+ struct group_list *list = (struct group_list *) inf;
const char *group_name = elf_group_name (sec);
unsigned int i;
+ unsigned int *elem_idx;
+ unsigned int *idx_ptr;
if (group_name == NULL)
return;
/* If this group already has a list, add the section to the head of
the list. */
- for (i = 0; i < list->num_group; i++)
+ elem_idx = (unsigned int *) hash_find (list->indexes, group_name);
+ if (elem_idx != NULL)
{
- if (strcmp (group_name, elf_group_name (list->head[i])) == 0)
- {
- elf_next_in_group (sec) = list->head[i];
- list->head[i] = sec;
- list->elt_count[i] += 1;
- return;
- }
+ elf_next_in_group (sec) = list->head[*elem_idx];
+ list->head[*elem_idx] = sec;
+ list->elt_count[*elem_idx] += 1;
+ return;
}
/* New group. Make the arrays bigger in chunks to minimize calls to
@@ -2042,13 +2044,24 @@ build_group_lists (bfd *abfd ATTRIBUTE_UNUSED, asection *sec, void *inf)
if ((i & 127) == 0)
{
unsigned int newsize = i + 128;
- list->head = xrealloc (list->head, newsize * sizeof (*list->head));
- list->elt_count = xrealloc (list->elt_count,
- newsize * sizeof (*list->elt_count));
+ list->head = (asection **) xrealloc (list->head,
+ newsize * sizeof (*list->head));
+ list->elt_count = (unsigned int *)
+ xrealloc (list->elt_count, newsize * sizeof (*list->elt_count));
}
list->head[i] = sec;
list->elt_count[i] = 1;
list->num_group += 1;
+
+ /* Add index to hash. */
+ idx_ptr = xmalloc (sizeof (unsigned int));
+ *idx_ptr = i;
+ hash_insert (list->indexes, group_name, idx_ptr);
+}
+
+static void free_section_idx (const char *key ATTRIBUTE_UNUSED, void *val)
+{
+ free ((unsigned int *) val);
}
void
@@ -2063,6 +2076,7 @@ elf_frob_file (void)
list.num_group = 0;
list.head = NULL;
list.elt_count = NULL;
+ list.indexes = hash_new ();
bfd_map_over_sections (stdoutput, build_group_lists, &list);
/* Make the SHT_GROUP sections that describe each section group. We
@@ -2128,6 +2142,10 @@ elf_frob_file (void)
#ifdef elf_tc_final_processing
elf_tc_final_processing ();
#endif
+
+ /* Cleanup hash. */
+ hash_traverse (list.indexes, free_section_idx);
+ hash_die (list.indexes);
}
/* It removes any unneeded versioned symbols from the symbol table. */
diff --git a/gas/config/tc-i386-intel.c b/gas/config/tc-i386-intel.c
index c12569fcb5..ff20874b3f 100644
--- a/gas/config/tc-i386-intel.c
+++ b/gas/config/tc-i386-intel.c
@@ -65,7 +65,7 @@ intel_state;
static struct
{
const char *name;
- operatorT operator;
+ operatorT op;
unsigned int operands;
}
const i386_operators[] =
@@ -91,7 +91,7 @@ const i386_operators[] =
static struct
{
const char *name;
- operatorT operator;
+ operatorT op;
unsigned short sz[3];
}
const i386_types[] =
@@ -158,7 +158,7 @@ operatorT i386_operator (const char *name, unsigned int operands, char *pc)
if (i386_operators[j].operands
&& i386_operators[j].operands != operands)
return O_illegal;
- return i386_operators[j].operator;
+ return i386_operators[j].op;
}
for (j = 0; i386_types[j].name; ++j)
@@ -175,7 +175,7 @@ operatorT i386_operator (const char *name, unsigned int operands, char *pc)
*pc = c;
if (intel_syntax > 0 || operands != 1)
return O_illegal;
- return i386_types[j].operator;
+ return i386_types[j].op;
}
*input_line_pointer = c;
diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c
index af1994d0e2..a8dc7fc879 100644
--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -1851,7 +1851,7 @@ add_prefix (unsigned int prefix)
static void
set_code_flag (int value)
{
- flag_code = value;
+ flag_code = (enum flag_code) value;
if (flag_code == CODE_64BIT)
{
cpu_arch_flags.bitfield.cpu64 = 1;
@@ -1876,7 +1876,7 @@ set_code_flag (int value)
static void
set_16bit_gcc_code_flag (int new_code_flag)
{
- flag_code = new_code_flag;
+ flag_code = (enum flag_code) new_code_flag;
if (flag_code != CODE_16BIT)
abort ();
cpu_arch_flags.bitfield.cpu64 = 0;
@@ -1961,7 +1961,7 @@ set_sse_check (int dummy ATTRIBUTE_UNUSED)
static void
check_cpu_arch_compatible (const char *name ATTRIBUTE_UNUSED,
- i386_cpu_flags new ATTRIBUTE_UNUSED)
+ i386_cpu_flags new_flag ATTRIBUTE_UNUSED)
{
#if defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF)
static const char *arch;
@@ -1981,7 +1981,7 @@ check_cpu_arch_compatible (const char *name ATTRIBUTE_UNUSED,
/* If we are targeting Intel L1OM, we must enable it. */
if (get_elf_backend_data (stdoutput)->elf_machine_code != EM_L1OM
- || new.bitfield.cpul1om)
+ || new_flag.bitfield.cpul1om)
return;
as_bad (_("`%s' is not supported on `%s'"), name, arch);
@@ -6019,28 +6019,28 @@ lex_got (enum bfd_reloc_code_real *reloc,
const enum bfd_reloc_code_real rel[2];
const i386_operand_type types64;
} gotrel[] = {
- { "PLTOFF", { 0,
+ { "PLTOFF", { _dummy_first_bfd_reloc_code_real,
BFD_RELOC_X86_64_PLTOFF64 },
OPERAND_TYPE_IMM64 },
{ "PLT", { BFD_RELOC_386_PLT32,
BFD_RELOC_X86_64_PLT32 },
OPERAND_TYPE_IMM32_32S_DISP32 },
- { "GOTPLT", { 0,
+ { "GOTPLT", { _dummy_first_bfd_reloc_code_real,
BFD_RELOC_X86_64_GOTPLT64 },
OPERAND_TYPE_IMM64_DISP64 },
{ "GOTOFF", { BFD_RELOC_386_GOTOFF,
BFD_RELOC_X86_64_GOTOFF64 },
OPERAND_TYPE_IMM64_DISP64 },
- { "GOTPCREL", { 0,
+ { "GOTPCREL", { _dummy_first_bfd_reloc_code_real,
BFD_RELOC_X86_64_GOTPCREL },
OPERAND_TYPE_IMM32_32S_DISP32 },
{ "TLSGD", { BFD_RELOC_386_TLS_GD,
BFD_RELOC_X86_64_TLSGD },
OPERAND_TYPE_IMM32_32S_DISP32 },
{ "TLSLDM", { BFD_RELOC_386_TLS_LDM,
- 0 },
+ _dummy_first_bfd_reloc_code_real },
OPERAND_TYPE_NONE },
- { "TLSLD", { 0,
+ { "TLSLD", { _dummy_first_bfd_reloc_code_real,
BFD_RELOC_X86_64_TLSLD },
OPERAND_TYPE_IMM32_32S_DISP32 },
{ "GOTTPOFF", { BFD_RELOC_386_TLS_IE_32,
@@ -6050,17 +6050,17 @@ lex_got (enum bfd_reloc_code_real *reloc,
BFD_RELOC_X86_64_TPOFF32 },
OPERAND_TYPE_IMM32_32S_64_DISP32_64 },
{ "NTPOFF", { BFD_RELOC_386_TLS_LE,
- 0 },
+ _dummy_first_bfd_reloc_code_real },
OPERAND_TYPE_NONE },
{ "DTPOFF", { BFD_RELOC_386_TLS_LDO_32,
BFD_RELOC_X86_64_DTPOFF32 },
OPERAND_TYPE_IMM32_32S_64_DISP32_64 },
{ "GOTNTPOFF",{ BFD_RELOC_386_TLS_GOTIE,
- 0 },
+ _dummy_first_bfd_reloc_code_real },
OPERAND_TYPE_NONE },
{ "INDNTPOFF",{ BFD_RELOC_386_TLS_IE,
- 0 },
+ _dummy_first_bfd_reloc_code_real },
OPERAND_TYPE_NONE },
{ "GOT", { BFD_RELOC_386_GOT32,
BFD_RELOC_X86_64_GOT32 },
@@ -6125,7 +6125,7 @@ lex_got (enum bfd_reloc_code_real *reloc,
/* Allocate and copy string. The trailing NUL shouldn't
be necessary, but be safe. */
- tmpbuf = xmalloc (first + second + 2);
+ tmpbuf = (char *) xmalloc (first + second + 2);
memcpy (tmpbuf, input_line_pointer, first);
if (second != 0 && *past_reloc != ' ')
/* Replace the relocation token with ' ', so that
@@ -7104,7 +7104,7 @@ md_estimate_size_before_relax (fragP, segment)
int old_fr_fix;
if (fragP->fr_var != NO_RELOC)
- reloc_type = fragP->fr_var;
+ reloc_type = (enum bfd_reloc_code_real) fragP->fr_var;
else if (size == 2)
reloc_type = BFD_RELOC_16_PCREL;
else
@@ -7553,7 +7553,7 @@ parse_real_register (char *reg_string, char **end_op)
if (*s == ')')
{
*end_op = s + 1;
- r = hash_find (reg_hash, "st(0)");
+ r = (const reg_entry *) hash_find (reg_hash, "st(0)");
know (r);
return r + fpr;
}