------- Additional Comments From hjl at lucon dot org  2005-03-03 00:05 -------
Created an attachment (id=8315)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=8315&action=view)
A testcase

/export/build/gnu/gcc-4.0/build-x86_64-linux/gcc/xgcc
-B/export/build/gnu/gcc-4.0/build-x86_64-linux/gcc/ -O2 -fPIC   -c -o foo.o
foo.c
/export/build/gnu/gcc-4.0/build-x86_64-linux/gcc/xgcc
-B/export/build/gnu/gcc-4.0/build-x86_64-linux/gcc/ -o libfoo.so -shared foo.o
foo.o: In function `foo':
foo.c:(.text+0x5): undefined reference to `memcpy'
/usr/local/bin/ld: foo.o: relocation R_X86_64_PC32 against `memcpy' can not be
used when making a shared object; recompile with -fPIC
/usr/local/bin/ld: final link failed: Bad value
collect2: ld returned 1 exit status
make: *** [libfoo.so] Error 1

The problem is gcc mishandles

#pragma GCC visibility push(hidden)
#pragma GCC visibility push(default)
typedef long unsigned int size_t;
extern void *memcpy (void *, const void *, size_t);
#pragma GCC visibility pop

and thinks memcpy is hidden. It only happens to builtin functions. When
memcpy is renamed to bar, gcc is OK.

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20297

Reply via email to