qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] Undefined reference to 'ffs' when building for win64


From: Kevin Wolf
Subject: Re: [Qemu-devel] Undefined reference to 'ffs' when building for win64
Date: Mon, 18 Feb 2013 10:52:58 +0100
User-agent: Mutt/1.5.21 (2010-09-15)

On Fri, Feb 15, 2013 at 10:16:11PM +0100, Stefan Weil wrote:
> It looks like most (but not all) versions of gcc emit built-in code
> for ffs() even for compilations without optimisation. I have to provide
> additional compiler options (e.g. -fno-builtin-ffs) to get a real
> function call.
> Only then I get the linker errors which you see.
> 
> Obviously your compiler behaves different (or did you add extra
> compiler options?).
> 
> Try this short test.c code:
> 
> int ffs(unsigned n);
> int main(int argc, char *argv[])
> {
>   return ffs(argc);
> }
> 
> On Debian, I compiled and tested like this:
> 
> amd64-mingw32msvc-gcc -c -g -O0 test.c
> amd64-mingw32msvc-nm test.o
> 
> There is no ffs function call in the resulting binary.
> 
> If your compiler creates a function call, we have to know
> why and whether there is a simple rule which versions of
> gcc behave like that. If there is no simple rule, we need
> a configure check.

A configure check would require that a compiler either creates always a
function call, or never. I'm not sure if you can rely on that.

Kevin



reply via email to

[Prev in Thread] Current Thread [Next in Thread]