libc: use correct type for dummy libc functions

as far as possible. Some functions are internal to libc and no public
header are available.

Fixes #1466
This commit is contained in:
Alexander Boettcher 2015-03-24 14:45:55 +01:00 committed by Christian Helmuth
parent e53e6b0c5c
commit 97758f8468
7 changed files with 155 additions and 124 deletions

View File

@ -17,3 +17,7 @@ FILTER_OUT += s_cosl.c s_frexpl.c s_nextafterl.c s_nexttoward.c \
FILTER_OUT += s_fmal.c FILTER_OUT += s_fmal.c
include $(REP_DIR)/lib/mk/libm.mk include $(REP_DIR)/lib/mk/libm.mk
SRC_C += msun/arm/fenv.c
vpath msun/arm/fenv.c $(LIBC_DIR)/lib

View File

@ -0,0 +1,5 @@
include $(REP_DIR)/lib/mk/libm.mk
SRC_C += msun/i387/fenv.c
vpath msun/i387/fenv.c $(LIBC_DIR)/lib

View File

@ -0,0 +1,5 @@
include $(REP_DIR)/lib/mk/libm.mk
SRC_C += msun/amd64/fenv.c
vpath msun/amd64/fenv.c $(LIBC_DIR)/lib

View File

@ -5,7 +5,7 @@
*/ */
/* /*
* Copyright (C) 2008-2013 Genode Labs GmbH * Copyright (C) 2008-2015 Genode Labs GmbH
* *
* This file is part of the Genode OS framework, which is distributed * This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU General Public License version 2. * under the terms of the GNU General Public License version 2.
@ -17,131 +17,123 @@
extern "C" { extern "C" {
typedef long DUMMY; #include <sys/file.h>
#include <sys/mman.h>
#include <sys/mount.h>
#include <sys/resource.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/ucontext.h>
#include <sys/wait.h>
#define DUMMY(retval, name) __attribute__((weak)) \ #include <db.h>
DUMMY name(void) { \ #include <netdb.h>
PDBG( #name " called, not implemented"); \ #include <signal.h>
#include <unistd.h>
#include <pthread.h>
#include <pwd.h>
#define DUMMY(ret_type, ret_val, name, args) __attribute__((weak)) \
ret_type name args \
{ \
PDBG( #name " not implemented"); \
errno = ENOSYS; \ errno = ENOSYS; \
return retval; \ return ret_val; \
} }
DUMMY(-1, access) DUMMY(int , -1, access, (const char *, int))
DUMMY(-1, chmod) DUMMY(int , -1, chmod, (const char *, mode_t))
DUMMY(-1, chown) DUMMY(int , -1, chown, (const char *, uid_t, gid_t))
DUMMY(-1, chroot) DUMMY(int , -1, chroot, (const char *))
DUMMY( 0, crypt) DUMMY(char *, 0, crypt, (const char *, const char *))
DUMMY( 0, dbopen) DUMMY(DB * , 0, dbopen, (const char *, int, int, DBTYPE, const void *))
DUMMY(-1, dup) DUMMY(int , -1, dup, (int))
DUMMY( 0, __default_hash) DUMMY(u_int32_t, 0, __default_hash, (const void *, size_t));
DUMMY(-1, _dup2) DUMMY(int , -1, dup2, (int, int))
DUMMY(-1, dup2) DUMMY(void , , endpwent, (void))
DUMMY( 0, endpwent) DUMMY(int , 0, fchmod, (int, mode_t))
DUMMY( 0, fchmod) DUMMY(int , -1, fchown, (int, uid_t, gid_t))
DUMMY(-1, fchown) DUMMY(int , -1, flock, (int, int))
DUMMY(-1, feholdexcept) DUMMY(pid_t , -1, fork, (void))
DUMMY(-1, fegetenv) DUMMY(long , -1, _fpathconf, (int, int))
DUMMY(-1, feraiseexcept) DUMMY(long , -1, fpathconf, (int, int))
DUMMY(-1, feupdateenv) DUMMY(int , -1, freebsd7___semctl, (void))
DUMMY(-1, flock) DUMMY(int , -1, fstatat, (int, const char *, struct stat *, int))
DUMMY(-1, fork) DUMMY(int , -1, getcontext, (ucontext_t *))
DUMMY(-1, _fpathconf) DUMMY(int , 0, getdtablesize, (void))
DUMMY(-1, fpathconf) DUMMY(gid_t , 0, getegid, (void))
DUMMY(-1, freebsd7___semctl) DUMMY(uid_t , 0, geteuid, (void))
DUMMY(-1, fstatat) DUMMY(int , -1, getfsstat, (struct statfs *, long, int))
DUMMY(-1, getcontext) DUMMY(gid_t , 0, getgid, (void))
DUMMY( 0, getdtablesize) DUMMY(int , -1, getgroups, (int, gid_t *))
DUMMY( 0, getegid) DUMMY(struct hostent *, 0, gethostbyname, (const char *))
DUMMY( 0, geteuid) DUMMY(char *, 0, _getlogin, (void))
DUMMY(-1, getfsstat) DUMMY(int , -1, getnameinfo, (const sockaddr *, socklen_t, char *, size_t, char *, size_t, int))
DUMMY( 0, getgid) DUMMY(pid_t , -1, getpid, (void))
DUMMY(-1, getgroups) DUMMY(struct servent *, 0, getservbyname, (const char *, const char *))
DUMMY( 0, gethostbyname) DUMMY(int , -1, getsid, (pid_t))
DUMMY( 0, _getlogin) DUMMY(pid_t , -1, getppid, (void))
DUMMY(-1, getnameinfo) DUMMY(pid_t , -1, getpgrp, (void))
DUMMY(-1, getpid) DUMMY(int , -1, getpriority, (int, int))
DUMMY( 0, getservbyname) DUMMY(struct passwd *, 0, getpwent, (void))
DUMMY(-1, getsid) DUMMY(struct passwd *, 0, getpwnam, (const char *))
DUMMY(-1, getppid) DUMMY(struct passwd *, 0, getpwuid, (uid_t))
DUMMY(-1, getpgrp) DUMMY(int , 0, getpwuid_r, (uid_t, struct passwd *, char *, size_t, struct passwd **))
DUMMY(-1, getpriority) DUMMY(int , -1, getrusage, (int, rusage *))
DUMMY( 0, getpwent) DUMMY(uid_t , 0, getuid, (void))
DUMMY( 0, getpwnam) DUMMY(int , -1, kill, (pid_t, int))
DUMMY( 0, getpwuid) DUMMY(int , -1, link, (const char *, const char *))
DUMMY( 0, getpwuid_r) DUMMY(int , -1, mkfifo, (const char *, mode_t))
DUMMY(-1, __getpty) DUMMY(int , -1, mknod, (const char *, mode_t, dev_t))
DUMMY(-1, _getpty) DUMMY(int , -1, mprotect, (const void *, size_t, int))
DUMMY(-1, getrusage) DUMMY(void *, 0, ___mtctxres, (void))
DUMMY( 0, getuid) DUMMY(int , -1, nanosleep, (const timespec *, timespec *))
DUMMY(-1, __has_sse) DUMMY(void *, 0, __nsdefaultsrc, (void))
DUMMY(-1, host_detect_local_cpu) DUMMY(int , -1, _nsdispatch, (void))
DUMMY(-1, kill) DUMMY(long , -1, pathconf, (const char *, int))
DUMMY(-1, ksem_close) DUMMY(int , -1, pthread_create, (pthread_t *, const pthread_attr_t *, void *(*)(void *), void *))
DUMMY(-1, ksem_destroy) DUMMY(int , -1, rmdir, (const char *))
DUMMY(-1, ksem_getvalue) DUMMY(void *, 0, sbrk, (intptr_t))
DUMMY(-1, ksem_open) DUMMY(int , -1, sched_setparam, (pid_t, const sched_param *))
DUMMY(-1, ksem_post) DUMMY(int , -1, sched_setscheduler, (pid_t, int, const sched_param *))
DUMMY(-1, ksem_timedwait) DUMMY(int , -1, sched_yield, (void))
DUMMY(-1, ksem_trywait) DUMMY(int , -1, _select, (void))
DUMMY(-1, ksem_unlink) DUMMY(int , -1, __semctl, (void))
DUMMY(-1, ksem_wait) DUMMY(int , -1, setcontext, (const ucontext_t *))
DUMMY(-1, link) DUMMY(int , -1, setegid, (uid_t))
DUMMY(-1, madvise) DUMMY(int , -1, seteuid, (uid_t))
DUMMY(-1, mkfifo) DUMMY(int , -1, setgid, (gid_t))
DUMMY(-1, mknod) DUMMY(int , -1, setuid, (uid_t))
DUMMY(-1, mprotect) DUMMY(int , -1, setgroups, (int, const gid_t *))
DUMMY( 0, ___mtctxres) DUMMY(int , -1, setitimer, (int, const itimerval *, itimerval *))
DUMMY(-1, nanosleep) DUMMY(int , -1, setpassent, (int))
DUMMY(-1, __nsdefaultsrc) DUMMY(int , -1, setpgid, (pid_t, pid_t))
DUMMY(-1, _nsdispatch) DUMMY(int , -1, setpriority, (int, int, int))
DUMMY(-1, _openat) DUMMY(void , , setpwent, (void))
DUMMY(-1, pathconf) DUMMY(int , -1, setregid, (gid_t, gid_t))
DUMMY(-1, pthread_create) DUMMY(int , -1, setreuid, (uid_t, uid_t))
DUMMY(-1, regcomp) DUMMY(int , -1, setrlimit, (int, const rlimit *))
DUMMY(-1, regexec) DUMMY(pid_t , -1, setsid, (void))
DUMMY(-1, regfree) DUMMY(int , -1, _sigaction, (int, const struct sigaction *, struct sigaction *))
DUMMY(-1, rmdir) DUMMY(int , -1, sigaction, (int, const struct sigaction *, struct sigaction *))
DUMMY(-1, sbrk) DUMMY(int , -1, sigblock, (int))
DUMMY(-1, sched_setparam) DUMMY(int , -1, sigpause, (int))
DUMMY(-1, sched_setscheduler) DUMMY(int , -1, _sigprocmask, (int, const sigset_t *, sigset_t *))
DUMMY(-1, sched_yield) DUMMY(int , -1, sigprocmask, (int, const sigset_t *, sigset_t *))
DUMMY(-1, _select) DUMMY(int , -1, _sigsuspend, (const sigset_t *))
DUMMY(-1, __semctl) DUMMY(int , -1, sigsuspend, (const sigset_t *))
DUMMY(-1, setcontext) DUMMY(int , -1, socketpair, (int, int, int, int *))
DUMMY(-1, setegid) DUMMY(int , -1, stat, (const char *, struct stat *))
DUMMY(-1, seteuid) DUMMY(int , -1, statfs, (const char *, struct statfs *))
DUMMY(-1, setgid) DUMMY(void , , sync, (void))
DUMMY(-1, setuid) DUMMY(int , -1, truncate, (const char *, off_t))
DUMMY(-1, setgroups) DUMMY(mode_t, 0, umask, (mode_t))
DUMMY(-1, setitimer) DUMMY(int , 0, utimes, (const char *, const timeval *))
DUMMY(-1, setpassent) DUMMY(pid_t , -1, vfork, (void))
DUMMY(-1, setpgid) DUMMY(pid_t , -1, _wait4, (pid_t, int *, int, struct rusage *))
DUMMY(-1, setpriority)
DUMMY( 0, setpwent)
DUMMY(-1, setregid)
DUMMY(-1, setreuid)
DUMMY(-1, setrlimit)
DUMMY(-1, setsid)
DUMMY(-1, _sigaction)
DUMMY(-1, sigaction)
DUMMY(-1, sigblock)
DUMMY(-1, sigpause)
DUMMY(-1, _sigprocmask)
DUMMY(-1, sigprocmask)
DUMMY(-1, _sigsuspend)
DUMMY(-1, sigsuspend)
DUMMY(-1, socketpair)
DUMMY(-1, stat)
DUMMY(-1, statfs)
DUMMY( 0, sync)
DUMMY(-1, __test_sse)
DUMMY(-1, truncate)
DUMMY( 0, umask)
DUMMY(-1, _umtx_op)
DUMMY( 0, utimes)
DUMMY(-1, utrace)
DUMMY(-1, vfork)
DUMMY(-1, _wait4)
void ksem_init(void) void ksem_init(void)
{ {
@ -149,5 +141,17 @@ void ksem_init(void)
while (1); while (1);
} }
int __attribute__((weak)) madvise(void *addr, size_t length, int advice)
{
if (advice == MADV_DONTNEED)
/* ignore hint */
return 0;
PDBG("called, not implemented - %p+%zx advice=%d", addr, length, advice);
errno = ENOSYS;
return -1;
}
} /* extern "C" */ } /* extern "C" */

