[LLVMdev] Assign symbol the address of a section
clattner at apple.com
Mon May 11 10:24:37 PDT 2009
On May 11, 2009, at 10:02 AM, Matt Renzelmann wrote:
> The binaries produced by LLVM and other compilers divide code up into
> various sections, e.g. the .text section.
> What is the recommended approach to assigning a symbol the address
> of a
> section using LLVM? Using GCC/LD, you can do this with a linker
> e.g. in a linker script you can do:
> _text = .;
> _stext = .;
> These symbols are then available in the corresponding C code using an
> "extern" definition. But, LLVM doesn't support linker scripts--so
> the trick?
I don't know of a straight-forward way to do this. However, you can
probably use module-level inline asm to do the trick.
More information about the llvm-dev