Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C function syntax

Tags:

assembly

glibc

On this page : http://www.scs.stanford.edu/histar/src/pkg/uclibc/libc/sysdeps/linux/x86_64/sigaction.c

I see these two lines :

extern void restore_rt (void) asm ("__restore_rt") attribute_hidden;
extern void restore (void) asm ("__restore") attribute_hidden;

What is this syntax? Is it setting up restore_rt to be a function that has inline asm("__restore_rt") as its body?

Thanks!

like image 793
MK. Avatar asked May 19 '15 03:05

MK.


1 Answers

Using asm in a function declaration is a GCC extension (also supported by Clang/LLVM) called asm-label. It is setting the assembler and linker known name of the function.

BTW, in your code attribute_hidden is probably a macro for some function attribute, probably __attribute__ ((visibility ("hidden")))

like image 134
Basile Starynkevitch Avatar answered Sep 29 '22 21:09

Basile Starynkevitch