configure: Restore original endianness test

Message ID 20180308105011.14696-1-diego@biurrun.de
State Committed
Headers show
Series
  • configure: Restore original endianness test
Related show

Commit Message

Diego Biurrun March 8, 2018, 10:50 a.m.
Previously the bit pattern for the endianness test was declared as a
global, instead of a local, variable. This ensures that the pattern
appears unchanged in the object file and is not optimized out.
---
 configure | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Martin Storsjö March 8, 2018, 12:11 p.m. | #1
On Thu, 8 Mar 2018, Diego Biurrun wrote:

> Previously the bit pattern for the endianness test was declared as a
> global, instead of a local, variable. This ensures that the pattern
> appears unchanged in the object file and is not optimized out.
> ---
> configure | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/configure b/configure
> index d59fc6fd1a..188b2d880b 100755
> --- a/configure
> +++ b/configure
> @@ -4211,7 +4211,9 @@ done
> 
> check_cc pragma_deprecated "" '_Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"")'
> 
> -require_cc "endian test" "" "unsigned int endian = 'B' << 24 | 'I' << 16 | 'G' << 8 | 'E'"
> +test_cc <<EOF || die "endian test failed"
> +unsigned int endian = 'B' << 24 | 'I' << 16 | 'G' << 8 | 'E';
> +EOF
> od -t x1 $TMPO | grep -q '42 *49 *47 *45' && enable bigendian
> 
> check_gas() {
> -- 
> 2.11.0

Ok

// Martin
Luca Barbato March 8, 2018, 12:44 p.m. | #2
On 08/03/2018 11:50, Diego Biurrun wrote:
> Previously the bit pattern for the endianness test was declared as a
> global, instead of a local, variable. This ensures that the pattern
> appears unchanged in the object file and is not optimized out.
> ---
>   configure | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/configure b/configure
> index d59fc6fd1a..188b2d880b 100755
> --- a/configure
> +++ b/configure
> @@ -4211,7 +4211,9 @@ done
>   
>   check_cc pragma_deprecated "" '_Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"")'
>   
> -require_cc "endian test" "" "unsigned int endian = 'B' << 24 | 'I' << 16 | 'G' << 8 | 'E'"
> +test_cc <<EOF || die "endian test failed"
> +unsigned int endian = 'B' << 24 | 'I' << 16 | 'G' << 8 | 'E';
> +EOF
>   od -t x1 $TMPO | grep -q '42 *49 *47 *45' && enable bigendian
>   
>   check_gas() {
> 

You might add a comment to make sure nobody would think about 
simplifying it in the future.

lu
Diego Biurrun March 8, 2018, 2:11 p.m. | #3
On Thu, Mar 08, 2018 at 01:44:38PM +0100, Luca Barbato wrote:
> On 08/03/2018 11:50, Diego Biurrun wrote:
> > Previously the bit pattern for the endianness test was declared as a
> > global, instead of a local, variable. This ensures that the pattern
> > appears unchanged in the object file and is not optimized out.
> > --- a/configure
> > +++ b/configure
> > @@ -4211,7 +4211,9 @@ done
> >   check_cc pragma_deprecated "" '_Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"")'
> > -require_cc "endian test" "" "unsigned int endian = 'B' << 24 | 'I' << 16 | 'G' << 8 | 'E'"
> > +test_cc <<EOF || die "endian test failed"
> > +unsigned int endian = 'B' << 24 | 'I' << 16 | 'G' << 8 | 'E';
> > +EOF
> >   od -t x1 $TMPO | grep -q '42 *49 *47 *45' && enable bigendian
> >   check_gas() {
> 
> You might add a comment to make sure nobody would think about simplifying it
> in the future.

Done.

Diego

Patch

diff --git a/configure b/configure
index d59fc6fd1a..188b2d880b 100755
--- a/configure
+++ b/configure
@@ -4211,7 +4211,9 @@  done
 
 check_cc pragma_deprecated "" '_Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"")'
 
-require_cc "endian test" "" "unsigned int endian = 'B' << 24 | 'I' << 16 | 'G' << 8 | 'E'"
+test_cc <<EOF || die "endian test failed"
+unsigned int endian = 'B' << 24 | 'I' << 16 | 'G' << 8 | 'E';
+EOF
 od -t x1 $TMPO | grep -q '42 *49 *47 *45' && enable bigendian
 
 check_gas() {