From Bugzilla Helper: User-Agent: Mozilla/4.76 [en] (X11; U; Linux 2.4.2ac9-low-latency i686) in avifile-0.53.5/lib/loader ... [jrl@cma-d0448 loader]$ make . . . /bin/sh ../../libtool --silent --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I../../include -g -O2 -march=i586 -I/usr/X11R6/include -I/usr/include/SDL -D_REENTRANT -w -I../../include -DWIN32_PATH=\"/usr/lib/win32\" -D__WINE__ -Ddbg_printf=__vprintf -DTRACE=__vprintf -fno-omit-frame-pointer -fno-inline -c win32.c . . . /bin/sh ../../libtool --silent --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I../../include -g -O2 -march=i586 -I/usr/X11R6/include -I/usr/include/SDL -D_REENTRANT -w -I../../include -DWIN32_PATH=\"/usr/lib/win32\" -D__WINE__ -Ddbg_printf=__vprintf -DTRACE=__vprintf -fno-omit-frame-pointer -fno-inline -c registry.c [jrl@cma-d0448 loader]$ grep "strcpy_small" * grep: CVS: Is a directory Binary file registry.lo matches Binary file win32.lo matches [jrl@cma-d0448 loader]$ in avifile-0.53.5/player . . . /bin/sh ../libtool --silent --mode=link c++ -I../include -I/usr/X11R6/include -I/usr/lib/qt-2.2.3/include -I/usr/include/SDL -D_REENTRANT -DSHARE_PATH=\"/usr/local/share/avifile\" -DWIN32_PATH=\"/usr/lib/win32\" -march=i586 -lpthread -ldl -L/usr/X11R6/lib -lX11 -lXext -L/usr/lib/qt-2.2.3/lib -lqt-mt -L/usr/lib -Wl,-rpath,/usr/lib -lSDL -lpthread -o aviplay main.o renderer.o mywidget_if.o MyConfig.o MyConfigImpl.o mywidget.o decoder_config.o mmx.o ../lib/libaviplay.la -lXxf86vm -lXxf86dga -lpthread -ldl ../lib/.libs/libaviplay.so: undefined reference to `__strcpy_small' collect2: ld returned 1 exit status Adding -D__NO_STRING_INLINES to our CFLAGS option in the Makefile of lib/loader solves this problem. Reproducible: Always Steps to Reproduce: 1. ./configure --enable-release --enable-quiet 2. make Actual Results: undefined reference to __strcpy_small Expected Results: It shouldn't have inlined the string function and therefore, should've compiled normally. Bug consistantly occurs with gcc in rawhide, redhat 7.0, and egcs in redhat 6.2.
There is now way how can glibc know you have passed -fno-builtin unless you tell it (via -D__NO_STRING_INLINES). gcc only defined __OPTIMIZE__ macro if -O1 or higher is present. I don't think it is a good idea if gcc defines a macro for each option passed to it, it would be quite a mess (because it would have to take account default switch values and also would be changing all the time with new options being added and old removed).
Well, should it have done the inlining in the first place? According to the documentation stated in both man/info pages, [it] "does not perform loop unrolling or function inlining when you specify '-O2'".... in the case of O3, does it say to turn on the inline functions... In any case, what you said earlier is the workaround I came up with anyways. *shrug*
Yes, it should. At -O1 and above glibc attempts to inline functions which are marked as inline (and __strcpy_small is marked as such), at -O3 and above gcc attempts to inline even functions not marked as inline.