diff options
-rw-r--r-- | recipes-bsp/u-boot/u-boot-ota/0002-Replace-wraps-with-built-in-code-to-remove-dependenc.patch | 141 | ||||
-rw-r--r-- | recipes-bsp/u-boot/u-boot-ota_2016.07.bb | 3 |
2 files changed, 143 insertions, 1 deletions
diff --git a/recipes-bsp/u-boot/u-boot-ota/0002-Replace-wraps-with-built-in-code-to-remove-dependenc.patch b/recipes-bsp/u-boot/u-boot-ota/0002-Replace-wraps-with-built-in-code-to-remove-dependenc.patch new file mode 100644 index 0000000..83e223f --- /dev/null +++ b/recipes-bsp/u-boot/u-boot-ota/0002-Replace-wraps-with-built-in-code-to-remove-dependenc.patch | |||
@@ -0,0 +1,141 @@ | |||
1 | From d5bea58bf85522a289194d59dfab00207ffdfb4f Mon Sep 17 00:00:00 2001 | ||
2 | From: Anton Gerasimov <anton@advancedtelematic.com> | ||
3 | Date: Fri, 26 Aug 2016 13:51:30 +0200 | ||
4 | Subject: [PATCH 2/2] Replace wraps with built-in code to remove dependency on | ||
5 | multilib | ||
6 | |||
7 | --- | ||
8 | arch/x86/config.mk | 3 -- | ||
9 | arch/x86/lib/gcc.c | 97 +++++++++++++++++++++++++++++++++++++++++++++++------- | ||
10 | 2 files changed, 86 insertions(+), 14 deletions(-) | ||
11 | |||
12 | diff --git a/arch/x86/config.mk b/arch/x86/config.mk | ||
13 | index d7addd8..892e0fc 100644 | ||
14 | --- a/arch/x86/config.mk | ||
15 | +++ b/arch/x86/config.mk | ||
16 | @@ -21,9 +21,6 @@ PLATFORM_RELFLAGS += -ffunction-sections -fvisibility=hidden | ||
17 | |||
18 | PLATFORM_LDFLAGS += -Bsymbolic -Bsymbolic-functions -m elf_i386 | ||
19 | |||
20 | -LDFLAGS_FINAL += --wrap=__divdi3 --wrap=__udivdi3 | ||
21 | -LDFLAGS_FINAL += --wrap=__moddi3 --wrap=__umoddi3 | ||
22 | - | ||
23 | # This is used in the top-level Makefile which does not include | ||
24 | # PLATFORM_LDFLAGS | ||
25 | LDFLAGS_EFI_PAYLOAD := -Bsymbolic -Bsymbolic-functions -shared --no-undefined | ||
26 | diff --git a/arch/x86/lib/gcc.c b/arch/x86/lib/gcc.c | ||
27 | index 3c70d79..6b47785 100644 | ||
28 | --- a/arch/x86/lib/gcc.c | ||
29 | +++ b/arch/x86/lib/gcc.c | ||
30 | @@ -8,22 +8,97 @@ | ||
31 | |||
32 | #ifdef __GNUC__ | ||
33 | |||
34 | +#include <stdint.h> | ||
35 | +#include <stddef.h> | ||
36 | /* | ||
37 | * GCC's libgcc handling is quite broken. While the libgcc functions | ||
38 | * are always regparm(0) the code that calls them uses whatever the | ||
39 | * compiler call specifies. Therefore we need a wrapper around those | ||
40 | * functions. See gcc bug PR41055 for more information. | ||
41 | */ | ||
42 | -#define WRAP_LIBGCC_CALL(type, name) \ | ||
43 | - type __normal_##name(type a, type b) __attribute__((regparm(0))); \ | ||
44 | - type __wrap_##name(type a, type b); \ | ||
45 | - type __attribute__((no_instrument_function)) \ | ||
46 | - __wrap_##name(type a, type b) \ | ||
47 | - { return __normal_##name(a, b); } | ||
48 | - | ||
49 | -WRAP_LIBGCC_CALL(long long, __divdi3) | ||
50 | -WRAP_LIBGCC_CALL(unsigned long long, __udivdi3) | ||
51 | -WRAP_LIBGCC_CALL(long long, __moddi3) | ||
52 | -WRAP_LIBGCC_CALL(unsigned long long, __umoddi3) | ||
53 | +uint64_t __udivmoddi4 ( uint64_t num, | ||
54 | + uint64_t den, | ||
55 | + uint64_t *rem_p ) | ||
56 | +{ | ||
57 | + uint64_t quot = 0, qbit = 1; | ||
58 | + | ||
59 | + if ( den == 0 ) { | ||
60 | + return 1/((unsigned)den); /* Intentional divide by zero, without | ||
61 | + triggering a compiler warning which | ||
62 | + would abort the build */ | ||
63 | + } | ||
64 | + | ||
65 | + /* Left-justify denominator and count shift */ | ||
66 | + while ( (int64_t)den >= 0 ) { | ||
67 | + den <<= 1; | ||
68 | + qbit <<= 1; | ||
69 | + } | ||
70 | + | ||
71 | + while ( qbit ) { | ||
72 | + if ( den <= num ) { | ||
73 | + num -= den; | ||
74 | + quot += qbit; | ||
75 | + } | ||
76 | + den >>= 1; | ||
77 | + qbit >>= 1; | ||
78 | + } | ||
79 | + | ||
80 | + if ( rem_p ) | ||
81 | + *rem_p = num; | ||
82 | + | ||
83 | + return quot; | ||
84 | +} | ||
85 | + | ||
86 | +uint64_t __udivdi3( uint64_t num, uint64_t den ) | ||
87 | +{ | ||
88 | + return __udivmoddi4(num, den, NULL); | ||
89 | +} | ||
90 | + | ||
91 | +uint64_t __umoddi3 ( uint64_t num, uint64_t den ) | ||
92 | +{ | ||
93 | + uint64_t v; | ||
94 | + | ||
95 | + (void) __udivmoddi4(num, den, &v); | ||
96 | + return v; | ||
97 | +} | ||
98 | + | ||
99 | +int64_t __divmoddi4 ( int64_t num, | ||
100 | + int64_t den, | ||
101 | + int64_t* rem_p ) | ||
102 | +{ | ||
103 | + int minus = 0; | ||
104 | + int64_t v; | ||
105 | + | ||
106 | + if ( num < 0 ) { | ||
107 | + num = -num; | ||
108 | + minus = 1; | ||
109 | + } | ||
110 | + if ( den < 0 ) { | ||
111 | + den = -den; | ||
112 | + minus ^= 1; | ||
113 | + } | ||
114 | + | ||
115 | + v = __udivmoddi4(num, den, (uint64_t *)rem_p); | ||
116 | + if ( minus ) { | ||
117 | + v = -v; | ||
118 | + if ( rem_p ) | ||
119 | + *rem_p = -(*rem_p); | ||
120 | + } | ||
121 | + | ||
122 | + return v; | ||
123 | +} | ||
124 | + | ||
125 | +int64_t __moddi3 (int64_t num, int64_t den) | ||
126 | +{ | ||
127 | + int64_t v; | ||
128 | + | ||
129 | + (void) __divmoddi4(num, den, &v); | ||
130 | + return v; | ||
131 | +} | ||
132 | + | ||
133 | +int64_t __divdi3(int64_t num, int64_t den) | ||
134 | +{ | ||
135 | + return __divmoddi4(num, den, NULL); | ||
136 | +} | ||
137 | |||
138 | #endif | ||
139 | -- | ||
140 | 2.9.2 | ||
141 | |||
diff --git a/recipes-bsp/u-boot/u-boot-ota_2016.07.bb b/recipes-bsp/u-boot/u-boot-ota_2016.07.bb index 8f0b20a..7d440ef 100644 --- a/recipes-bsp/u-boot/u-boot-ota_2016.07.bb +++ b/recipes-bsp/u-boot/u-boot-ota_2016.07.bb | |||
@@ -9,7 +9,8 @@ LIC_FILES_CHKSUM = "file://Licenses/README;md5=a2c678cfd4a4d97135585cad908541c6" | |||
9 | # repo during parse | 9 | # repo during parse |
10 | SRCREV = "25922d42f8e9e7ae503ae55a972ba1404e5b6a8c" | 10 | SRCREV = "25922d42f8e9e7ae503ae55a972ba1404e5b6a8c" |
11 | 11 | ||
12 | SRC_URI += "file://0001-Set-up-environment-for-OSTree-integration.patch" | 12 | SRC_URI += "file://0001-Set-up-environment-for-OSTree-integration.patch \ |
13 | file://0002-Replace-wraps-with-built-in-code-to-remove-dependenc.patch" | ||
13 | 14 | ||
14 | PV = "v2016.07+git${SRCPV}" | 15 | PV = "v2016.07+git${SRCPV}" |
15 | 16 | ||