Description of Problem: Call the library function strcpy() with a source string of 4 chars or less, and compile with -O2 -fno-inline. GCC generates a call to __strcpy_small which does not exist. How Reproducible: [alane@wwweasel alane]$ rpm -q gcc gcc-2.96-81 [alane@wwweasel alane]$ cat > urk.c #include <stdio.h> #include <stdlib.h> #include <string.h> #ifdef unix #include <unistd.h> #endif /* unix */ int main() { char *s; s=malloc(10); strcpy(s,"X"); puts(s); return 0; } [alane@wwweasel alane]$ gcc -O2 -fno-inline -o urk urk.c /tmp/ccCKE1op.o: In function `main': /tmp/ccCKE1op.o(.text+0x77): undefined reference to `__strcpy_small' collect2: ld returned 1 exit status [alane@wwweasel alane]$ gcc -O2 -fno-inline -c urk.c [alane@wwweasel alane]$ nm urk.o U __strcpy_small 00000000 t gcc2_compiled. 00000000 T main U malloc U puts
I'm aware of this, have solved it already - see http://gcc.gnu.org/ml/gcc-patches/2001-05//msg00275.html http://sources.redhat.com/ml/libc-hacker/2001-05/msg00003.html These patches will appear in gcc-2.96-85 and glibc-2.2.3-6 respectively.
I have the Red Hat 7.1 installed on my computer, and I had a little problem with the gcc compiler. Please, I would like, if possible, of obtaining an answer for the following question: Why the simple source code below when compiled using the gcc (gcc test.c -o test) it generates the following message: undefined reference to `sqrt' ? (all the libraries are installed!!!) /*Program Test*/ #include <stdio.h> #include <stdlib.h> #include <math.h> int main (void) { int i; float s; for (i = 0 ; i <= 10 ; i++){ s = sqrt(i); printf("\n sqrt(%d) = %f", i , s); } } Thank you. lederman.br