Page 1 of 1

some problem about freebsd kernel assembly

Posted: Sat Jun 11, 2005 12:11 am
by ocean390
#define GEN_ENTRY(name) ALIGN_TEXT; .globl CNAME
(name); \
.type CNAME(name),@function; CNAME(name):
Is this AT&T syntax? I read through the gas manual, but I can't find what is this mean.
Thanks for your help

Re:some problem about freebsd kernel assembly

Posted: Sat Jun 11, 2005 12:51 am
by AR
It creates a "global" function declaration.

Re:some problem about freebsd kernel assembly

Posted: Sat Jun 11, 2005 12:58 am
by ocean390
I do know it creates a global function,but the syntax is special. For example what is the @function mean? Is freebsd kernel assembly syntax is different from gas.

Re:some problem about freebsd kernel assembly

Posted: Sat Jun 11, 2005 1:07 am
by AR
Looks like GAS to me, I'm reasonably sure they use GCC (and therefore GAS). [Especially since #define() means that it is being run through the GCC preprocessor (or at least some preprocessor)]

I believe .type is an ELF directive because ELFs support distinguishing between Data and functions, @function most likely just declares that it is code not data.

Re:some problem about freebsd kernel assembly

Posted: Sat Jun 11, 2005 1:12 am
by ocean390
Thanks for your help! I find the reason. The gas with FreeBSD is not the same as GNU's. It has its owm syntax. And the edition is 2.15.