summaryrefslogtreecommitdiffstats
path: root/libafbwsc.pc.in
blob: 78172012e7206b8c2b324e4347890862272091ad (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
##
## Copyright (C) 2016, 2017 "IoT.bzh"
## Author: José Bollo <jose.bollo@iot.bzh>
##
## This file is part of afb-daemon project.
##
## Licensed under the Apache License, Version 2.0 (the "License");
## you may not use this file except in compliance with the License.
## You may obtain a copy of the License at
##
##   http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in writing, software
## distributed under the License is distributed on an "AS IS" BASIS,
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
## See the License for the specific language governing permissions and
## limitations under the License.
##

includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@
libdir=@CMAKE_INSTALL_FULL_LIBDIR@

Name: @PROJECT_PRETTY_NAME@
Description: @PROJECT_DESCRIPTION@
Version: @PROJECT_VERSION@
URL: @PROJECT_URL@

Requires: json-c libsystemd
Cflags: -I${includedir}
Libs: -L${libdir} -lafbwsc
t-weight: bold } /* Literal.Number */ .highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */ .highlight .na { color: #336699 } /* Name.Attribute */ .highlight .nb { color: #003388 } /* Name.Builtin */ .highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */ .highlight .no { color: #003366; font-weight: bold } /* Name.Constant */ .highlight .nd { color: #555555 } /* Name.Decorator */ .highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */ .highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */ .highlight .nl { color: #336699; font-style: italic } /* Name.Label */ .highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */ .highlight .py { color: #336699; font-weight: bold } /* Name.Property */ .highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ .highlight .nv { color: #336699 } /* Name.Variable */ .highlight .ow { color: #008800 } /* Operator.Word */ .highlight .w { color: #bbbbbb } /* Text.Whitespace */ .highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */ .highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ .highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */ }
From ab0d7e270d89f6eb99582197d2d58bf60c9c3d26 Mon Sep 17 00:00:00 2001
From: Anton Gerasimov <anton@advancedtelematic.com>
Date: Thu, 15 Sep 2016 16:49:32 +0200
Subject: [PATCH 2/2] Replace wraps with built-in code to remove dependency on
 multilib

---
 arch/x86/config.mk |   2 --
 arch/x86/lib/gcc.c | 104 ++++++++++++++++++++++++++++++++++++++++++++---------
 2 files changed, 87 insertions(+), 19 deletions(-)

diff --git a/arch/x86/config.mk b/arch/x86/config.mk
index 999143e..139576e 100644
--- a/arch/x86/config.mk
+++ b/arch/x86/config.mk
@@ -22,5 +22,3 @@ PLATFORM_RELFLAGS += -ffunction-sections -fvisibility=hidden
 PLATFORM_LDFLAGS += --emit-relocs -Bsymbolic -Bsymbolic-functions -m elf_i386
 
 LDFLAGS_FINAL += --gc-sections -pie
-LDFLAGS_FINAL += --wrap=__divdi3 --wrap=__udivdi3
-LDFLAGS_FINAL += --wrap=__moddi3 --wrap=__umoddi3
diff --git a/arch/x86/lib/gcc.c b/arch/x86/lib/gcc.c
index 497ad75..c321b11 100644
--- a/arch/x86/lib/gcc.c
+++ b/arch/x86/lib/gcc.c
@@ -19,22 +19,92 @@
 
 #ifdef __GNUC__
 
-/*
- * 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)
+#include <stdint.h>
+#include <stddef.h>
+
+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.3