* read.c (get_absolute_expr): New, split out from..
(get_absolute_expression): ..here. * read.h (get_absolute_expr): Declare. * config/obj-elf.c (elf_common): Use offsetT for "temp" and "size". Trim size to arch bits_per_address, and test for negative input via get_absolute_expr.
This commit is contained in:
parent
1fb309eaa6
commit
a0ea3e1db8
4 changed files with 40 additions and 19 deletions
|
@ -1,3 +1,12 @@
|
|||
2003-01-11 Alan Modra <amodra@bigpond.net.au>
|
||||
|
||||
* read.c (get_absolute_expr): New, split out from..
|
||||
(get_absolute_expression): ..here.
|
||||
* read.h (get_absolute_expr): Declare.
|
||||
* config/obj-elf.c (elf_common): Use offsetT for "temp" and "size".
|
||||
Trim size to arch bits_per_address, and test for negative input
|
||||
via get_absolute_expr.
|
||||
|
||||
2003-01-07 DJ Delorie <dj@redhat.com>
|
||||
|
||||
* config/tc-xstormy16.c (md_cgen_lookup_reloc): Adjust value based
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* ELF object file format
|
||||
Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
|
||||
2001, 2002 Free Software Foundation, Inc.
|
||||
2001, 2002, 2003 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GAS, the GNU Assembler.
|
||||
|
||||
|
@ -290,9 +290,10 @@ elf_common (is_common)
|
|||
char *name;
|
||||
char c;
|
||||
char *p;
|
||||
int temp, size;
|
||||
offsetT temp, size, sign;
|
||||
symbolS *symbolP;
|
||||
int have_align;
|
||||
expressionS exp;
|
||||
|
||||
if (flag_mri && is_common)
|
||||
{
|
||||
|
@ -313,13 +314,15 @@ elf_common (is_common)
|
|||
return NULL;
|
||||
}
|
||||
input_line_pointer++; /* skip ',' */
|
||||
if ((temp = get_absolute_expression ()) < 0)
|
||||
temp = get_absolute_expr (&exp);
|
||||
sign = (offsetT) 1 << (stdoutput->arch_info->bits_per_address - 1);
|
||||
size = temp & ((sign << 1) - 1);
|
||||
if (temp != size || !exp.X_unsigned)
|
||||
{
|
||||
as_bad (_(".COMMon length (%d.) <0! Ignored."), temp);
|
||||
as_bad (_(".COMMon length (%ld) out of range, ignored."), (long) temp);
|
||||
ignore_rest_of_line ();
|
||||
return NULL;
|
||||
}
|
||||
size = temp;
|
||||
*p = 0;
|
||||
symbolP = symbol_find_or_make (name);
|
||||
*p = c;
|
||||
|
@ -333,8 +336,9 @@ elf_common (is_common)
|
|||
{
|
||||
if (S_GET_VALUE (symbolP) != (valueT) size)
|
||||
{
|
||||
as_warn (_("length of .comm \"%s\" is already %ld; not changed to %d"),
|
||||
S_GET_NAME (symbolP), (long) S_GET_VALUE (symbolP), size);
|
||||
as_warn (_("length of .comm \"%s\" is already %ld; not changed to %ld"),
|
||||
S_GET_NAME (symbolP), (long) S_GET_VALUE (symbolP),
|
||||
(long) size);
|
||||
}
|
||||
}
|
||||
know (symbolP->sy_frag == &zero_address_frag);
|
||||
|
@ -352,8 +356,8 @@ elf_common (is_common)
|
|||
temp = 0;
|
||||
else
|
||||
{
|
||||
temp = get_absolute_expression ();
|
||||
if (temp < 0)
|
||||
temp = get_absolute_expr (&exp);
|
||||
if (!exp.X_unsigned)
|
||||
{
|
||||
temp = 0;
|
||||
as_warn (_("common alignment negative; 0 assumed"));
|
||||
|
|
25
gas/read.c
25
gas/read.c
|
@ -1,6 +1,6 @@
|
|||
/* read.c - read a source file -
|
||||
Copyright 1986, 1987, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997,
|
||||
1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
|
||||
1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GAS, the GNU Assembler.
|
||||
|
||||
|
@ -4801,19 +4801,26 @@ get_known_segmented_expression (expP)
|
|||
return (retval);
|
||||
}
|
||||
|
||||
offsetT
|
||||
get_absolute_expr (exp)
|
||||
expressionS *exp;
|
||||
{
|
||||
expression (exp);
|
||||
if (exp->X_op != O_constant)
|
||||
{
|
||||
if (exp->X_op != O_absent)
|
||||
as_bad (_("bad or irreducible absolute expression"));
|
||||
exp->X_add_number = 0;
|
||||
}
|
||||
return exp->X_add_number;
|
||||
}
|
||||
|
||||
offsetT
|
||||
get_absolute_expression ()
|
||||
{
|
||||
expressionS exp;
|
||||
|
||||
expression (&exp);
|
||||
if (exp.X_op != O_constant)
|
||||
{
|
||||
if (exp.X_op != O_absent)
|
||||
as_bad (_("bad or irreducible absolute expression"));
|
||||
exp.X_add_number = 0;
|
||||
}
|
||||
return exp.X_add_number;
|
||||
return get_absolute_expr (&exp);
|
||||
}
|
||||
|
||||
char /* Return terminator. */
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* read.h - of read.c
|
||||
Copyright 1986, 1990, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
|
||||
2000
|
||||
2000, 2001, 2002, 2003
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GAS, the GNU Assembler.
|
||||
|
@ -105,6 +105,7 @@ extern void aout_process_stab PARAMS ((int, const char *, int, int, int));
|
|||
extern char *demand_copy_C_string PARAMS ((int *len_pointer));
|
||||
extern char get_absolute_expression_and_terminator
|
||||
PARAMS ((long *val_pointer));
|
||||
extern offsetT get_absolute_expr PARAMS ((expressionS *));
|
||||
extern offsetT get_absolute_expression PARAMS ((void));
|
||||
extern unsigned int next_char_of_string PARAMS ((void));
|
||||
extern void s_mri_sect PARAMS ((char *));
|
||||
|
|
Loading…
Reference in a new issue