[LLVMdev] Problem of ELF section attribute

Haifeng He hehaifeng2nd at gmail.com
Wed Feb 13 01:10:16 PST 2008


Hi,

I am having problem of using LLVM on a program which contains
customized code section.
In addition to ".text" section for keeping code, the program has
another code section, called ".init.text".
The functions in this section are defined as
   "int foo (int, int) __attribute__ ((section (".init.text")));"

If I compile the program with gcc, this section(".init.text") will
have attributes of "AX" (means allocate space and
executable). However, if I first compile the program into llvm IR,
then convert IR to native assembly code using
llc, this section will not have "AX" attribute. This causes the native
executable fails when it tries to call a function
in .init.text section. Any suggestion? (btw, my platform is Linux
running on x86 machine.)

Thank you

Haifeng



More information about the llvm-dev mailing list