Patchwork [Patch/libiberty] Assume strncmp works in cross compilation

login
register
mail settings
Submitter Tristan Gingold
Date Dec. 19, 2011, 4:21 p.m.
Message ID <826D248B-5400-4EA6-AA34-48412AA24338@adacore.com>
Download mbox | patch
Permalink /patch/132284/
State New
Headers show

Comments

Tristan Gingold - Dec. 19, 2011, 4:21 p.m.
Hi,

currently libiberty will compile strncmp while building a cross compiler.  This is due to the fact that the test for strncmp is a TRY_RUN test.

My issue is that VMS doesn't like a redefinition of a standard function, because it always uses a shared library for C and doesn't support symbol preemption.

I'd like to reverse the decision for strncmp in cross-case.  I understand that there is no ideal solution as both decision may fail on different setup.  But:
* according to the comment, the test was made for SunOS4 (at least), which is not anymore supported by gcc
* defining a standard ANSI-C function in user code is not valid (as far as I understand from the standard)

Ok for trunk ?

Tristan.

libiberty/
2011-12-19  Tristan Gingold  <gingold@adacore.com>

	* aclocal.m4: Assume strncmp works in cross case.
	* configure: Regenerate.
Ian Taylor - Dec. 19, 2011, 6:11 p.m.
Tristan Gingold <gingold@adacore.com> writes:

> 2011-12-19  Tristan Gingold  <gingold@adacore.com>
>
> 	* aclocal.m4: Assume strncmp works in cross case.
> 	* configure: Regenerate.

This is OK.

Thanks.

Ian
Tristan Gingold - Dec. 20, 2011, 8:12 a.m.
On Dec 19, 2011, at 7:11 PM, Ian Lance Taylor wrote:

> Tristan Gingold <gingold@adacore.com> writes:
> 
>> 2011-12-19  Tristan Gingold  <gingold@adacore.com>
>> 
>> 	* aclocal.m4: Assume strncmp works in cross case.
>> 	* configure: Regenerate.
> 
> This is OK.

Thanks, committed.

Tristan.

Patch

diff --git a/libiberty/aclocal.m4 b/libiberty/aclocal.m4
index a528604..bf8a907 100644
--- a/libiberty/aclocal.m4
+++ b/libiberty/aclocal.m4
@@ -72,7 +72,7 @@  main ()
   exit (0);
 }
 ], ac_cv_func_strncmp_works=yes, ac_cv_func_strncmp_works=no,
-  ac_cv_func_strncmp_works=no)
+  ac_cv_func_strncmp_works=yes)
 rm -f core core.* *.core])
 if test $ac_cv_func_strncmp_works = no ; then
   AC_LIBOBJ([strncmp])