A question about 64 bit kernel linking
Posted: Sun Nov 17, 2013 7:04 am
Currently I am coding a 64 bit kernel, so I added "-mcmodel-large" to the cflags, and it works fine. Because in assembly, every 64 bit immediate number should be stored in general registers first because the only command taking imm64 is "mov GPR, imm64". As a result, my kernel became very big. When I only added a printf function to the kernel, the kernel became 3KB larger. I came up an idea that to use -fPIC instead of -mcmodel-large to compile the kernel. It works fine, but I wondered if the usage will cause any potential problem, because it seems that every solution given by the Internet said "use mcmodel option". What's your opinion?