The following macro appears in include/linux/kernel.h
#define _THIS_IP_ ({ __label__ __here; __here: (unsigned long)&&__here; })
I don't understand what the second & applied to __here would do. The first takes the address of the local label, but what about the second?
The second &
in &&
is necessary to make GCC lookup the name as a label, instead of as a variable. For example
foo: ;
int foo;
void *p1 = &&foo;
void *p2 = &foo;
The second initializer refers to the int variable.
I think &&
is to get the address of label.
this is gcc extention and I don't think C99 standard supports this behavior.
for more see this.. gcc Labels and values
And local label declaration
In your case ,
#define _THIS_IP_ ({ __label__ __here; __here: (unsigned long)&&__here; })
In actual code _THIS_IP_
will be replaced by the code below of block scope
{ __label__ __here;
__here:
(unsigned long) &&__here;
}
You are declaring local label __here
. Hence to get the address of label we use &&
while we get the address of variable with single &
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With