This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Moving C++ code to a different ELF section
- From: Saul Tamari <stamari at gmail dot com>
- To: gcc-help at gcc dot gnu dot org
- Date: Wed, 19 Feb 2014 08:57:40 -0500
- Subject: Moving C++ code to a different ELF section
- Authentication-results: sourceware.org; auth=none
Hi,
I'm trying to move some C++ code to a different ELF section and am
facing some errors which I don't understand. I'm using g++ v4.8.1 on
x86.
When compiling the following code I'm getting these errors:
/tmp/ccpp2AkE.s: Assembler messages:
/tmp/ccpp2AkE.s:63: Error: CFI instruction used without previous .cfi_startproc
/tmp/ccpp2AkE.s:64: Error: CFI instruction used without previous .cfi_startproc
/tmp/ccpp2AkE.s:66: Error: .cfi_endproc without corresponding .cfi_startproc
/tmp/ccpp2AkE.s: Error: open CFI at the end of file; missing
.cfi_endproc directive
The source is:
#include <iostream>
#include <stdlib.h>
int qqq;
int main(int argc, char* argv[])
{
std::cout << "hey " << std::endl;
qqq = rand();
if (qqq > 0x1000000) {
asm volatile ("jmp 1f \n\t .pushsection
__kuku,\"ax\",@progbits \n\t 1:");
std::cout << "0x123456" << std::endl;
throw 12345;
asm volatile("jmp 3f \n\t .popsection \n\t 3:");
}
return 0;
}
What do these errors mean? Is there a way to fix them? Is there an
alternate method to move similar code to a different section?
Thanks,
Saul