[llvm-dev] Asm Parser vars extraction

Pietro D'Ettole via llvm-dev llvm-dev at lists.llvm.org
Mon Feb 8 15:03:10 PST 2021


Hi Brian, thanks for your reply.

My goal is to be able to extract from an assembly file (i.e. source
compiled to assembly, directly) the static global vars declared in the
source. So far I haven't found any API in the llvm asm parser to serve my
purpose. Do you know if/ how I can accomplish that?

Thank you.


Il giorno sabato 6 febbraio 2021, Brian Cain <brian.cain at gmail.com> ha
scritto:

> You need to extract it from the source?  Is it possible to use the
> resulting object file instead?
>
> Note that there's no way to get an 'address' but you can get a section
> offset. The section offset for both code and data are available in the
> object file and from the assembler as it writes the object file.
>
> The contents of the assembly file - instructions and directives -
> contribute to the resulting layout.  The AsmParser can find tokens and
> build instructions but shouldn't know how it will get layed out.
>
> On Sat, Feb 6, 2021, 3:16 AM Pietro D'Ettole via llvm-dev <
> llvm-dev at lists.llvm.org> wrote:
>
>> Hi all,
>>
>> I'm a little bit stuck in code reading right now. Maybe some of you can
>> help me to understand fast if what I need is feasible or not.
>> I was trying to understand if currently asm parser in llvm allows to
>> easily extract from an asm file variable names alongside with their values
>> and their addresses.
>>
>> Thanks for the help!
>> _______________________________________________
>> LLVM Developers mailing list
>> llvm-dev at lists.llvm.org
>> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20210209/b03fc1b1/attachment.html>


More information about the llvm-dev mailing list