Hi Stefan, [...]
On Fri, Feb 15, 2013 at 10:16 PM, Stefan Weil <s...@weilnetz.de> wrote: > > earlier versions of QEMU provided an implementation of ffs() > because it was needed for w32 compilations without optimisation. > > Later w32 used libiberty.a which provides ffs(). w64 never needed > the ffs() implementation, so I removed it in commit > 57a8821bc6e4457230075a5c8da5f8a083889686. > > In my builds (w32 and w64, Debian / Ubuntu Linux cross and native) > I don't get an unresolvedsymbol ffs. > > 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?). Version information about the compiler I'm using is listed below: [jkroon@skeletor flexemu]$ i686-w64-mingw32-gcc -v Using built-in specs. COLLECT_GCC=i686-w64-mingw32-gcc COLLECT_LTO_WRAPPER=/usr/libexec/gcc/i686-w64-mingw32/4.7.2/lto-wrapper Target: i686-w64-mingw32 Configured with: ../configure --prefix=/usr --bindir=/usr/bin --includedir=/usr/include --libdir=/usr/lib64 --mandir=/usr/share/man --infodir=/usr/share/info --datadir=/usr/share --build=x86_64-redhat-linux-gnu --host=x86_64-redhat-linux-gnu --with-gnu-as --with-gnu-ld --verbose --without-newlib --disable-multilib --disable-plugin --with-system-zlib --disable-nls --without-included-gettext --disable-win32-registry --enable-languages=c,c++,objc,obj-c++,fortran --with-bugurl=http://bugzilla.redhat.com/bugzilla --with-ppl --disable-ppl-version-check --with-cloog --enable-libgomp --target=i686-w64-mingw32 --with-sysroot=/usr/i686-w64-mingw32/sys-root --with-gxx-include-dir=/usr/i686-w64-mingw32/sys-root/mingw/include/c++ Thread model: win32 gcc version 4.7.2 20120920 (Fedora MinGW 4.7.2-7.fc18) (GCC) I'm not passing any special compiler flags that I know of. Building for W32 gives me the same linking errors, as Andreas pointed out it seems to the "--enable-debug" flag that is breaking the build for me. This is the qcow2.o compile command I get: i686-w64-mingw32-gcc -I. -I/home/jkroon/Projects/flexemu/qemu -I/home/jkroon/Pro jects/flexemu/qemu/include -m32 -D__USE_MINGW_ANSI_STDIO=1 -DWIN32_LEAN_AND_MEAN -DWINVER=0x501 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstric t-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototype s -fno-strict-aliasing -I/home/jkroon/Projects/flexemu/qemu/../slaves -fstack-p rotector-all -Wendif-labels -Wmissing-include-dirs -Wempty-body -Wnested-externs -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wold-style-dec laration -Wold-style-definition -Wtype-limits -I/usr/i686-w64-mingw32/sys-root/m ingw/include/pixman-1 -Iblock -Iblock -mms-bitfields -I/usr/i686-w64-mingw32/s ys-root/mingw/include/glib-2.0 -I/usr/i686-w64-mingw32/sys-root/mingw/lib/glib-2 .0/include -MMD -MP -MT block/qcow2.o -MF block/qcow2.d -g -c -o block/qcow2. o block/qcow2.c > 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. Output on my laptop, not quite sure how to interpret it though.. : [jkroon@skeletor temp]$ i686-w64-mingw32-nm test.o 00000000 b .bss 00000000 d .data 00000000 N .debug_abbrev 00000000 N .debug_aranges 00000000 N .debug_frame 00000000 N .debug_info 00000000 N .debug_line 00000000 N .debug_loc U _ffs 00000000 T _main U ___main 00000000 t .text Regards Jacob