Port some code to GCC, have some problems with #pragma directives
c++, c-preprocessor, gcc, porting, pragma
Solution
GCC uses a different and incompatible way of registering global constructors. Instead of trying to port it, you should rewrite it accordingly to the ABI used by GCC.
For the gory details, consult e.g. `libgcc/crtstuff.c` and `libgcc/gbl-ctors.h` in GCC source tree.
Problem
I'm trying to compile this code with GCC and I have these `#pragma` directives that I'm trying to convert to GCC understandable instructions and I just can't 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 for creating a new section you can use `__attribute__ ((section (".CRT$XCZ")))` but what about `data_seg`?