aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2011-03-06 14:05:25 +0000
committerH.J. Lu <hjl.tools@gmail.com>2011-03-06 14:05:25 +0000
commit49002d7f0e676130b2aab22ad8f2b768046a1c82 (patch)
treedce1b786773c3a2db843ac7c0922558bdc62b6e3
parente51411190f506bcea2809bf3416a3c16921fa7d8 (diff)
downloadgdb-49002d7f0e676130b2aab22ad8f2b768046a1c82.zip
gdb-49002d7f0e676130b2aab22ad8f2b768046a1c82.tar.gz
gdb-49002d7f0e676130b2aab22ad8f2b768046a1c82.tar.bz2
Mention symbol name in non-constant .size expression.
gas/ 2011-03-05 H.J. Lu <hongjiu.lu@intel.com> * config/obj-elf.c (elf_frob_symbol): Mention symbol name in non-constant .size expression. gas/testsuite/ 2011-03-05 H.J. Lu <hongjiu.lu@intel.com> * gas/elf/bad-size.err: Updated.
-rw-r--r--gas/ChangeLog5
-rw-r--r--gas/config/obj-elf.c48
-rw-r--r--gas/testsuite/ChangeLog4
-rw-r--r--gas/testsuite/gas/elf/bad-size.err2
4 files changed, 53 insertions, 6 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index f53dd03..cb5cfa6 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,8 @@
+2011-03-05 H.J. Lu <hongjiu.lu@intel.com>
+
+ * config/obj-elf.c (elf_frob_symbol): Mention symbol name in
+ non-constant .size expression.
+
2011-03-02 Nick Clifton <nickc@redhat.com>
* ecoff.c: Incldue filenames.h
diff --git a/gas/config/obj-elf.c b/gas/config/obj-elf.c
index 969a509..d43409a 100644
--- a/gas/config/obj-elf.c
+++ b/gas/config/obj-elf.c
@@ -1879,6 +1879,7 @@ void
elf_frob_symbol (symbolS *symp, int *puntp)
{
struct elf_obj_sy *sy_obj;
+ expressionS *size;
#ifdef NEED_ECOFF_DEBUG
if (ECOFF_DEBUGGING)
@@ -1887,13 +1888,50 @@ elf_frob_symbol (symbolS *symp, int *puntp)
sy_obj = symbol_get_obj (symp);
- if (sy_obj->size != NULL)
+ size = sy_obj->size;
+ if (size != NULL)
{
- if (resolve_expression (sy_obj->size)
- && sy_obj->size->X_op == O_constant)
- S_SET_SIZE (symp, sy_obj->size->X_add_number);
+ if (resolve_expression (size)
+ && size->X_op == O_constant)
+ S_SET_SIZE (symp, size->X_add_number);
else
- as_bad (_(".size expression does not evaluate to a constant"));
+ {
+ const char *op_name = NULL;
+ const char *add_name = NULL;
+
+ 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_bad (_(".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_bad (_(".size expression with symbol `%s' "
+ "does not evaluate to a constant"), name);
+ }
+ }
+
+ if (!op_name && !add_name)
+ as_bad (_(".size expression does not evaluate to a constant"));
+ }
free (sy_obj->size);
sy_obj->size = NULL;
}
diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog
index c4fbd0a..da5243e 100644
--- a/gas/testsuite/ChangeLog
+++ b/gas/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2011-03-05 H.J. Lu <hongjiu.lu@intel.com>
+
+ * gas/elf/bad-size.err: Updated.
+
2011-02-28 Maciej W. Rozycki <macro@codesourcery.com>
* gas/mips/alnv_ps-swap.d: New test for ALNV.PS instruction
diff --git a/gas/testsuite/gas/elf/bad-size.err b/gas/testsuite/gas/elf/bad-size.err
index 5e01ef2..a5bfc31 100644
--- a/gas/testsuite/gas/elf/bad-size.err
+++ b/gas/testsuite/gas/elf/bad-size.err
@@ -1,2 +1,2 @@
.*bad-size\.s: Assembler messages:
-.*bad-size\.s:6: Error: .*
+.*bad-size\.s:6: Error:.*`_test_nop'.*