[PATCH] Fix .thumb_func directive in ARMAsmParser

Renato Golin renato.golin at linaro.org
Fri Oct 25 06:10:41 PDT 2013



================
Comment at: lib/Target/ARM/AsmParser/ARMAsmParser.cpp:7848
@@ +7847,3 @@
+  if (nextSymbolIsThumb) {
+    getParser().getStreamer().EmitThumbFunc(Symbol);
+    nextSymbolIsThumb = false;
----------------
onLabelParsed() is a generic function, and you're assuming that it'll always be used to emit thumb function symbols. If you want to make sure it's only used for that, either call it emitLazyThumbFunc() or something like that, or add a check/switch/assert to this function to make sure you only use it when intended.

================
Comment at: lib/Target/ARM/AsmParser/ARMAsmParser.cpp:7868
@@ -7856,1 +7867,3 @@
+          getParser().getContext().GetOrCreateSymbol(Tok.getIdentifier());
+      getParser().getStreamer().EmitThumbFunc(Func);
       Parser.Lex(); // Consume the identifier token.
----------------
Now, both MachO and ELF look identical, and the code that deals with both also look to be doing the exact same thing, but in different ways.

I like the idea of a lazy ThumbFunc emitter, so you can personalize object / assembly files differently. Can you remove this part of the code and make sure your lazy function is called on all needs, assembly, ELF, MachO, etc?


http://llvm-reviews.chandlerc.com/D2023



More information about the llvm-commits mailing list