undefined reference to `__ffs'

Nicolas Pitre nico at cam.org
Fri Aug 27 12:05:31 EDT 2004


On Fri, 27 Aug 2004, Brian T wrote:

>> drivers/mtd/mtdlink.o: In function `cfi_intelext_partition_fixup':
>> drivers/mtd/mtdlink.o(.text+0x76c6): undefined reference to `__ffs'
>> make: *** [vmlinux] Error 1
>>
>
> Hmmm,
>
> Looks like _ffs is defined in :
>
> [root at Smog include]# grep -l -r "__ffs" *
> asm-ia64/topology.h
> asm-ia64/bitops.h
> asm-ppc64/bitops.h
>
> but in asm-i386/bitops.h it is defined as ffs()
>
> So, should there be a macro rule for ffs->__ffs for compiling for i386?

No, they aren't equivalent.

>From linux/asm-i386/bitops.h in 2.6.8:

/**
  * __ffs - find first bit in word.
  * @word: The word to search
  *
  * Undefined if no bit exists, so code should check against 0 first.
  */
static inline unsigned long __ffs(unsigned long word)
{
         __asm__("bsfl %1,%0"
                 :"=r" (word)
                 :"rm" (word));
         return word;
}


Nicolas




More information about the linux-mtd mailing list