[LLVMdev] Adding support to LLVM for data & code layout (needed by GHC)

David Terei davidterei at gmail.com
Thu Jun 17 10:25:41 PDT 2010


On 15 June 2010 23:08, Eugene Toder <eltoder at gmail.com> wrote:
> Subsections is a very good idea. You can even do without
> post-processing by using carefully crafted section names, e.g.
>
> __attribute__((section(".text,\"ax\", at progbits\n\t.subsection 1 #")))
> void foo()
> {
> }

There is one problem with the section name used here, 'llvm-as'
doesn't support it. LLVM itself does, so if you compile the above with
clang then it works fine. If you try to use that section name in a .ll
file and call one of the tools it fails as the parser doesn't support
escaping quotes. It also doesn't support interpreting '\n' as a new
line and outputs each character into the assembly file. Anyway you can
get around this by using a section name like:

".text;.subsection 1 #"

instead. If your using the LLVM API then this isn't a problem.

David



More information about the llvm-dev mailing list