summaryrefslogtreecommitdiffstats
path: root/meta-sota-minnowboard/recipes-bsp/u-boot/u-boot-ota/0002-Replace-wraps-with-built-in-code-to-remove-dependenc.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta-sota-minnowboard/recipes-bsp/u-boot/u-boot-ota/0002-Replace-wraps-with-built-in-code-to-remove-dependenc.patch')
-rw-r--r--meta-sota-minnowboard/recipes-bsp/u-boot/u-boot-ota/0002-Replace-wraps-with-built-in-code-to-remove-dependenc.patch142
1 files changed, 0 insertions, 142 deletions
diff --git a/meta-sota-minnowboard/recipes-bsp/u-boot/u-boot-ota/0002-Replace-wraps-with-built-in-code-to-remove-dependenc.patch b/meta-sota-minnowboard/recipes-bsp/u-boot/u-boot-ota/0002-Replace-wraps-with-built-in-code-to-remove-dependenc.patch
deleted file mode 100644
index f1fcd06..0000000
--- a/meta-sota-minnowboard/recipes-bsp/u-boot/u-boot-ota/0002-Replace-wraps-with-built-in-code-to-remove-dependenc.patch
+++ /dev/null
@@ -1,142 +0,0 @@
1From ab0d7e270d89f6eb99582197d2d58bf60c9c3d26 Mon Sep 17 00:00:00 2001
2From: Anton Gerasimov <anton@advancedtelematic.com>
3Date: Thu, 15 Sep 2016 16:49:32 +0200
4Subject: [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 | 104 ++++++++++++++++++++++++++++++++++++++++++++---------
10 2 files changed, 87 insertions(+), 20 deletions(-)
11
12diff --git a/arch/x86/config.mk b/arch/x86/config.mk
13index 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
26diff --git a/arch/x86/lib/gcc.c b/arch/x86/lib/gcc.c
27index 497ad75..c321b11 100644
28--- a/arch/x86/lib/gcc.c
29+++ b/arch/x86/lib/gcc.c
30@@ -19,22 +19,92 @@
31
32 #ifdef __GNUC__
33
34-/*
35- * GCC's libgcc handling is quite broken. While the libgcc functions
36- * are always regparm(0) the code that calls them uses whatever the
37- * compiler call specifies. Therefore we need a wrapper around those
38- * functions. See gcc bug PR41055 for more information.
39- */
40-#define WRAP_LIBGCC_CALL(type, name) \
41- type __normal_##name(type a, type b) __attribute__((regparm(0))); \
42- type __wrap_##name(type a, type b); \
43- type __attribute__((no_instrument_function)) \
44- __wrap_##name(type a, type b) \
45- { return __normal_##name(a, b); }
46-
47-WRAP_LIBGCC_CALL(long long, __divdi3)
48-WRAP_LIBGCC_CALL(unsigned long long, __udivdi3)
49-WRAP_LIBGCC_CALL(long long, __moddi3)
50-WRAP_LIBGCC_CALL(unsigned long long, __umoddi3)
51+#include <stdint.h>
52+#include <stddef.h>
53+
54+uint64_t __udivmoddi4 ( uint64_t num,
55+ uint64_t den,
56+ uint64_t *rem_p )
57+{
58+ uint64_t quot = 0, qbit = 1;
59+
60+ if ( den == 0 ) {
61+ return 1/((unsigned)den); /* Intentional divide by zero, without
62+ triggering a compiler warning which
63+ would abort the build */
64+ }
65+
66+ /* Left-justify denominator and count shift */
67+ while ( (int64_t)den >= 0 ) {
68+ den <<= 1;
69+ qbit <<= 1;
70+ }
71+
72+ while ( qbit ) {
73+ if ( den <= num ) {
74+ num -= den;
75+ quot += qbit;
76+ }
77+ den >>= 1;
78+ qbit >>= 1;
79+ }
80+
81+ if ( rem_p )
82+ *rem_p = num;
83+
84+ return quot;
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+
126+int64_t __moddi3 (int64_t num, int64_t den)
127+{
128+ int64_t v;
129+
130+ (void) __divmoddi4(num, den, &v);
131+ return v;
132+}
133+
134+int64_t __divdi3(int64_t num, int64_t den)
135+{
136+ return __divmoddi4(num, den, NULL);
137+}
138
139 #endif
140--
1412.9.3
142