[llvm-commits] LLVM, llvm-mc, AsmParser] .weak_reference doesn't allows local names ('L' prefix)

Jim Grosbach grosbach at apple.com
Tue Sep 13 13:06:04 PDT 2011


Hi Stepan,

While it does seem odd to allow those symbols in the directives, is it really an error? Darwin's system assembler doesn't generate diagnostics for any of them when used with an assembler temporary.

$ cat x.s
.weak_reference Lfoo
.lazy_reference Lfoo
.weak_definition Lfoo
Lfoo:
$ as -arch x86_64 x.s -o x.o
$

Assuming we do want a diagnostic, should any of those directives allow assembler local names? That is, does ParseDirectiveSymbolAttribute() really need the new parameter, or should the diagnostic just be unconditional?

On a trivial style note, there's no need for the compound statement braces when there's only one line associated with the 'if' statement like this:
+      if (!AllowTemporary && Sym->isTemporary()) {
+        return TokError("Local symbol is used in context where only global symbol expected.");
+      }

Regards,
  Jim

On Sep 13, 2011, at 12:50 PM, Stepan Dyatkovskiy wrote:

> Hi, everybody.
> I found that next Apple Asm symbol directives should not allow symbols with local names:
> reference
> weak_reference
> lazy_reference
> weak_definition.
> When we parse this ones we should report error. 
> 
> Please find for review patch that adds error messages for cases described above.
> 
> -- 
> Regards,
> Stepan<undefined_symbols_fix.patch>_______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits




More information about the llvm-commits mailing list