[LLVMdev] PareAssemblyFile returning "expected top-level entity" error message

Frits van Bommel fvbommel at gmail.com
Fri Feb 4 14:22:31 PST 2011


On Fri, Feb 4, 2011 at 9:09 PM, z_alk at live.concordia.ca
<z_alk at live.concordia.ca> wrote:
> I am trying to generate a module object using something like this: (to use
> for code analysis)
>
>      Module *topModule;
>     SMDiagnostic error;
>     topModule = ParseAssemblyFile("code.s", error, getGlobalContext());
...
> and I've been getting the following output:
>
> Error File Name: code.s
> Error Message: error: expected top-level entity
> Error Line number: 1. Column number: 1
>
> code.s is generated manually using
> llvm-g++ -S code.cpp
>
> where code.cpp is just a hello world application.
>
> Any ideas as to the reason for the error ?

'llvm-g++ -S' generates machine-level asm (for example, x86 asm).
Adding '-emit-llvm' should tell it to generate LLVM asm instead.




More information about the llvm-dev mailing list