Upstream-Status: Pending

Workaround a problem with the C++ global constructors on ARM.

As documented in the Yocto Bugzilla bug 938, the global constructors 
that define DEF_BUILTIN [const IdString _foo ( "foo" );] are not running 
before the usage of _foo during the initialization of the compatibility 
table.

The patch, along with a similar change to the recipe generation of the 
oe-arch.h file, remove the DEF_BUILTIN globals and replace them with
immediate strings wherever they are used.

Signed-off-by: Mark Hatle <mark.hatle@windriver.com>

Index: git/zypp/Arch.cc
===================================================================
--- git.orig/zypp/Arch.cc	2011-08-04 21:03:31.000000000 -0700
+++ git/zypp/Arch.cc	2011-08-04 21:04:16.635480895 -0700
@@ -152,13 +152,10 @@
     // NOTE: Thake care CompatBits::IntT is able to provide one
     //       bit for each architecture.
     //
-#define DEF_BUILTIN(A) const IdString  _##A( #A );
-    DEF_BUILTIN( all );
-    DEF_BUILTIN( any );
-    DEF_BUILTIN( noarch );
+/* Global constructors are not working properly on ARM, avoid the
+ * known bad case and merge constructors in with the usages
+ */
 
-#include "oe-arch.h"
-#undef DEF_BUILTIN
 
     ///////////////////////////////////////////////////////////////////
     //
@@ -227,9 +224,9 @@
         // _noarch must have _idBit 0.
         // Other builtins have 1-bit set
         // and are initialized done on the fly.
-        _compatSet.insert( Arch::CompatEntry( _all, 0 ) );
-        _compatSet.insert( Arch::CompatEntry( _any, 0 ) );
-        _compatSet.insert( Arch::CompatEntry( _noarch, 0 ) );
+        _compatSet.insert( Arch::CompatEntry( IdString ( "all" ), 0 ) );
+        _compatSet.insert( Arch::CompatEntry( IdString ( "any" ), 0 ) );
+        _compatSet.insert( Arch::CompatEntry( IdString ( "noarch" ), 0 ) );
         ///////////////////////////////////////////////////////////////////
         // Define the CompatibleWith relation:
         //
@@ -331,9 +328,9 @@
   ///////////////////////////////////////////////////////////////////
 
   const Arch Arch_empty ( IdString::Empty );
-  const Arch Arch_all( _all );
-  const Arch Arch_any( _any );
-  const Arch Arch_noarch( _noarch );
+  const Arch Arch_all( IdString ( "all" ) );
+  const Arch Arch_any( IdString ( "any" ) );
+  const Arch Arch_noarch( IdString ( "noarch" ) );
 
 #define OE_PROTO 1
 #include "oe-arch.h"
@@ -345,7 +342,7 @@
   //	METHOD TYPE : Ctor
   //
   Arch::Arch()
-  : _entry( &ArchCompatSet::instance().assertDef( _noarch ) )
+  : _entry( &ArchCompatSet::instance().assertDef( IdString ( "noarch" ) ) )
   {}
 
   Arch::Arch( IdString::IdType id_r )
