PATCH: Add --size-check=[error|warning]
Alan Modra
amodra@gmail.com
Fri Mar 18 11:20:00 GMT 2011
On Thu, Mar 17, 2011 at 10:26:06AM +1030, Alan Modra wrote:
> Oh, another thing that just occurred to me: Reporting the .size
> expression symbols is likely not as useful as reporting the function
> symbol, and it's actually a lot easier to report the function..
Like this.
* config/obj-elf.c (elf_frob_symbol): Report S_SET_SIZE symbol
on .size expression errors rather than ones in the size expression.
Index: gas/config/obj-elf.c
===================================================================
RCS file: /cvs/src/src/gas/config/obj-elf.c,v
retrieving revision 1.139
diff -u -p -r1.139 obj-elf.c
--- gas/config/obj-elf.c 16 Mar 2011 12:58:26 -0000 1.139
+++ gas/config/obj-elf.c 18 Mar 2011 02:50:30 -0000
@@ -1896,49 +1901,12 @@ elf_frob_symbol (symbolS *symp, int *pun
S_SET_SIZE (symp, size->X_add_number);
else
{
- const char *op_name = NULL;
- const char *add_name = NULL;
- PRINTF_LIKE ((*as_error));
-
if (flag_size_check == size_check_error)
- as_error = as_bad;
+ as_bad (_(".size expression for %s "
+ "does not evaluate to a constant"), S_GET_NAME (symp));
else
- as_error = as_warn;
-
- if (size->X_op == O_subtract)
- {
- op_name = S_GET_NAME (size->X_op_symbol);
- add_name = S_GET_NAME (size->X_add_symbol);
- if (strcmp (op_name, FAKE_LABEL_NAME) == 0)
- op_name = NULL;
- if (strcmp (add_name, FAKE_LABEL_NAME) == 0)
- add_name = NULL;
-
- if (op_name && add_name)
- as_error (_(".size expression with symbols `%s' and "
- "`%s' does not evaluate to a constant"),
- op_name, add_name);
- else
- {
- const char *name;
-
- if (op_name)
- name = op_name;
- else if (add_name)
- name = add_name;
- else
- name = NULL;
-
- if (name)
- as_error (_(".size expression with symbol `%s' "
- "does not evaluate to a constant"),
- name);
- }
- }
-
- if (!op_name && !add_name)
- as_error (_(".size expression does not evaluate to a "
- "constant"));
+ as_warn (_(".size expression for %s "
+ "does not evaluate to a constant"), S_GET_NAME (symp));
}
free (sy_obj->size);
sy_obj->size = NULL;
--
Alan Modra
Australia Development Lab, IBM
More information about the Binutils
mailing list