summaryrefslogtreecommitdiffstats
path: root/meta/recipes-extended/libzypp/libzypp/arm-workaround-global-constructor.patch
blob: bfdb29b593f7b5eabf3ec77c4b7859074e66ca97 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
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 )