This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Faulty code alignment in manual sections


I'm not really sure if this question belongs here, but nopbody has ben able to answer this question on the forums I posted it to, so I thought why not ask the real experts:

I'm writing an OS kernel and I want to dump some functions and data from memory when initialization is complete (like in Linux). So I gave all functions I wanted to dump __attribute__ ((section (.text.init))). The broblem is that GCC thinks .text.init is a DATA sections. So when I build with -O3 it adds padding to aling the code, but it is padded with 0x00 instead of 0x90 (NOPs). This causes the kernel to crash when it encounters the padding (0x00 0x00 0x?? 0x?? means ADD [????], ??, which always accesses memory that isn't mapped, basically a SIGSEGV). How do I change it. I couldn't find it in the documentation of GCC. I think doing something in LD is to late (the 0x00 have already been written to the object file) So my best guess is the assembler. Could some one help me?

Thanks in advance Rudy Koot (rudykoot at trinary dot tk)

_________________________________________________________________
Tired of spam? Get advanced junk mail protection with MSN 8. http://join.msn.com/?page=features/junkmail



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]