summaryrefslogtreecommitdiffstats
path: root/meta/recipes-extended/libzypp/libzypp/arm-workaround-global-constructor.patch
blob: efcadc94c4e82bd442b2a5a0c85cc31f8ef80a14 (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
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 
poky-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>

diff -ur git.orig/zypp/Arch.cc git/zypp/Arch.cc
--- git.orig/zypp/Arch.cc	2011-03-29 14:15:32.695079271 -0500
+++ git/zypp/Arch.cc	2011-03-29 14:17:22.680910025 -0500
@@ -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 );
 
-#include "poky-arch.h"
-#undef DEF_BUILTIN
+/* Global constructors are not working properly on ARM, avoid the
+ * known bad case and merge constructors in with the usages
+ */
 
     ///////////////////////////////////////////////////////////////////
     //
@@ -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:
         //
@@ -305,9 +302,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 POKY_PROTO 1
 #include "poky-arch.h"
@@ -316,7 +316,7 @@
   //	METHOD TYPE : Ctor
   //
   Arch::Arch()
-  : _entry( &ArchCompatSet::instance().assertDef( _noarch ) )
+  : _entry( &ArchCompatSet::instance().assertDef( IdString ( "noarch" ) ) )
   {}
 
   Arch::Arch( IdString::IdType id_r )