This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: GCC 4.8 and -ftree-loop-distribute-patterns.


On 04/05/2013 07:30 PM, Roland McGrath wrote:
>> I have noted this option also creating memmove calls when building some mpn
>> objects and memset call on wcsmbs files when building for PowerPC.
> Why are these a problem?  If the compiler decided it was optimal to use
> those calls, we should let it.  There's only a problem when it's using a
> function to define itself.
>
>
> Thanks,
> Roland
>
It is a problem now because since some mpn and wcsmbs implementation
does not contain the string definition the compiler will create a reference
to memset/memmove instead of __GI_memset/__GI_memmove, ending in a PLT call
for these symbols in libc.so.

But I believe a simpler solution instead of add '-fno-tree-loop-distribute-patterns'
on Makefile or function attribute is to just add an '#include <string.h>'
on such sources.

The following patch fixed the localplt issue I was observing on PowerPC64:


diff --git a/stdlib/divrem.c b/stdlib/divrem.c
index 99c782e..05dc665 100644
--- a/stdlib/divrem.c
+++ b/stdlib/divrem.c
@@ -20,6 +20,7 @@ along with the GNU MP Library; see the file COPYING.LIB.  If not, see
 <http://www.gnu.org/licenses/>.  */  
 
 #include <gmp.h>
+#include <string.h>
 #include "gmp-impl.h"
 #include "longlong.h"
 
diff --git a/stdlib/mul.c b/stdlib/mul.c
index 1258717..e3fb11d 100644
--- a/stdlib/mul.c
+++ b/stdlib/mul.c
@@ -19,6 +19,7 @@ along with the GNU MP Library; see the file COPYING.LIB.  If not, see
 <http://www.gnu.org/licenses/>.  */  
 
 #include <gmp.h>
+#include <string.h>
 #include "gmp-impl.h"
 
 /* Multiply the natural numbers u (pointed to by UP, with USIZE limbs)
diff --git a/stdlib/mul_n.c b/stdlib/mul_n.c
index f0a9a30..0078e68 100644
--- a/stdlib/mul_n.c
+++ b/stdlib/mul_n.c
@@ -19,6 +19,7 @@ along with the GNU MP Library; see the file COPYING.LIB.  If not, see
 <http://www.gnu.org/licenses/>.  */  
 
 #include <gmp.h>
+#include <string.h>
 #include "gmp-impl.h"
 
 /* Multiply the natural numbers u (pointed to by UP) and v (pointed to by VP),
diff --git a/wcsmbs/wcpncpy.c b/wcsmbs/wcpncpy.c
index 634d335..c70373c 100644
--- a/wcsmbs/wcpncpy.c
+++ b/wcsmbs/wcpncpy.c
@@ -17,6 +17,7 @@
    <http://www.gnu.org/licenses/>.  */

 #include <wchar.h>
+#include <string.h>


 /* Copy no more than N wide-characters of SRC to DEST, returning the
diff --git a/wcsmbs/wcsncpy.c b/wcsmbs/wcsncpy.c
index a88f8fc..0b39083 100644
--- a/wcsmbs/wcsncpy.c
+++ b/wcsmbs/wcsncpy.c
@@ -17,6 +17,7 @@
    <http://www.gnu.org/licenses/>.  */

 #include <wchar.h>
+#include <string.h>


 /* Copy no more than N wide-characters of SRC to DEST. */


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]