What is the correct way to declare assembler global variable ?

Yuri yuri at rawbw.com
Fri May 3 20:10:36 UTC 2013


I am trying to compile this code fragment into my program (taken from 
lib/libc/amd64/sys/sbrk.S):
void my_func() {
  ...
   __asm__ __volatile__(
       "movq .curbrk(%%rip), %%rax;"
       "lea  .curbrk(%%rip), %%rdx;"
       "movq %%rax, %0;"
       "movq %%rdx, %1;"
       : "=r" (my_curbrk),
         "=r" (my_curbrk_ptr)
       :: "%rax", "%rdx");
   ...
}

I get a warning:
/usr/bin/ld: warning: type and size of dynamic symbol 
`.curbrk@@FBSDprivate_1.0' are not defined

What is the correct way to declare .curbrk in in-place assembly?

Yuri


More information about the freebsd-hackers mailing list