summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ldso/dynlink.c22
-rw-r--r--src/locale/strfmon.c30
-rw-r--r--src/math/i386/hypot.s45
-rw-r--r--src/math/i386/hypotf.s42
4 files changed, 130 insertions, 9 deletions
diff --git a/src/ldso/dynlink.c b/src/ldso/dynlink.c
index 6ff8850c..e0013ec0 100644
--- a/src/ldso/dynlink.c
+++ b/src/ldso/dynlink.c
@@ -1,4 +1,3 @@
-#ifdef __PIC__
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -18,6 +17,10 @@
#include <ctype.h>
#include <dlfcn.h>
+static int errflag;
+
+#ifdef __PIC__
+
#include "reloc.h"
#if ULONG_MAX == 0xffffffff
@@ -631,12 +634,13 @@ void *dlopen(const char *file, int mode)
tail = orig_tail;
tail->next = 0;
p = 0;
+ } else p = load_library(file);
+
+ if (!p) {
+ errflag = 1;
goto end;
}
- p = load_library(file);
- if (!p) goto end;
-
/* First load handling */
if (!p->deps) {
load_deps(p);
@@ -674,8 +678,11 @@ static void *do_dlsym(struct dso *p, const char *s, void *ra)
if (!p) p=head;
p=p->next;
}
- if (p == head || p == RTLD_DEFAULT)
- return find_sym(head, s, 0);
+ if (p == head || p == RTLD_DEFAULT) {
+ void *res = find_sym(head, s, 0);
+ if (!res) errflag = 1;
+ return res;
+ }
h = hash(s);
sym = lookup(s, h, p->syms, p->hashtab, p->strings);
if (sym && sym->st_value && (1<<(sym->st_info&0xf) & OK_TYPES))
@@ -686,6 +693,7 @@ static void *do_dlsym(struct dso *p, const char *s, void *ra)
if (sym && sym->st_value && (1<<(sym->st_info&0xf) & OK_TYPES))
return p->deps[i]->base + sym->st_value;
}
+ errflag = 1;
return 0;
}
@@ -710,6 +718,8 @@ void *__dlsym(void *p, const char *s, void *ra)
char *dlerror()
{
+ if (!errflag) return 0;
+ errflag = 0;
return "unknown error";
}
diff --git a/src/locale/strfmon.c b/src/locale/strfmon.c
index 66bee482..81dfe38f 100644
--- a/src/locale/strfmon.c
+++ b/src/locale/strfmon.c
@@ -3,16 +3,15 @@
#include <stdarg.h>
#include <monetary.h>
#include <errno.h>
+#include <stdarg.h>
-ssize_t strfmon(char *s, size_t n, const char *fmt, ...)
+static ssize_t vstrfmon_l(char *s, size_t n, locale_t loc, const char *fmt, va_list ap)
{
size_t l;
double x;
int fill, nogrp, negpar, nosym, left, intl;
int lp, rp, w, fw;
char *s0=s;
- va_list ap;
- va_start(ap, fmt);
for (; n && *fmt; ) {
if (*fmt != '%') {
literal:
@@ -75,3 +74,28 @@ ssize_t strfmon(char *s, size_t n, const char *fmt, ...)
}
return s-s0;
}
+
+ssize_t strfmon_l(char *s, size_t n, locale_t loc, const char *fmt, ...)
+{
+ va_list ap;
+ ssize_t ret;
+
+ va_start(ap, fmt);
+ ret = vstrfmon_l(s, n, loc, fmt, ap);
+ va_end(ap);
+
+ return ret;
+}
+
+
+ssize_t strfmon(char *s, size_t n, const char *fmt, ...)
+{
+ va_list ap;
+ ssize_t ret;
+
+ va_start(ap, fmt);
+ ret = vstrfmon_l(s, n, 0, fmt, ap);
+ va_end(ap);
+
+ return ret;
+}
diff --git a/src/math/i386/hypot.s b/src/math/i386/hypot.s
new file mode 100644
index 00000000..299c2e18
--- /dev/null
+++ b/src/math/i386/hypot.s
@@ -0,0 +1,45 @@
+.global hypot
+.type hypot,@function
+hypot:
+ mov 8(%esp),%eax
+ mov 16(%esp),%ecx
+ add %eax,%eax
+ add %ecx,%ecx
+ and %eax,%ecx
+ cmp $0xffe00000,%ecx
+ jae 2f
+ or 4(%esp),%eax
+ jnz 1f
+ fldl 12(%esp)
+ fabs
+ ret
+1: mov 16(%esp),%eax
+ add %eax,%eax
+ or 12(%esp),%eax
+ jnz 1f
+ fldl 4(%esp)
+ fabs
+ ret
+1: fldl 4(%esp)
+ fld %st(0)
+ fmulp
+ fldl 12(%esp)
+ fld %st(0)
+ fmulp
+ faddp
+ fsqrt
+ ret
+2: sub $0xffe00000,%eax
+ or 4(%esp),%eax
+ jnz 1f
+ fldl 4(%esp)
+ fabs
+ ret
+1: mov 16(%esp),%eax
+ add %eax,%eax
+ sub $0xffe00000,%eax
+ or 12(%esp),%eax
+ fldl 12(%esp)
+ jnz 1f
+ fabs
+1: ret
diff --git a/src/math/i386/hypotf.s b/src/math/i386/hypotf.s
new file mode 100644
index 00000000..068935e2
--- /dev/null
+++ b/src/math/i386/hypotf.s
@@ -0,0 +1,42 @@
+.global hypotf
+.type hypotf,@function
+hypotf:
+ mov 4(%esp),%eax
+ mov 8(%esp),%ecx
+ add %eax,%eax
+ add %ecx,%ecx
+ and %eax,%ecx
+ cmp $0xff000000,%ecx
+ jae 2f
+ test %eax,%eax
+ jnz 1f
+ flds 8(%esp)
+ fabs
+ ret
+1: mov 8(%esp),%eax
+ add %eax,%eax
+ jnz 1f
+ flds 4(%esp)
+ fabs
+ ret
+1: flds 4(%esp)
+ fld %st(0)
+ fmulp
+ flds 8(%esp)
+ fld %st(0)
+ fmulp
+ faddp
+ fsqrt
+ ret
+2: cmp $0xff000000,%eax
+ jnz 1f
+ flds 4(%esp)
+ fabs
+ ret
+1: mov 8(%esp),%eax
+ add %eax,%eax
+ cmp $0xff000000,%eax
+ flds 8(%esp)
+ jnz 1f
+ fabs
+1: ret