Port the code to GCC, you have some problems with the #pragma directives

I am trying to compile this code with GCC, and I have these #pragma , which I am trying to convert into understandable GCC instructions, and I just cannot figure out how:

 #pragma section(".CRT$XCA", read, write) #pragma data_seg(".CRT$XCA") // start of ctor section _PVFV __xc_a[] = {0}; #pragma section(".CRT$XCZ", read, write) #pragma data_seg(".CRT$XCZ") // end of ctor section _PVFV __xc_z[] = {0}; #pragma data_seg() #pragma comment(linker, "/merge:.CRT=.rdata") 

I know that you can use __attribute__ ((section (".CRT$XCZ"))) to create a new section, but what about data_seg ?

+4
source share
1 answer

GCC uses a different and incompatible way to register global constructors. Instead of trying to transfer it, you should rewrite it according to the ABI used by GCC.

For details, see, for example, libgcc/crtstuff.c and libgcc/gbl-ctors.h in the GCC source tree.

+3
source

All Articles