------- Comment #3 from acahalan at gmail dot com 2006-09-21 18:49 ------- foo 0 $ cat foo.c void *memcpy(void *restrict, const void *restrict, unsigned long); void *memcpy(void *restrict dst, const void *restrict src, unsigned long n) { const char *p = src; char *q = dst; while (n--) { *q++ = *p++; } return dst; } typedef struct S { int a[42]; }S; void __attribute__((used,unused)) _fini(void) { S *s1; S *s2; __asm__ __volatile__("":"=r"(s1)::"memory"); __asm__ __volatile__("":"=r"(s2)::"memory"); *s1 = *s2; __asm__ __volatile__(""::"r"(s1):"memory"); __asm__ __volatile__(""::"r"(s2):"memory"); } foo 0 $ make gcc -m32 -std=gnu99 -nostdinc -fPIC -Os -fvisibility=hidden -W -Wall -g3 -ffreestanding -fwhole-program --combine -c foo.c -o bigblob.pic rm -f tmp.so testcase.so.1.0.1 gcc -m32 -shared -nostartfiles -nodefaultlibs -nostdlib -o tmp.so bigblob.pic if nm tmp.so | grep -i --color=auto '.* u .*' ; then false ; else true ; fi U memcpy make: *** [testcase.so.1.0.1] Error 1 foo 2 $
-- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29171