[LLVMdev] Assign symbol the address of a section

Matt Renzelmann mjr at cs.wisc.edu
Mon May 11 10:02:08 PDT 2009


Hello,

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 script,
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 what's
the trick?

Thanks and regards,
Matt




More information about the llvm-dev mailing list