From 19c262fe87cdb0d4aaf3b4aaefaefda6f09e77e0 Mon Sep 17 00:00:00 2001 From: Ed Schouten Date: Thu, 5 Jan 2012 10:32:53 +0000 Subject: [PATCH] Change index() and rindex() to a weak alias. This allows people to still write statically linked applications that call strchr() or strrchr() and have a local variable or function called index. Discussed with: bde@ --- lib/libc/i386/string/strchr.S | 2 +- lib/libc/i386/string/strrchr.S | 2 +- lib/libc/mips/string/strchr.S | 2 +- lib/libc/mips/string/strrchr.S | 2 +- lib/libc/string/strchr.c | 2 +- lib/libc/string/strrchr.c | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/libc/i386/string/strchr.S b/lib/libc/i386/string/strchr.S index 4162da2101b..57fc6dd6fbe 100644 --- a/lib/libc/i386/string/strchr.S +++ b/lib/libc/i386/string/strchr.S @@ -63,6 +63,6 @@ L2: ret END(strchr) -STRONG_ALIAS(index, strchr) +WEAK_ALIAS(index, strchr) .section .note.GNU-stack,"",%progbits diff --git a/lib/libc/i386/string/strrchr.S b/lib/libc/i386/string/strrchr.S index a07ecd8ff95..29942c49800 100644 --- a/lib/libc/i386/string/strrchr.S +++ b/lib/libc/i386/string/strrchr.S @@ -64,6 +64,6 @@ L2: ret END(strrchr) -STRONG_ALIAS(rindex, strrchr) +WEAK_ALIAS(rindex, strrchr) .section .note.GNU-stack,"",%progbits diff --git a/lib/libc/mips/string/strchr.S b/lib/libc/mips/string/strchr.S index 9a9f8dcdd4d..198366f87a6 100644 --- a/lib/libc/mips/string/strchr.S +++ b/lib/libc/mips/string/strchr.S @@ -58,4 +58,4 @@ fnd: j ra END(strchr) -STRONG_ALIAS(index, strchr) +WEAK_ALIAS(index, strchr) diff --git a/lib/libc/mips/string/strrchr.S b/lib/libc/mips/string/strrchr.S index a742b359302..5a88a42c8e1 100644 --- a/lib/libc/mips/string/strrchr.S +++ b/lib/libc/mips/string/strrchr.S @@ -56,4 +56,4 @@ LEAF(strrchr) j ra END(strrchr) -STRONG_ALIAS(rindex, strrchr) +WEAK_ALIAS(rindex, strrchr) diff --git a/lib/libc/string/strchr.c b/lib/libc/string/strchr.c index 481cb20711a..1245f136b7e 100644 --- a/lib/libc/string/strchr.c +++ b/lib/libc/string/strchr.c @@ -51,4 +51,4 @@ strchr(const char *p, int ch) /* NOTREACHED */ } -__strong_reference(strchr, index); +__weak_reference(strchr, index); diff --git a/lib/libc/string/strrchr.c b/lib/libc/string/strrchr.c index 160c4b5459a..be9f9781f6e 100644 --- a/lib/libc/string/strrchr.c +++ b/lib/libc/string/strrchr.c @@ -52,4 +52,4 @@ strrchr(const char *p, int ch) /* NOTREACHED */ } -__strong_reference(strrchr, rindex); +__weak_reference(strrchr, rindex);