Patchwork [ARM/,configury] Add fall-back check for gnu_unique_object

login
register
mail settings
Submitter Ramana Radhakrishnan
Date March 14, 2012, 3:37 p.m.
Message ID <CACUk7=Ww7PPuoFFY8H3P8m+e5Jznu10OF9H0KWfVY3x9vCAR8A@mail.gmail.com>
Download mbox | patch
Permalink /patch/146639/
State New
Headers show

Comments

Ramana Radhakrishnan - March 14, 2012, 3:37 p.m.
On 12 March 2012 18:10, DJ Delorie <dj@redhat.com> wrote:
>
> Looks OK to me.

I was about to commit this into my svn checkout and then realized the
patch p4 didn't have the changes to configure - So I regenerated it
again and then began a journey into the depths of m4 and autoconf for
a bit before I gave up. Empirically I spotted this odd behaviour  with
gcc_GAS_CHECK_FEATURE and comments - Attached are the 2 alternate
patches that I tried and the difference in the configure scripts
themselves . I am no m4 expert but it does look like the m4_substr in
gcc_GAS_CHECK_FEATURE doesn't really like that comment there.

Any ideas anyone ? I must decline any knowledge of m4 at this point
and I don't want to commit this until I understand what's going on
here.

Ramana

- correct-configure-output.txt : Patch where everything looks sane.
- incorrect-configure-output.txt:  Patch where everything looks insane.
- Diffs in the configure output : differences in configure files - for
ease of viewing.

