This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] bug 5543: do not allow register symbols to be global


Hi H.J.,

We get into trouble only when we try to use bar3. This patch catches
all cases. But it doesn't report the correct line number.

I think that we should make an attempt to report the correct line number. If there was code in read.c:s_global() for instance you could catch the 'bar2' example in your testcase.



+void
+elf_obj_validate_symbol_value (symbolS *symbolP)
+{
+  if (!IS_ELF)
+    return;
+
+  if (symbolP->bsym->section == reg_section)
+    {
+      const char *name = S_GET_NAME (symbolP);
+
+      /* Report error only if we know the symbol name.  */
+      if (name != reg_section->name)
+	as_bad (_("Invalid value for symbol `%s'"), name);
+    }
+}

I think that it would be better if this function did not emit an error message but just instead returned a boolean saying whether the symbol was valid or not. Then the caller the choose how to report the problem to the user, if it needs reporting at all.


Cheers
  Nick


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]