Patchwork [libffi,build] Make libffi .ascii/.string test more robust

login
register
mail settings
Submitter Rainer Orth
Date Dec. 1, 2010, 2:51 p.m.
Message ID <yddeia11r76.fsf@manam.CeBiTec.Uni-Bielefeld.DE>
Download mbox | patch
Permalink /patch/73825/
State New
Headers show

Comments

Rainer Orth - Dec. 1, 2010, 2:51 p.m.
I've repeatedly failed to bootstrap mainline on x86_64-unknown-linux-gnu
(RHEL4) with /bin/ksh as CONFIG_SHELL.  The error was

/var/gcc/src/hg/trunk/local/libffi/src/x86/sysv.S:369:2: error: #error missing .ascii/.string
make[7]: *** [src/x86/sysv.lo] Error 1

although gas 2.20.1 was in use which supports both.  It turned out that
the error was in /bin/ksh, which stripped the \ from \"string\" in
AC_TRY_COMPILE, thus trying to compile

	asm (".ascii "string"");

I managed to finish the bootstrap with the \ doubled in configure, and
from running a minimal test script

cat - <<_ACEOF
/* end confdefs.h.  */
asm (".ascii \\"string\\"");
int
main ()
{

  ;
  return 0;
}
_ACEOF

with various shells (/bin/sh, /bin/ksh, bash on Solaris, Tru64 UNIX,
IRIX, and RHEL), it seems that this always works.

Ok for mainline and the 4.4, 4.5 branches after a full rebuild of
libffi?

Thanks.
	Rainer


2010-12-01  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	* configure.ac (libffi_cv_as_ascii_pseudo_op): Use double
	backslashes.
	(libffi_cv_as_string_pseudo_op): Likewise.
	* configure: Regenerate.
Paolo Bonzini - Dec. 1, 2010, 3:03 p.m.
On 12/01/2010 03:51 PM, Rainer Orth wrote:
> Ok for mainline and the 4.4, 4.5 branches after a full rebuild of
> libffi?

Ok.

Paolo

> Thanks.
> 	Rainer
>
>
> 2010-12-01  Rainer Orth<ro@CeBiTec.Uni-Bielefeld.DE>
>
> 	* configure.ac (libffi_cv_as_ascii_pseudo_op): Use double
> 	backslashes.
> 	(libffi_cv_as_string_pseudo_op): Likewise.
> 	* configure: Regenerate.
>
> diff -r 13f6c22ee782 libffi/configure.ac
> --- a/libffi/configure.ac	Wed Dec 01 13:35:11 2010 +0100
> +++ b/libffi/configure.ac	Wed Dec 01 13:59:12 2010 +0100
> @@ -282,7 +282,7 @@
>          libffi_cv_as_ascii_pseudo_op, [
>          libffi_cv_as_ascii_pseudo_op=unknown
>          # Check if we have .ascii
> -       AC_TRY_COMPILE([asm (".ascii \"string\"");],,
> +       AC_TRY_COMPILE([asm (".ascii \\"string\\"");],,
>   		       [libffi_cv_as_ascii_pseudo_op=yes],
>   		       [libffi_cv_as_ascii_pseudo_op=no])
>       ])
> @@ -295,7 +295,7 @@
>          libffi_cv_as_string_pseudo_op, [
>          libffi_cv_as_string_pseudo_op=unknown
>          # Check if we have .string
> -       AC_TRY_COMPILE([asm (".string \"string\"");],,
> +       AC_TRY_COMPILE([asm (".string \\"string\\"");],,
>   		       [libffi_cv_as_string_pseudo_op=yes],
>   		       [libffi_cv_as_string_pseudo_op=no])
>       ])
>

Patch

diff -r 13f6c22ee782 libffi/configure.ac
--- a/libffi/configure.ac	Wed Dec 01 13:35:11 2010 +0100
+++ b/libffi/configure.ac	Wed Dec 01 13:59:12 2010 +0100
@@ -282,7 +282,7 @@ 
        libffi_cv_as_ascii_pseudo_op, [
        libffi_cv_as_ascii_pseudo_op=unknown
        # Check if we have .ascii
-       AC_TRY_COMPILE([asm (".ascii \"string\"");],,
+       AC_TRY_COMPILE([asm (".ascii \\"string\\"");],,
 		       [libffi_cv_as_ascii_pseudo_op=yes],
 		       [libffi_cv_as_ascii_pseudo_op=no])
     ])
@@ -295,7 +295,7 @@ 
        libffi_cv_as_string_pseudo_op, [
        libffi_cv_as_string_pseudo_op=unknown
        # Check if we have .string
-       AC_TRY_COMPILE([asm (".string \"string\"");],,
+       AC_TRY_COMPILE([asm (".string \\"string\\"");],,
 		       [libffi_cv_as_string_pseudo_op=yes],
 		       [libffi_cv_as_string_pseudo_op=no])
     ])