diff options
author | Mark Hatle <mark.hatle@windriver.com> | 2011-03-29 21:16:16 -0500 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2011-03-31 22:02:47 +0100 |
commit | 37f3ef2cfd385f4481b250e00fa74ca9104c1da4 (patch) | |
tree | 0aae0a0d155968973280dfee2bf1c7044900e9c0 /meta | |
parent | 41efbe13cb2f8b4b78c6049446cd14f9b086520d (diff) | |
download | poky-37f3ef2cfd385f4481b250e00fa74ca9104c1da4.tar.gz |
Workaround for Global C++ Constructor problem on ARM
[YOCTO #938]
Workaround for a problem with the order of the global C++ constructors on ARM.
The workaround is simply to avoid defining the ID numbers outside of the
usage of the ID's.
This also has the effect of fixing a problem on MIPS, where "_mips" is a
defined symbol and unavailable on the system for a variable name.
(From OE-Core rev: b308149b4b7d2066390aa4eaa7364af3334f70f5)
Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r-- | meta/recipes-extended/libzypp/libzypp/arm-workaround-global-constructor.patch | 68 | ||||
-rw-r--r-- | meta/recipes-extended/libzypp/libzypp_git.bb | 47 |
2 files changed, 105 insertions, 10 deletions
diff --git a/meta/recipes-extended/libzypp/libzypp/arm-workaround-global-constructor.patch b/meta/recipes-extended/libzypp/libzypp/arm-workaround-global-constructor.patch new file mode 100644 index 0000000000..efcadc94c4 --- /dev/null +++ b/meta/recipes-extended/libzypp/libzypp/arm-workaround-global-constructor.patch | |||
@@ -0,0 +1,68 @@ | |||
1 | Workaround a problem with the C++ global constructors on ARM. | ||
2 | |||
3 | As documented in the Yocto Bugzilla bug 938, the global constructors | ||
4 | that define DEF_BUILTIN [const IdString _foo ( "foo" );] are not running | ||
5 | before the usage of _foo during the initialization of the compatibility | ||
6 | table. | ||
7 | |||
8 | The patch, along with a similar change to the recipe generation of the | ||
9 | poky-arch.h file, remove the DEF_BUILTIN globals and replace them with | ||
10 | immediate strings wherever they are used. | ||
11 | |||
12 | Signed-off-by: Mark Hatle <mark.hatle@windriver.com> | ||
13 | |||
14 | diff -ur git.orig/zypp/Arch.cc git/zypp/Arch.cc | ||
15 | --- git.orig/zypp/Arch.cc 2011-03-29 14:15:32.695079271 -0500 | ||
16 | +++ git/zypp/Arch.cc 2011-03-29 14:17:22.680910025 -0500 | ||
17 | @@ -152,13 +152,10 @@ | ||
18 | // NOTE: Thake care CompatBits::IntT is able to provide one | ||
19 | // bit for each architecture. | ||
20 | // | ||
21 | -#define DEF_BUILTIN(A) const IdString _##A( #A ); | ||
22 | - DEF_BUILTIN( all ); | ||
23 | - DEF_BUILTIN( any ); | ||
24 | - DEF_BUILTIN( noarch ); | ||
25 | |||
26 | -#include "poky-arch.h" | ||
27 | -#undef DEF_BUILTIN | ||
28 | +/* Global constructors are not working properly on ARM, avoid the | ||
29 | + * known bad case and merge constructors in with the usages | ||
30 | + */ | ||
31 | |||
32 | /////////////////////////////////////////////////////////////////// | ||
33 | // | ||
34 | @@ -227,9 +224,9 @@ | ||
35 | // _noarch must have _idBit 0. | ||
36 | // Other builtins have 1-bit set | ||
37 | // and are initialized done on the fly. | ||
38 | - _compatSet.insert( Arch::CompatEntry( _all, 0 ) ); | ||
39 | - _compatSet.insert( Arch::CompatEntry( _any, 0 ) ); | ||
40 | - _compatSet.insert( Arch::CompatEntry( _noarch, 0 ) ); | ||
41 | + _compatSet.insert( Arch::CompatEntry( IdString ( "all" ), 0 ) ); | ||
42 | + _compatSet.insert( Arch::CompatEntry( IdString ( "any" ), 0 ) ); | ||
43 | + _compatSet.insert( Arch::CompatEntry( IdString ( "noarch" ), 0 ) ); | ||
44 | /////////////////////////////////////////////////////////////////// | ||
45 | // Define the CompatibleWith relation: | ||
46 | // | ||
47 | @@ -305,9 +302,9 @@ | ||
48 | /////////////////////////////////////////////////////////////////// | ||
49 | |||
50 | const Arch Arch_empty ( IdString::Empty ); | ||
51 | - const Arch Arch_all( _all ); | ||
52 | - const Arch Arch_any( _any ); | ||
53 | - const Arch Arch_noarch( _noarch ); | ||
54 | + const Arch Arch_all( IdString ( "all" ) ); | ||
55 | + const Arch Arch_any( IdString ( "any" ) ); | ||
56 | + const Arch Arch_noarch( IdString ( "noarch" ) ); | ||
57 | |||
58 | #define POKY_PROTO 1 | ||
59 | #include "poky-arch.h" | ||
60 | @@ -316,7 +316,7 @@ | ||
61 | // METHOD TYPE : Ctor | ||
62 | // | ||
63 | Arch::Arch() | ||
64 | - : _entry( &ArchCompatSet::instance().assertDef( _noarch ) ) | ||
65 | + : _entry( &ArchCompatSet::instance().assertDef( IdString ( "noarch" ) ) ) | ||
66 | {} | ||
67 | |||
68 | Arch::Arch( IdString::IdType id_r ) | ||
diff --git a/meta/recipes-extended/libzypp/libzypp_git.bb b/meta/recipes-extended/libzypp/libzypp_git.bb index 809c1877f5..b473b9ff96 100644 --- a/meta/recipes-extended/libzypp/libzypp_git.bb +++ b/meta/recipes-extended/libzypp/libzypp_git.bb | |||
@@ -25,6 +25,9 @@ SRC_URI = "git://gitorious.org/opensuse/libzypp.git;protocol=git \ | |||
25 | 25 | ||
26 | SRC_URI_append_mips = " file://mips-workaround-gcc-tribool-error.patch" | 26 | SRC_URI_append_mips = " file://mips-workaround-gcc-tribool-error.patch" |
27 | 27 | ||
28 | # ARM specific global constructor workaround | ||
29 | SRC_URI_append_arm = " file://arm-workaround-global-constructor.patch" | ||
30 | |||
28 | FILES_${PN} += "${libdir}/zypp ${datadir}/zypp ${datadir}/icons" | 31 | FILES_${PN} += "${libdir}/zypp ${datadir}/zypp ${datadir}/icons" |
29 | FILES_${PN}-dev += "${datadir}/cmake" | 32 | FILES_${PN}-dev += "${datadir}/cmake" |
30 | 33 | ||
@@ -32,27 +35,38 @@ EXTRA_OECMAKE += "-DLIB=lib" | |||
32 | 35 | ||
33 | PACKAGE_ARCH = "${MACHINE_ARCH}" | 36 | PACKAGE_ARCH = "${MACHINE_ARCH}" |
34 | 37 | ||
38 | AVOID_CONSTRUCTOR = "" | ||
39 | |||
40 | # Due to an ARM specific compiler issue | ||
41 | AVOID_CONSTRUCTOR_arm = "true" | ||
42 | |||
43 | # Due to a potential conflict with '_mips' being a define | ||
44 | AVOID_CONSTRUCTOR_mips = "true" | ||
45 | |||
35 | do_archgen () { | 46 | do_archgen () { |
36 | # We need to dynamically generate our arch file based on the machine | 47 | # We need to dynamically generate our arch file based on the machine |
37 | # configuration | 48 | # configuration |
38 | echo "/* Automatically generated by the libzypp recipes */" > zypp/poky-arch.h | 49 | echo "/* Automatically generated by the libzypp recipes */" > zypp/poky-arch.h |
50 | echo "/* Avoid Constructor: ${AVOID_CONSTRUCTOR} */" >> zypp/poky-arch.h | ||
39 | echo "" >> zypp/poky-arch.h | 51 | echo "" >> zypp/poky-arch.h |
40 | echo "#ifndef POKY_ARCH_H" >> zypp/poky-arch.h | 52 | echo "#ifndef POKY_ARCH_H" >> zypp/poky-arch.h |
41 | echo "#define POKY_ARCH_H 1" >> zypp/poky-arch.h | 53 | echo "#define POKY_ARCH_H 1" >> zypp/poky-arch.h |
42 | echo "#define Arch_machine Arch_${MACHINE_ARCH}" >> zypp/poky-arch.h | 54 | echo "#define Arch_machine Arch_${MACHINE_ARCH}" >> zypp/poky-arch.h |
43 | echo "#endif /* POKY_ARCH_H */" >> zypp/poky-arch.h | 55 | echo "#endif /* POKY_ARCH_H */" >> zypp/poky-arch.h |
44 | echo "" >> zypp/poky-arch.h | 56 | echo "" >> zypp/poky-arch.h |
45 | echo "#ifdef DEF_BUILTIN" >> zypp/poky-arch.h | 57 | if [ "${AVOID_CONSTRUCTOR}" != "true" ]; then |
46 | echo "/* Specify builtin types */" >> zypp/poky-arch.h | 58 | echo "#ifdef DEF_BUILTIN" >> zypp/poky-arch.h |
47 | for each_arch in ${PACKAGE_ARCHS} ; do | 59 | echo "/* Specify builtin types */" >> zypp/poky-arch.h |
60 | for each_arch in ${PACKAGE_ARCHS} ; do | ||
48 | case "$each_arch" in | 61 | case "$each_arch" in |
49 | all | any | noarch) | 62 | all | any | noarch) |
50 | continue;; | 63 | continue;; |
51 | esac | 64 | esac |
52 | echo " DEF_BUILTIN( ${each_arch} );" >> zypp/poky-arch.h | 65 | echo " DEF_BUILTIN( ${each_arch} );" >> zypp/poky-arch.h |
53 | done | 66 | done |
54 | echo "#endif /* DEF_BUILTIN */" >> zypp/poky-arch.h | 67 | echo "#endif /* DEF_BUILTIN */" >> zypp/poky-arch.h |
55 | echo "" >> zypp/poky-arch.h | 68 | echo "" >> zypp/poky-arch.h |
69 | fi | ||
56 | echo "#ifdef POKY_EXTERN_PROTO" >> zypp/poky-arch.h | 70 | echo "#ifdef POKY_EXTERN_PROTO" >> zypp/poky-arch.h |
57 | echo "/* Specify extern prototypes */" >> zypp/poky-arch.h | 71 | echo "/* Specify extern prototypes */" >> zypp/poky-arch.h |
58 | for each_arch in ${PACKAGE_ARCHS} ; do | 72 | for each_arch in ${PACKAGE_ARCHS} ; do |
@@ -71,7 +85,11 @@ do_archgen () { | |||
71 | all | any | noarch) | 85 | all | any | noarch) |
72 | continue;; | 86 | continue;; |
73 | esac | 87 | esac |
74 | echo " const Arch Arch_${each_arch} (_${each_arch});" >> zypp/poky-arch.h | 88 | if [ "${AVOID_CONSTRUCTOR}" != "true" ]; then |
89 | echo " const Arch Arch_${each_arch} (_${each_arch});" >> zypp/poky-arch.h | ||
90 | else | ||
91 | echo " const Arch Arch_${each_arch} ( IdString ( \"${each_arch}\" ) );" >> zypp/poky-arch.h | ||
92 | fi | ||
75 | done | 93 | done |
76 | echo "#endif /* POKY_PROTO */" >> zypp/poky-arch.h | 94 | echo "#endif /* POKY_PROTO */" >> zypp/poky-arch.h |
77 | echo "" >> zypp/poky-arch.h | 95 | echo "" >> zypp/poky-arch.h |
@@ -89,14 +107,23 @@ do_archgen () { | |||
89 | all | any | noarch) | 107 | all | any | noarch) |
90 | shift ; continue;; | 108 | shift ; continue;; |
91 | esac | 109 | esac |
92 | ARCH=_"$1" | 110 | if [ "${AVOID_CONSTRUCTOR}" != "true" ]; then |
111 | ARCH="_$1" | ||
112 | else | ||
113 | ARCH="IdString(\"$1\")" | ||
114 | fi | ||
93 | shift | 115 | shift |
94 | COMPAT="" | 116 | COMPAT="" |
95 | for each_arch in "$@"; do | 117 | for each_arch in "$@"; do |
118 | if [ -z "${AVOID_CONSTRUCTOR}" ]; then | ||
119 | arch_val="_${each_arch}" | ||
120 | else | ||
121 | arch_val="IdString(\"${each_arch}\")" | ||
122 | fi | ||
96 | if [ -z "$COMPAT" ]; then | 123 | if [ -z "$COMPAT" ]; then |
97 | COMPAT=_"$each_arch" | 124 | COMPAT=${arch_val} |
98 | else | 125 | else |
99 | COMPAT=_"$each_arch,$COMPAT" | 126 | COMPAT="${arch_val},$COMPAT" |
100 | fi | 127 | fi |
101 | done | 128 | done |
102 | COMPAT_WITH="${ARCH},${COMPAT} $COMPAT_WITH" | 129 | COMPAT_WITH="${ARCH},${COMPAT} $COMPAT_WITH" |