Index: configure.ac
===================================================================
--- configure.ac	(revision 185343)
+++ configure.ac	(working copy)
@@ -4177,7 +4177,8 @@
   esac],
  [gcc_GAS_CHECK_FEATURE([gnu_unique_object], gcc_cv_as_gnu_unique_object,
    [elf,2,19,52],,
-   [.type foo, @gnu_unique_object],,
+# We need to unquote above to to use the definition from config.gcc.
+   [.type foo, '$target_type_format_char'gnu_unique_object],,
 # Also check for ld.so support, i.e. glibc 2.11 or higher.
    [[if test x$host = x$build -a x$host = x$target &&
        ldd --version 2>/dev/null &&
Index: configure
===================================================================
--- configure	(revision 185343)
+++ configure	(working copy)
@@ -26167,7 +26167,7 @@
   then gcc_cv_as_gnu_unique_object=yes
 fi
   elif test x$gcc_cv_as != x; then
-    $as_echo '.type foo, @gnu_unique_object' > conftest.s
+    $as_echo  > conftest.s
     if { ac_try='$gcc_cv_as $gcc_cv_as_flags  -o conftest.o conftest.s >&5'
   { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
   (eval $ac_try) 2>&5
Index: config.gcc
===================================================================
--- config.gcc	(revision 185343)
+++ config.gcc	(working copy)
@@ -182,6 +182,11 @@
 #			the --with-sysroot configure option or the
 #			--sysroot command line option is used this
 #			will be relative to the sysroot.
+# target_type_format_char 
+# 			The default character to be used for formatting
+#			the attribute in a
+#			.type symbol_name, ${t_t_f_c}<property>
+#			directive.
 
 # The following variables are used in each case-construct to build up the
 # outgoing variables:
@@ -232,6 +237,7 @@
 need_64bit_hwint=
 need_64bit_isa=
 native_system_header_dir=/usr/include
+target_type_format_char='@'
 
 # Don't carry these over build->host->target.  Please.
 xm_file=
@@ -316,6 +322,7 @@
 arm*-*-*)
 	cpu_type=arm
 	extra_headers="mmintrin.h arm_neon.h"
+	target_type_format_char='%'
 	c_target_objs="arm-c.o"
 	cxx_target_objs="arm-c.o"
 	extra_options="${extra_options} arm/arm-tables.opt"
--- configure	2012-03-14 15:20:52.591266022 +0000
+++ configure-correct	2012-03-14 15:20:11.035268052 +0000
@@ -26167,7 +26167,7 @@
   then gcc_cv_as_gnu_unique_object=yes
 fi
   elif test x$gcc_cv_as != x; then
-    $as_echo  > conftest.s
+    $as_echo '.type foo, '$target_type_format_char'gnu_unique_object' > conftest.s
     if { ac_try='$gcc_cv_as $gcc_cv_as_flags  -o conftest.o conftest.s >&5'
   { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
   (eval $ac_try) 2>&5
@@ -26186,7 +26186,8 @@
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_as_gnu_unique_object" >&5
 $as_echo "$gcc_cv_as_gnu_unique_object" >&6; }
 if test $gcc_cv_as_gnu_unique_object = yes; then
-  # Also check for ld.so support, i.e. glibc 2.11 or higher.
+  # We need to unquote above to to use the definition from config.gcc.
+# Also check for ld.so support, i.e. glibc 2.11 or higher.
    if test x$host = x$build -a x$host = x$target &&
        ldd --version 2>/dev/null &&
        glibcver=`ldd --version 2>/dev/null | sed 's/.* //;q'`; then
Paolo Bonzini - March 14, 2012, 3:52 p.m.
Il 14/03/2012 16:37, Ramana Radhakrishnan ha scritto:
> Empirically I spotted this odd behaviour  with
> gcc_GAS_CHECK_FEATURE and comments - Attached are the 2 alternate
> patches that I tried and the difference in the configure scripts
> themselves . I am no m4 expert but it does look like the m4_substr in
> gcc_GAS_CHECK_FEATURE doesn't really like that comment there.
> 
> Any ideas anyone ? I must decline any knowledge of m4 at this point
> and I don't want to commit this until I understand what's going on
> here.

Yes, the # comment is actually part of the macro argument.  If you want
to write a "real" comment (i.e. at the m4 rather than shell level) use
"dnl" instead of "#".

The patch with correct configure output is ok.

Paolo
Andreas Schwab - March 14, 2012, 4:34 p.m.
Paolo Bonzini <bonzini@gnu.org> writes:

> Yes, the # comment is actually part of the macro argument.  If you want
> to write a "real" comment (i.e. at the m4 rather than shell level) use
> "dnl" instead of "#".

Actually both are part of the macro argument and act like comment
introducers at the m4 level, but they differ in what they expand to.

Andreas.

Patch

Index: configure.ac
===================================================================
--- configure.ac	(revision 185343)
+++ configure.ac	(working copy)
@@ -4177,7 +4177,8 @@ 
   esac],
  [gcc_GAS_CHECK_FEATURE([gnu_unique_object], gcc_cv_as_gnu_unique_object,
    [elf,2,19,52],,
-   [.type foo, @gnu_unique_object],,
+   [.type foo, '$target_type_format_char'gnu_unique_object],,
+# We need to unquote above to to use the definition from config.gcc.
 # Also check for ld.so support, i.e. glibc 2.11 or higher.
    [[if test x$host = x$build -a x$host = x$target &&
        ldd --version 2>/dev/null &&
Index: configure
===================================================================
--- configure	(revision 185343)
+++ configure	(working copy)
@@ -26167,7 +26167,7 @@ 
   then gcc_cv_as_gnu_unique_object=yes
 fi
   elif test x$gcc_cv_as != x; then
-    $as_echo '.type foo, @gnu_unique_object' > conftest.s
+    $as_echo '.type foo, '$target_type_format_char'gnu_unique_object' > conftest.s
     if { ac_try='$gcc_cv_as $gcc_cv_as_flags  -o conftest.o conftest.s >&5'
   { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
   (eval $ac_try) 2>&5
@@ -26186,7 +26186,8 @@ 
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_as_gnu_unique_object" >&5
 $as_echo "$gcc_cv_as_gnu_unique_object" >&6; }
 if test $gcc_cv_as_gnu_unique_object = yes; then
-  # Also check for ld.so support, i.e. glibc 2.11 or higher.
+  # We need to unquote above to to use the definition from config.gcc.
+# Also check for ld.so support, i.e. glibc 2.11 or higher.
    if test x$host = x$build -a x$host = x$target &&
        ldd --version 2>/dev/null &&
        glibcver=`ldd --version 2>/dev/null | sed 's/.* //;q'`; then
Index: config.gcc
===================================================================
--- config.gcc	(revision 185343)
+++ config.gcc	(working copy)
@@ -182,6 +182,11 @@ 
 #			the --with-sysroot configure option or the
 #			--sysroot command line option is used this
 #			will be relative to the sysroot.
+# target_type_format_char 
+# 			The default character to be used for formatting
+#			the attribute in a
+#			.type symbol_name, ${t_t_f_c}<property>
+#			directive.
 
 # The following variables are used in each case-construct to build up the
 # outgoing variables:
@@ -232,6 +237,7 @@ 
 need_64bit_hwint=
 need_64bit_isa=
 native_system_header_dir=/usr/include
+target_type_format_char='@'
 
 # Don't carry these over build->host->target.  Please.
 xm_file=
@@ -316,6 +322,7 @@ 
 arm*-*-*)
 	cpu_type=arm
 	extra_headers="mmintrin.h arm_neon.h"
+	target_type_format_char='%'
 	c_target_objs="arm-c.o"
 	cxx_target_objs="arm-c.o"
 	extra_options="${extra_options} arm/arm-tables.opt"