Author: ed
Date: Thu Jan  5 10:32:53 2012
New Revision: 229571
URL: http://svn.freebsd.org/changeset/base/229571

Log:
  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@

Modified:
  head/lib/libc/i386/string/strchr.S
  head/lib/libc/i386/string/strrchr.S
  head/lib/libc/mips/string/strchr.S
  head/lib/libc/mips/string/strrchr.S
  head/lib/libc/string/strchr.c
  head/lib/libc/string/strrchr.c

Modified: head/lib/libc/i386/string/strchr.S
==============================================================================
--- head/lib/libc/i386/string/strchr.S  Thu Jan  5 10:24:06 2012        
(r229570)
+++ head/lib/libc/i386/string/strchr.S  Thu Jan  5 10:32:53 2012        
(r229571)
@@ -63,6 +63,6 @@ L2:
        ret
 END(strchr)
 
-STRONG_ALIAS(index, strchr)
+WEAK_ALIAS(index, strchr)
 
        .section .note.GNU-stack,"",%progbits

Modified: head/lib/libc/i386/string/strrchr.S
==============================================================================
--- head/lib/libc/i386/string/strrchr.S Thu Jan  5 10:24:06 2012        
(r229570)
+++ head/lib/libc/i386/string/strrchr.S Thu Jan  5 10:32:53 2012        
(r229571)
@@ -64,6 +64,6 @@ L2:   
        ret
 END(strrchr)
 
-STRONG_ALIAS(rindex, strrchr)
+WEAK_ALIAS(rindex, strrchr)
 
        .section .note.GNU-stack,"",%progbits

Modified: head/lib/libc/mips/string/strchr.S
==============================================================================
--- head/lib/libc/mips/string/strchr.S  Thu Jan  5 10:24:06 2012        
(r229570)
+++ head/lib/libc/mips/string/strchr.S  Thu Jan  5 10:32:53 2012        
(r229571)
@@ -58,4 +58,4 @@ fnd:
        j               ra
 END(strchr)
 
-STRONG_ALIAS(index, strchr)
+WEAK_ALIAS(index, strchr)

Modified: head/lib/libc/mips/string/strrchr.S
==============================================================================
--- head/lib/libc/mips/string/strrchr.S Thu Jan  5 10:24:06 2012        
(r229570)
+++ head/lib/libc/mips/string/strrchr.S Thu Jan  5 10:32:53 2012        
(r229571)
@@ -56,4 +56,4 @@ LEAF(strrchr)
        j               ra
 END(strrchr)
 
-STRONG_ALIAS(rindex, strrchr)
+WEAK_ALIAS(rindex, strrchr)

Modified: head/lib/libc/string/strchr.c
==============================================================================
--- head/lib/libc/string/strchr.c       Thu Jan  5 10:24:06 2012        
(r229570)
+++ head/lib/libc/string/strchr.c       Thu Jan  5 10:32:53 2012        
(r229571)
@@ -51,4 +51,4 @@ strchr(const char *p, int ch)
        /* NOTREACHED */
 }
 
-__strong_reference(strchr, index);
+__weak_reference(strchr, index);

Modified: head/lib/libc/string/strrchr.c
==============================================================================
--- head/lib/libc/string/strrchr.c      Thu Jan  5 10:24:06 2012        
(r229570)
+++ head/lib/libc/string/strrchr.c      Thu Jan  5 10:32:53 2012        
(r229571)
@@ -52,4 +52,4 @@ strrchr(const char *p, int ch)
        /* NOTREACHED */
 }
 
-__strong_reference(strrchr, rindex);
+__weak_reference(strrchr, rindex);
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "[email protected]"

Reply via email to