[Bug target/25967] Add attribute naked for x86

radoslaw.biernacki at gmail dot com gcc-bugzilla@gcc.gnu.org
Sun Dec 25 17:19:00 GMT 2011


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25967

Radoslaw Biernacki <radoslaw.biernacki at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |radoslaw.biernacki at gmail
                   |                            |dot com

--- Comment #3 from Radoslaw Biernacki <radoslaw.biernacki at gmail dot com> 2011-12-25 15:45:11 UTC ---
I will attach my comment to discussion.

I see the reason for naked attribute. I develop an embedded OS for small uC and
I would like to make a port for x86 Linux userspace. The scheduler for my OS
will behave as "fibres implementation". It will be similar to old fashioned
setcontext getcontext calls.

I need to compile following function:
void OS_NAKED OS_HOT os_context_switch(os_task_t *new_task)
{
   arch_contextstore_u();
   task_current = new_task;
   task_current->state = TASKSTATE_RUNNING;
   arch_contextrestore_u();
}

where arch_contextstore_u and arch_contextrestore_u are the architecture
depended function implemented by me in pure asm. arch_contextrestore_u will
make a return to address stored in task_current context (previously pushed on
stack by call (x86) instruction while calling os_context_switch).

The problem that I have is, that for x86 Linux environment, gcc does not
support the __attibute__ ((naked)). This attribute is supported on embedded
environments (bare metal) of all gcc ports that I found (like ARM, msp430-gcc,
avr-gcc etc).

So I'm the next person which waits for this implementation on x86 Linux.



More information about the Gcc-bugs mailing list