Jim Meyering <[EMAIL PROTECTED]> wrote: > "Gabor Z. Papp" <[EMAIL PROTECTED]> wrote: > ... >> gcc -std=gnu99 -g -O2 -Wl,--as-needed -o cp cp.o copy.o cp-hash.o >> ../lib/libcoreutils.a ../lib/libcoreutils.a >> ../lib/libcoreutils.a(xstrndup.o): In function `xstrndup': >> /home/gzp/src/coreutils-6.2/lib/xstrndup.c:37: undefined reference to >> `rpl_strndup' >> collect2: ld returned 1 exit status >> make[2]: *** [cp] Error 1 >> make[2]: Leaving directory `/home/gzp/src/coreutils-6.2/src' >> make[1]: *** [all] Error 2 >> make[1]: Leaving directory `/home/gzp/src/coreutils-6.2/src' >> make: *** [all-recursive] Error 1 > > Thanks for reporting that. > > The above makes me think your tools have incomplete "weak_alias" support, > so that lib/strndup.o ends up with a definition for a function > named __strndup, rather than rpl_strndup. > > Gabor, would you please tell us what compiler and libc/OS you're using? > > -------------- > ... > #ifndef weak_alias > # define __strndup strndup > #endif > > char * > __strndup (s, n) > const char *s; > size_t n; > { > ... > } > #ifdef weak_alias > weak_alias (__strndup, strndup) > #endif > ------------------- > > If one person (Paul?) signs off on this, I'll check it in > and use it for coreutils-6.3. I've tested it on systems > without strndup. Running one more test, now... > > [lib/ChangeLog] > This function could end up with a definition for a function > named __strndup, rather than rpl_strndup on a system with > incomplete weak_alias support. > * strndup.c (strndup): Rename from __strndup. > Remove #defines that used to map __strndup to strndup. > Don't use K&R prototypes. > Remove LIBC-related code, since this file is not sync'd with glibc. > * strndup.h: Revamp, accordingly. > [m4/ChangeLog] > * strndup.m4: Modernize.
No one signed off, but it works everywhere I've tested, so I've checked it in.