Red Hat Bugzilla – Bug 25731
strcpy breaks with -O2 -fno-inline
Last modified: 2016-11-24 09:53:58 EST
$ cat foo.c
$ gcc -O2 -fno-inline foo.c
/tmp/ccLwrlUH.o: In function `main':
/tmp/ccLwrlUH.o(.text+0x5c): undefined reference to `__strcpy_small'
collect2: ld returned 1 exit status
$ rpm -q glibc gcc
Pass -O2 -fno-inline -D__NO_STRING_INLINES then. Really, there is nothing
glibc can do about this (apart from exporting all those inlines as static
functions but that makes no sense) and gcc does not pass any macros
which would tell whether -finline or -fno-inline was passed, so it has to use
__OPTIMIZE__ (and has done that for ages).