This is just plain stupid.
As far as I know, GCC doesn't generate 16bit real mode code... (and that's the mode where a ordinary x86 CPU is after boot-up).
Plus you would need to set up GDT, IDT and jmp far to your 32bit code after the mov cr0,eax. And I can pretend how your "entpm" function would react if it would reach the ending bracket " } "... There, it restores the registers and stuff. I see a triple fault
... if the processor would even GET there.
Anywho, setting up protected mode in a GCC stack-framed inline assembly code block is a great idea, really
Your silly code wouldn't work. You would need to switch to pmode in assembly. If you show me a working C/C++ bootloader with a "set_pmode" INLINE assembly function (not the in the ASM stub),... which is impossible,... then i would have respect to you. Of course, your code. Good luck