-mcmodel=kernel -mno-red-zone

8.1.2 x86 64-bit processors
AMD has enhanced the 32-bit x86 instruction set to a 64-bit instruction set called x86-64, which is implemented in their AMD64 processors.(24) On AMD64 systems GCC generates 64-bit code by default. The option -m32 allows 32-bit code to be generated instead.

The AMD64 processor has several different memory models for programs running in 64-bit mode. The default model is the small code model, which allows code and data up to 2GB in size. The medium code model allows unlimited data sizes and can be selected with -mcmodel=medium. There is also a large code model, which supports an unlimited code size in addition to unlimited data size. It is not currently implemented in GCC since the medium code model is sufficient for all practical purposes–executables with sizes greater than 2GB are not encountered in practice.

A special kernel code model -mcmodel=kernel is provided for system-level code, such as the Linux kernel. An important point to note is that by default on the AMD64 there is a 128-byte area of memory allocated below the stack pointer for temporary data, referred to as the “red-zone”, which is not supported by the Linux kernel. Compilation of the Linux kernel on the AMD64 requires the options -mcmodel=kernel -mno-red-zone.

Taken From : http://www.network-theory.co.uk/docs/gccintro/gccintro_65.html

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s