[cfe-dev] naked attribute
Reed Kotler
rkotler at mips.com
Thu May 2 18:29:06 PDT 2013
With my x86 version of gcc, I get a warning if I use the naked attribute
that it's not supported. I have 4.4.3
I don't get the warning with clang.
On 05/02/2013 05:20 PM, Reed Kotler wrote:
> On 05/02/2013 05:00 PM, Rafael EspĂndola wrote:
>> On 2 May 2013 18:16, reed kotler
>> <rkotler-8NJIiSa5LzA-XMD5yJDbdMReXY1tMh2IBg at public.gmane.org> wrote:
>>> When I use the latest code sourcery/Menor release of the ARM compiler
>>> I get
>>> no return statement. This claims to be 4.6.3
>>>
>>
>> Lovely, so I guess this is architecture dependent. Any patch that
>> makes us more compatible with gcc in this area is welcome, so we need
>> to figure out which architectures get a ret and which ones get an
>> unreachable :-(
>>
>> Cheers,
>> Rafael
>>
>
> Not all architectures support the naked attribute, even in gcc.
> "Use this attribute on the ARM, AVR, MCORE, RX and SPU ports ..."
>
> gcc 4.7 in the android toolkit for arm does not emit a return statement.
>
> (building cross tool chains with gcc is a pain so that's why I at first
> just downloaded the gcc arm version from the mentor/code sourcery site).
>
> fu at fu-G10IL:~/dev/test$
> ~/dev/android-ndk-r8e/toolchains/arm-linux-androideabi-
> 4.7/prebuilt/linux-x86/bin/arm-linux-androideabi-gcc -S tnaked.c
>
> fu at fu-G10IL:~/dev/test$ cat tnaked.s
> .arch armv5te
> .fpu softvfp
> .eabi_attribute 20, 1
> .eabi_attribute 21, 1
> .eabi_attribute 23, 3
> .eabi_attribute 24, 1
> .eabi_attribute 25, 1
> .eabi_attribute 26, 2
> .eabi_attribute 30, 6
> .eabi_attribute 34, 0
> .eabi_attribute 18, 4
> .file "tnaked.c"
> .text
> .align 2
> .global tnaked
> .type tnaked, %function
> tnaked:
> @ Naked Function: prologue and epilogue provided by programmer.
> @ args = 0, pretend = 0, frame = 0
> @ frame_needed = 1, uses_anonymous_args = 0
> .size tnaked, .-tnaked
> .align 2
> .global tnonaked
> .type tnonaked, %function
> tnonaked:
> @ args = 0, pretend = 0, frame = 0
> @ frame_needed = 1, uses_anonymous_args = 0
> @ link register save eliminated.
> str fp, [sp, #-4]!
> add fp, sp, #0
> add sp, fp, #0
> ldmfd sp!, {fp}
> bx lr
> .size tnonaked, .-tnonaked
> .ident "GCC: (GNU) 4.7"
> .section .note.GNU-stack,"",%progbits
More information about the cfe-dev
mailing list