summaryrefslogtreecommitdiffstats
path: root/meta-sota
diff options
context:
space:
mode:
authorAnton Gerasimov <anton@advancedtelematic.com>2016-08-29 15:03:08 +0200
committerAnton Gerasimov <anton@advancedtelematic.com>2016-08-29 15:05:06 +0200
commit1efc7cbb5ed4de2092d63af7e48c4a78e48d428f (patch)
tree1f666d4b2ea52129811159d128f0bdb75a7a1a3c /meta-sota
parentdf72ee883ec73cab47cfaa23e0f2feff9f1d2862 (diff)
Replaced links to libgcc functions for 64-bit integer divisions with
ipxe implementation to get rid of multilib Bug-AGL: SPEC-242 Change-Id: I43589a295fd1e499c03c0ff77f04f9af7f1518b0 Signed-off-by: Anton Gerasimov <anton@advancedtelematic.com>
Diffstat (limited to 'meta-sota')
-rw-r--r--meta-sota/recipes-bsp/u-boot/u-boot-ota/0002-Replace-wraps-with-built-in-code-to-remove-dependenc.patch141
-rw-r--r--meta-sota/recipes-bsp/u-boot/u-boot-ota_2016.07.bb3
2 files changed, 143 insertions, 1 deletions
diff --git a/meta-sota/recipes-bsp/u-boot/u-boot-ota/0002-Replace-wraps-with-built-in-code-to-remove-dependenc.patch b/meta-sota/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/meta-sota/recipes-bsp/u-boot/u-boot-ota/0002-Replace-wraps-with-built-in-code-to-remove-dependenc.patch
@@ -0,0 +1,141 @@
+From d5bea58bf85522a289194d59dfab00207ffdfb4f Mon Sep 17 00:00:00 2001
+From: Anton Gerasimov <anton@advancedtelematic.com>
+Date: Fri, 26 Aug 2016 13:51:30 +0200
+Subject: [PATCH 2/2] Replace wraps with built-in code to remove dependency on
+ multilib
+
+---
+ arch/x86/config.mk | 3 --
+ arch/x86/lib/gcc.c | 97 +++++++++++++++++++++++++++++++++++++++++++++++-------
+ 2 files changed, 86 insertions(+), 14 deletions(-)
+
+diff --git a/arch/x86/config.mk b/arch/x86/config.mk
+index d7addd8..892e0fc 100644
+--- a/arch/x86/config.mk
++++ b/arch/x86/config.mk
+@@ -21,9 +21,6 @@ PLATFORM_RELFLAGS += -ffunction-sections -fvisibility=hidden
+
+ PLATFORM_LDFLAGS += -Bsymbolic -Bsymbolic-functions -m elf_i386
+
+-LDFLAGS_FINAL += --wrap=__divdi3 --wrap=__udivdi3
+-LDFLAGS_FINAL += --wrap=__moddi3 --wrap=__umoddi3
+-
+ # This is used in the top-level Makefile which does not include
+ # PLATFORM_LDFLAGS
+ LDFLAGS_EFI_PAYLOAD := -Bsymbolic -Bsymbolic-functions -shared --no-undefined
+diff --git a/arch/x86/lib/gcc.c b/arch/x86/lib/gcc.c
+index 3c70d79..6b47785 100644
+--- a/arch/x86/lib/gcc.c
++++ b/arch/x86/lib/gcc.c
+@@ -8,22 +8,97 @@
+
+ #ifdef __GNUC__
+
++#include <stdint.h>
++#include <stddef.h>
+ /*
+ * GCC's libgcc handling is quite broken. While the libgcc functions
+ * are always regparm(0) the code that calls them uses whatever the
+ * compiler call specifies. Therefore we need a wrapper around those
+ * functions. See gcc bug PR41055 for more information.
+ */
+-#define WRAP_LIBGCC_CALL(type, name) \
+- type __normal_##name(type a, type b) __attribute__((regparm(0))); \
+- type __wrap_##name(type a, type b); \
+- type __attribute__((no_instrument_function)) \
+- __wrap_##name(type a, type b) \
+- { return __normal_##name(a, b); }
+-
+-WRAP_LIBGCC_CALL(long long, __divdi3)
+-WRAP_LIBGCC_CALL(unsigned long long, __udivdi3)
+-WRAP_LIBGCC_CALL(long long, __moddi3)
+-WRAP_LIBGCC_CALL(unsigned long long, __umoddi3)
++uint64_t __udivmoddi4 ( uint64_t num,
++ uint64_t den,
++ uint64_t *rem_p )
++{
++ uint64_t quot = 0, qbit = 1;
++
++ if ( den == 0 ) {
++ return 1/((unsigned)den); /* Intentional divide by zero, without
++ triggering a compiler warning which
++ would abort the build */
++ }
++
++ /* Left-justify denominator and count shift */
++ while ( (int64_t)den >= 0 ) {
++ den <<= 1;
++ qbit <<= 1;
++ }
++
++ while ( qbit ) {
++ if ( den <= num ) {
++ num -= den;
++ quot += qbit;
++ }
++ den >>= 1;
++ qbit >>= 1;
++ }
++
++ if ( rem_p )
++ *rem_p = num;
++
++ return quot;
++}
++
++uint64_t __udivdi3( uint64_t num, uint64_t den )
++{
++ return __udivmoddi4(num, den, NULL);
++}
++
++uint64_t __umoddi3 ( uint64_t num, uint64_t den )
++{
++ uint64_t v;
++
++ (void) __udivmoddi4(num, den, &v);
++ return v;
++}
++
++int64_t __divmoddi4 ( int64_t num,
++ int64_t den,
++ int64_t* rem_p )
++{
++ int minus = 0;
++ int64_t v;
++
++ if ( num < 0 ) {
++ num = -num;
++ minus = 1;
++ }
++ if ( den < 0 ) {
++ den = -den;
++ minus ^= 1;
++ }
++
++ v = __udivmoddi4(num, den, (uint64_t *)rem_p);
++ if ( minus ) {
++ v = -v;
++ if ( rem_p )
++ *rem_p = -(*rem_p);
++ }
++
++ return v;
++}
++
++int64_t __moddi3 (int64_t num, int64_t den)
++{
++ int64_t v;
++
++ (void) __divmoddi4(num, den, &v);
++ return v;
++}
++
++int64_t __divdi3(int64_t num, int64_t den)
++{
++ return __divmoddi4(num, den, NULL);
++}
+
+ #endif
+--
+2.9.2
+
diff --git a/meta-sota/recipes-bsp/u-boot/u-boot-ota_2016.07.bb b/meta-sota/recipes-bsp/u-boot/u-boot-ota_2016.07.bb
index 8f0b20a..7d440ef 100644
--- a/meta-sota/recipes-bsp/u-boot/u-boot-ota_2016.07.bb
+++ b/meta-sota/recipes-bsp/u-boot/u-boot-ota_2016.07.bb
@@ -9,7 +9,8 @@ LIC_FILES_CHKSUM = "file://Licenses/README;md5=a2c678cfd4a4d97135585cad908541c6"
# repo during parse
SRCREV = "25922d42f8e9e7ae503ae55a972ba1404e5b6a8c"
-SRC_URI += "file://0001-Set-up-environment-for-OSTree-integration.patch"
+SRC_URI += "file://0001-Set-up-environment-for-OSTree-integration.patch \
+ file://0002-Replace-wraps-with-built-in-code-to-remove-dependenc.patch"
PV = "v2016.07+git${SRCPV}"