projects
/
deliverable
/
binutils-gdb.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[ARC] Add XY registers, update neg instruction.
[deliverable/binutils-gdb.git]
/
gas
/
config
/
obj-coff.c
diff --git
a/gas/config/obj-coff.c
b/gas/config/obj-coff.c
index d0a4999be9c0e3b1b078d9d2aabe38a3df97b4c3..b3bafeeba3a10a1386e7b83fd48aa1425e878065 100644
(file)
--- a/
gas/config/obj-coff.c
+++ b/
gas/config/obj-coff.c
@@
-1,7
+1,5
@@
/* coff object file format
/* coff object file format
- Copyright 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
- 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010
- Free Software Foundation, Inc.
+ Copyright (C) 1989-2016 Free Software Foundation, Inc.
This file is part of GAS.
This file is part of GAS.
@@
-24,13
+22,17
@@
#include "as.h"
#include "safe-ctype.h"
#include "as.h"
#include "safe-ctype.h"
-#include "obstack.h"
#include "subsegs.h"
#include "subsegs.h"
+#include "struc-symbol.h"
#ifdef TE_PE
#include "coff/pe.h"
#endif
#ifdef TE_PE
#include "coff/pe.h"
#endif
+#ifdef OBJ_XCOFF
+#include "coff/xcoff.h"
+#endif
+
#define streq(a,b) (strcmp ((a), (b)) == 0)
#define strneq(a,b,n) (strncmp ((a), (b), (n)) == 0)
#define streq(a,b) (strcmp ((a), (b)) == 0)
#define strneq(a,b,n) (strncmp ((a), (b), (n)) == 0)
@@
-75,10
+77,8
@@
stack_init (unsigned long chunk_size,
{
stack *st;
{
stack *st;
- st = malloc (sizeof (* st));
- if (!st)
- return NULL;
- st->data = malloc (chunk_size);
+ st = XNEW (stack);
+ st->data = XNEWVEC (char, chunk_size);
if (!st->data)
{
free (st);
if (!st->data)
{
free (st);
@@
-97,8
+97,7
@@
stack_push (stack *st, char *element)
if (st->pointer + st->element_size >= st->size)
{
st->size += st->chunk_size;
if (st->pointer + st->element_size >= st->size)
{
st->size += st->chunk_size;
- if ((st->data = xrealloc (st->data, st->size)) == NULL)
- return NULL;
+ st->data = XRESIZEVEC (char, st->data, st->size);
}
memcpy (st->data + st->pointer, element, st->element_size);
st->pointer += st->element_size;
}
memcpy (st->data + st->pointer, element, st->element_size);
st->pointer += st->element_size;
@@
-381,10
+380,11
@@
void
coff_obj_symbol_new_hook (symbolS *symbolP)
{
long sz = (OBJ_COFF_MAX_AUXENTRIES + 1) * sizeof (combined_entry_type);
coff_obj_symbol_new_hook (symbolS *symbolP)
{
long sz = (OBJ_COFF_MAX_AUXENTRIES + 1) * sizeof (combined_entry_type);
- char * s =
xmalloc (
sz);
+ char * s =
XNEWVEC (char,
sz);
memset (s, 0, sz);
coffsymbol (symbol_get_bfdsym (symbolP))->native = (combined_entry_type *) s;
memset (s, 0, sz);
coffsymbol (symbol_get_bfdsym (symbolP))->native = (combined_entry_type *) s;
+ coffsymbol (symbol_get_bfdsym (symbolP))->native->is_sym = TRUE;
S_SET_DATA_TYPE (symbolP, T_NULL);
S_SET_STORAGE_CLASS (symbolP, 0);
S_SET_DATA_TYPE (symbolP, T_NULL);
S_SET_STORAGE_CLASS (symbolP, 0);
@@
-400,10
+400,11
@@
coff_obj_symbol_new_hook (symbolS *symbolP)
void
coff_obj_symbol_clone_hook (symbolS *newsymP, symbolS *orgsymP)
{
void
coff_obj_symbol_clone_hook (symbolS *newsymP, symbolS *orgsymP)
{
- long
sz = (OBJ_COFF_MAX_AUXENTRIES + 1) * sizeof (combined_entry_type)
;
- combined_entry_type * s =
xmalloc (sz
);
+ long
elts = OBJ_COFF_MAX_AUXENTRIES + 1
;
+ combined_entry_type * s =
XNEWVEC (combined_entry_type, elts
);
- memcpy (s, coffsymbol (symbol_get_bfdsym (orgsymP))->native, sz);
+ memcpy (s, coffsymbol (symbol_get_bfdsym (orgsymP))->native,
+ elts * sizeof (combined_entry_type));
coffsymbol (symbol_get_bfdsym (newsymP))->native = s;
SF_SET (newsymP, SF_GET (orgsymP));
coffsymbol (symbol_get_bfdsym (newsymP))->native = s;
SF_SET (newsymP, SF_GET (orgsymP));
@@
-420,7
+421,7
@@
int coff_n_line_nos;
static void
add_lineno (fragS * frag, addressT offset, int num)
{
static void
add_lineno (fragS * frag, addressT offset, int num)
{
- struct line_no * new_line =
xmalloc (sizeof (* new_line)
);
+ struct line_no * new_line =
XNEW (struct line_no
);
if (!current_lineno_sym)
abort ();
if (!current_lineno_sym)
abort ();
@@
-589,7
+590,6
@@
obj_coff_def (int what ATTRIBUTE_UNUSED)
char name_end; /* Char after the end of name. */
char *symbol_name; /* Name of the debug symbol. */
char *symbol_name_copy; /* Temporary copy of the name. */
char name_end; /* Char after the end of name. */
char *symbol_name; /* Name of the debug symbol. */
char *symbol_name_copy; /* Temporary copy of the name. */
- unsigned int symbol_name_length;
if (def_symbol_in_progress != NULL)
{
if (def_symbol_in_progress != NULL)
{
@@
-600,11
+600,8
@@
obj_coff_def (int what ATTRIBUTE_UNUSED)
SKIP_WHITESPACES ();
SKIP_WHITESPACES ();
- symbol_name = input_line_pointer;
- name_end = get_symbol_end ();
- symbol_name_length = strlen (symbol_name);
- symbol_name_copy = xmalloc (symbol_name_length + 1);
- strcpy (symbol_name_copy, symbol_name);
+ name_end = get_symbol_name (&symbol_name);
+ symbol_name_copy = xstrdup (symbol_name);
#ifdef tc_canonicalize_symbol_name
symbol_name_copy = tc_canonicalize_symbol_name (symbol_name_copy);
#endif
#ifdef tc_canonicalize_symbol_name
symbol_name_copy = tc_canonicalize_symbol_name (symbol_name_copy);
#endif
@@
-617,7
+614,7
@@
obj_coff_def (int what ATTRIBUTE_UNUSED)
if (S_IS_STRING (def_symbol_in_progress))
SF_SET_STRING (def_symbol_in_progress);
if (S_IS_STRING (def_symbol_in_progress))
SF_SET_STRING (def_symbol_in_progress);
-
*input_line_pointer = name_end
;
+
(void) restore_line_pointer (name_end)
;
demand_empty_rest_of_line ();
}
demand_empty_rest_of_line ();
}
@@
-970,8
+967,7
@@
obj_coff_tag (int ignore ATTRIBUTE_UNUSED)
}
S_SET_NUMBER_AUXILIARY (def_symbol_in_progress, 1);
}
S_SET_NUMBER_AUXILIARY (def_symbol_in_progress, 1);
- symbol_name = input_line_pointer;
- name_end = get_symbol_end ();
+ name_end = get_symbol_name (&symbol_name);
#ifdef tc_canonicalize_symbol_name
symbol_name = tc_canonicalize_symbol_name (symbol_name);
#ifdef tc_canonicalize_symbol_name
symbol_name = tc_canonicalize_symbol_name (symbol_name);
@@
-985,8
+981,8
@@
obj_coff_tag (int ignore ATTRIBUTE_UNUSED)
as_warn (_("tag not found for .tag %s"), symbol_name);
SF_SET_TAGGED (def_symbol_in_progress);
as_warn (_("tag not found for .tag %s"), symbol_name);
SF_SET_TAGGED (def_symbol_in_progress);
- *input_line_pointer = name_end;
+ (void) restore_line_pointer (name_end);
demand_empty_rest_of_line ();
}
demand_empty_rest_of_line ();
}
@@
-1021,11
+1017,11
@@
obj_coff_val (int ignore ATTRIBUTE_UNUSED)
if (is_name_beginner (*input_line_pointer))
{
if (is_name_beginner (*input_line_pointer))
{
- char *symbol_name
= input_line_pointer
;
- char name_end = get_symbol_
end (
);
+ char *symbol_name;
+ char name_end = get_symbol_
name (&symbol_name
);
#ifdef tc_canonicalize_symbol_name
#ifdef tc_canonicalize_symbol_name
- symbol_name = tc_canonicalize_symbol_name (symbol_name);
+
symbol_name = tc_canonicalize_symbol_name (symbol_name);
#endif
if (streq (symbol_name, "."))
{
#endif
if (streq (symbol_name, "."))
{
@@
-1056,7
+1052,7
@@
obj_coff_val (int ignore ATTRIBUTE_UNUSED)
}
/* Otherwise, it is the name of a non debug symbol and its value
will be calculated later. */
}
/* Otherwise, it is the name of a non debug symbol and its value
will be calculated later. */
-
*input_line_pointer = name_end
;
+
(void) restore_line_pointer (name_end)
;
}
else
{
}
else
{
@@
-1082,11
+1078,7
@@
weak_is_altname (const char * name)
static const char *
weak_name2altname (const char * name)
{
static const char *
weak_name2altname (const char * name)
{
- char *alt_name;
-
- alt_name = xmalloc (sizeof (weak_altprefix) + strlen (name));
- strcpy (alt_name, weak_altprefix);
- return strcat (alt_name, name);
+ return concat (weak_altprefix, name, (char *) NULL);
}
/* Return the name of the weak symbol corresponding to an
}
/* Return the name of the weak symbol corresponding to an
@@
-1095,15
+1087,8
@@
weak_name2altname (const char * name)
static const char *
weak_altname2name (const char * name)
{
static const char *
weak_altname2name (const char * name)
{
- char * weak_name;
- char * dot;
-
gas_assert (weak_is_altname (name));
gas_assert (weak_is_altname (name));
-
- weak_name = xstrdup (name + 6);
- if ((dot = strchr (weak_name, '.')))
- *dot = 0;
- return weak_name;
+ return xstrdup (name + 6);
}
/* Make a weak symbol name unique by
}
/* Make a weak symbol name unique by
@@
-1112,7
+1097,6
@@
weak_altname2name (const char * name)
static const char *
weak_uniquify (const char * name)
{
static const char *
weak_uniquify (const char * name)
{
- char *ret;
const char * unique = "";
#ifdef TE_PE
const char * unique = "";
#ifdef TE_PE
@@
-1121,14
+1105,7
@@
weak_uniquify (const char * name)
#endif
gas_assert (weak_is_altname (name));
#endif
gas_assert (weak_is_altname (name));
- if (strchr (name + sizeof (weak_altprefix), '.'))
- return name;
-
- ret = xmalloc (strlen (name) + strlen (unique) + 2);
- strcpy (ret, name);
- strcat (ret, ".");
- strcat (ret, unique);
- return ret;
+ return concat (name, ".", unique, (char *) NULL);
}
void
}
void
@@
-1177,8
+1154,7
@@
obj_coff_weak (int ignore ATTRIBUTE_UNUSED)
do
{
do
{
- name = input_line_pointer;
- c = get_symbol_end ();
+ c = get_symbol_name (&name);
if (*name == 0)
{
as_warn (_("badly formed .weak directive ignored"));
if (*name == 0)
{
as_warn (_("badly formed .weak directive ignored"));
@@
-1188,7
+1164,7
@@
obj_coff_weak (int ignore ATTRIBUTE_UNUSED)
c = 0;
symbolP = symbol_find_or_make (name);
*input_line_pointer = c;
c = 0;
symbolP = symbol_find_or_make (name);
*input_line_pointer = c;
- SKIP_WHITESPACE ();
+ SKIP_WHITESPACE
_AFTER_NAME
();
S_SET_WEAK (symbolP);
if (c == ',')
S_SET_WEAK (symbolP);
if (c == ',')
@@
-1365,7
+1341,8
@@
coff_frob_symbol (symbolS *symp, int *punt)
}
}
}
}
- if (coff_last_function == 0 && SF_GET_FUNCTION (symp))
+ if (coff_last_function == 0 && SF_GET_FUNCTION (symp)
+ && S_IS_DEFINED (symp))
{
union internal_auxent *auxp;
{
union internal_auxent *auxp;
@@
-1377,7
+1354,8
@@
coff_frob_symbol (symbolS *symp, int *punt)
sizeof (auxp->x_sym.x_fcnary.x_ary.x_dimen));
}
sizeof (auxp->x_sym.x_fcnary.x_ary.x_dimen));
}
- if (S_GET_STORAGE_CLASS (symp) == C_EFCN)
+ if (S_GET_STORAGE_CLASS (symp) == C_EFCN
+ && S_IS_DEFINED (symp))
{
if (coff_last_function == 0)
as_fatal (_("C_EFCN symbol for %s out of scope"),
{
if (coff_last_function == 0)
as_fatal (_("C_EFCN symbol for %s out of scope"),
@@
-1463,7
+1441,7
@@
coff_frob_symbol (symbolS *symp, int *punt)
/* We need i entries for line numbers, plus 1 for the first
entry which BFD will override, plus 1 for the last zero
entry (a marker for BFD). */
/* We need i entries for line numbers, plus 1 for the first
entry which BFD will override, plus 1 for the last zero
entry (a marker for BFD). */
- l =
xmalloc ((i + 2) * sizeof (* l
));
+ l =
XNEWVEC (alent, (i + 2
));
coffsymbol (symbol_get_bfdsym (symp))->lineno = l;
l[i + 1].line_number = 0;
l[i + 1].u.sym = NULL;
coffsymbol (symbol_get_bfdsym (symp))->lineno = l;
l[i + 1].line_number = 0;
l[i + 1].u.sym = NULL;
@@
-1537,6
+1515,7
@@
coff_frob_file_after_relocs (void)
'o' for over
'w' for data
'd' (apparently m88k for data)
'o' for over
'w' for data
'd' (apparently m88k for data)
+ 'e' for exclude
'x' for text
'r' for read-only data
's' for shared data (PE)
'x' for text
'r' for read-only data
's' for shared data (PE)
@@
-1568,15
+1547,10
@@
obj_coff_section (int ignore ATTRIBUTE_UNUSED)
return;
}
return;
}
- section_name = input_line_pointer;
- c = get_symbol_end ();
-
- name = xmalloc (input_line_pointer - section_name + 1);
- strcpy (name, section_name);
-
+ c = get_symbol_name (§ion_name);
+ name = xmemdup0 (section_name, input_line_pointer - section_name);
*input_line_pointer = c;
*input_line_pointer = c;
-
- SKIP_WHITESPACE ();
+ SKIP_WHITESPACE_AFTER_NAME ();
exp = 0;
flags = SEC_NO_FLAGS;
exp = 0;
flags = SEC_NO_FLAGS;
@@
-1604,6
+1578,11
@@
obj_coff_section (int ignore ATTRIBUTE_UNUSED)
}
switch (attr)
{
}
switch (attr)
{
+ case 'e':
+ /* Exclude section from linking. */
+ flags |= SEC_EXCLUDE;
+ break;
+
case 'b':
/* Uninitialised data section. */
flags |= SEC_ALLOC;
case 'b':
/* Uninitialised data section. */
flags |= SEC_ALLOC;
@@
-1678,6
+1657,7
@@
obj_coff_section (int ignore ATTRIBUTE_UNUSED)
}
sec = subseg_new (name, (subsegT) exp);
}
sec = subseg_new (name, (subsegT) exp);
+
if (alignment >= 0)
sec->alignment_power = alignment;
if (alignment >= 0)
sec->alignment_power = alignment;
@@
-1772,8
+1752,13
@@
coff_frob_section (segT sec)
#endif
{
symbolS *secsym = section_symbol (sec);
#endif
{
symbolS *secsym = section_symbol (sec);
+ unsigned char sclass = C_STAT;
- S_SET_STORAGE_CLASS (secsym, C_STAT);
+#ifdef OBJ_XCOFF
+ if (bfd_get_section_flags (stdoutput, sec) & SEC_DEBUGGING)
+ sclass = C_DWARF;
+#endif
+ S_SET_STORAGE_CLASS (secsym, sclass);
S_SET_NUMBER_AUXILIARY (secsym, 1);
SF_SET_STATICS (secsym);
SA_SET_SCN_SCNLEN (secsym, size);
S_SET_NUMBER_AUXILIARY (secsym, 1);
SF_SET_STATICS (secsym);
SA_SET_SCN_SCNLEN (secsym, size);
@@
-1810,7
+1795,7
@@
coff_frob_section (segT sec)
void
obj_coff_init_stab_section (segT seg)
{
void
obj_coff_init_stab_section (segT seg)
{
- char *file;
+ c
onst c
har *file;
char *p;
char *stabstr_name;
unsigned int stroff;
char *p;
char *stabstr_name;
unsigned int stroff;
@@
-1819,10
+1804,8
@@
obj_coff_init_stab_section (segT seg)
p = frag_more (12);
/* Zero it out. */
memset (p, 0, 12);
p = frag_more (12);
/* Zero it out. */
memset (p, 0, 12);
- as_where (&file, (unsigned int *) NULL);
- stabstr_name = xmalloc (strlen (seg->name) + 4);
- strcpy (stabstr_name, seg->name);
- strcat (stabstr_name, "str");
+ file = as_where ((unsigned int *) NULL);
+ stabstr_name = concat (seg->name, "str", (char *) NULL);
stroff = get_stab_string_offset (file, stabstr_name);
know (stroff == 1);
md_number_to_chars (p, stroff, 4);
stroff = get_stab_string_offset (file, stabstr_name);
know (stroff == 1);
md_number_to_chars (p, stroff, 4);
@@
-1943,5
+1926,6
@@
const struct format_ops coff_format_ops =
0, /* ecoff_set_ext */
coff_obj_read_begin_hook,
coff_obj_symbol_new_hook,
0, /* ecoff_set_ext */
coff_obj_read_begin_hook,
coff_obj_symbol_new_hook,
- coff_obj_symbol_clone_hook
+ coff_obj_symbol_clone_hook,
+ coff_adjust_symtab
};
};
This page took
0.042821 seconds
and
4
git commands to generate.