View File

@ -1 +1 @@
f5f038bc4232d78154248b6ce85b94108ca55255 920639d7e58d1b0a2a04f727f77b9a6f48806bfc

View File

@ -11,7 +11,8 @@ DIR(gcc) := src/noux-pkg/gcc
GENODE_DIR := $(REP_DIR)/../.. GENODE_DIR := $(REP_DIR)/../..
PATCHES_DIR := $(GENODE_DIR)/tool/patches/gcc-$(VERSION) PATCHES_DIR := $(GENODE_DIR)/tool/patches/gcc-$(VERSION)
PATCHES := $(addprefix $(PATCHES_DIR)/,$(shell cat $(PATCHES_DIR)/series)) \ PATCHES := $(addprefix $(PATCHES_DIR)/,$(shell cat $(PATCHES_DIR)/series)) \
$(REP_DIR)/src/noux-pkg/gcc/build.patch $(REP_DIR)/src/noux-pkg/gcc/build.patch \
$(REP_DIR)/src/noux-pkg/gcc/arm.patch
PATCH_OPT := -p1 -d ${DIR(gcc)} PATCH_OPT := -p1 -d ${DIR(gcc)}
AUTOCONF := autoconf2.64 AUTOCONF := autoconf2.64

View File

@ -0,0 +1,12 @@
+++ b/gcc/config/arm/arm.h
@@ -2193,9 +2193,7 @@
/* -mcpu=native handling only makes sense with compiler running on
an ARM chip. */
#if defined(__arm__)
-extern const char *host_detect_local_cpu (int argc, const char **argv);
-# define EXTRA_SPEC_FUNCTIONS \
- { "local_cpu_detect", host_detect_local_cpu },
+# define EXTRA_SPEC_FUNCTIONS
# define MCPU_MTUNE_NATIVE_SPECS \
" %{march=native:%<march=native %:local_cpu_detect(arch)}" \