This is an archive of the discontinued LLVM Phabricator instance.

Fix .thumb_func directive in ARMAsmParser
ClosedPublic

Authored by enefaim on Oct 25 2013, 2:50 AM.

Details

Summary

This patch is intended to solve the following FIXME in ARMAsmParser::parseDirectiveThumbFunc:

// FIXME: assuming function name will be the line following .thumb_func
// We really should be checking the next symbol definition even if there's
// stuff in between.

I didn't add any new test just modified the existing one by moving the .type directive between the .thumb_func directive
and the actual symbol (you can check it in the diff). This is how GCC places the directives (at least it did it for me when
I compiled a simple "Hello world!" C program to assembly code).

Diff Detail

Event Timeline

Hi Gabor,

Thanks for doing this. One tiny comment, but other than that it looks fine. Feel free to commit with that change.

Cheers.

Tim.

lib/Target/ARM/AsmParser/ARMAsmParser.cpp
77

Very minor point: variable names should start with a capital letter in LLVM.

t.p.northover accepted this revision.Oct 25 2013, 5:54 AM

Gabor sent me an updated patch, which I've committed as r193403.

t.p.northover closed this revision.Oct 25 2013, 5:54 AM
rengolin added inline comments.Oct 25 2013, 6:10 AM
lib/Target/ARM/AsmParser/ARMAsmParser.cpp
7848

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.

7868

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?

I only realized now that if I add comments inline I still *have* to press
"clowcopterize" (whatever that means).

GitHub is so much better than this...

cheers,
--renato