[BACK]Return to dlfcn_elf.c CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / lib / libc / dlfcn

Annotation of src/lib/libc/dlfcn/dlfcn_elf.c, Revision 1.5.32.2

1.5.32.2! bouyer      1: /*     $NetBSD: dlfcn_elf.c,v 1.5.32.1 2009/10/14 09:31:27 sborrill Exp $      */
1.1       minoura     2:
                      3: /*
                      4:  * Copyright (c) 2000 Takuya SHIOZAKI
                      5:  * All rights reserved.
                      6:  *
                      7:  * Redistribution and use in source and binary forms, with or without
                      8:  * modification, are permitted provided that the following conditions
                      9:  * are met:
                     10:  * 1. Redistributions of source code must retain the above copyright
                     11:  *    notice, this list of conditions and the following disclaimer.
                     12:  * 2. Redistributions in binary form must reproduce the above copyright
                     13:  *    notice, this list of conditions and the following disclaimer in the
                     14:  *    documentation and/or other materials provided with the distribution.
                     15:  *
                     16:  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
                     17:  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
                     18:  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
                     19:  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
                     20:  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
                     21:  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
                     22:  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
                     23:  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
                     24:  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
                     25:  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
                     26:  */
                     27:
                     28: #include <sys/cdefs.h>
                     29: #if defined(LIBC_SCCS) && !defined(lint)
1.5.32.2! bouyer     30: __RCSID("$NetBSD: dlfcn_elf.c,v 1.5.32.1 2009/10/14 09:31:27 sborrill Exp $");
1.1       minoura    31: #endif /* LIBC_SCCS and not lint */
                     32:
                     33: #include "namespace.h"
                     34:
1.5       thorpej    35: #undef dlopen
                     36: #undef dlclose
                     37: #undef dlsym
                     38: #undef dlerror
                     39: #undef dladdr
1.5.32.1  sborrill   40: #undef dfinfo
1.5       thorpej    41:
                     42: #define        dlopen          ___dlopen
                     43: #define        dlclose         ___dlclose
                     44: #define        dlsym           ___dlsym
                     45: #define        dlerror         ___dlerror
                     46: #define        dladdr          ___dladdr
1.5.32.1  sborrill   47: #define        dlinfo          ___dlinfo
1.5.32.2! bouyer     48: #define        dl_iterate_phdr         ___dl_iterate_phdr
1.5       thorpej    49:
1.1       minoura    50: #define ELFSIZE ARCH_ELFSIZE
                     51: #include "rtld.h"
                     52:
                     53: #ifdef __weak_alias
1.5       thorpej    54: __weak_alias(dlopen,___dlopen)
                     55: __weak_alias(dlclose,___dlclose)
                     56: __weak_alias(dlsym,___dlsym)
                     57: __weak_alias(dlerror,___dlerror)
                     58: __weak_alias(dladdr,___dladdr)
1.5.32.1  sborrill   59: __weak_alias(dlinfo,___dlinfo)
1.5.32.2! bouyer     60: __weak_alias(dl_iterate_phdr,___dl_iterate_phdr)
1.5       thorpej    61:
                     62: __weak_alias(__dlopen,___dlopen)
                     63: __weak_alias(__dlclose,___dlclose)
                     64: __weak_alias(__dlsym,___dlsym)
                     65: __weak_alias(__dlerror,___dlerror)
                     66: __weak_alias(__dladdr,___dladdr)
1.5.32.1  sborrill   67: __weak_alias(__dlinfo,___dlinfo)
1.5.32.2! bouyer     68: __weak_alias(__dl_iterate_phdr,___dl_iterate_phdr)
1.1       minoura    69: #endif
                     70:
1.4       skrll      71: /*
                     72:  * For ELF, the dynamic linker directly resolves references to its
                     73:  * services to functions inside the dynamic linker itself.  These
                     74:  * weak-symbol stubs are necessary so that "ld" won't complain about
                     75:  * undefined symbols.  The stubs are executed only when the program is
                     76:  * linked statically, or when a given service isn't implemented in the
                     77:  * dynamic linker.  They must return an error if called, and they must
                     78:  * be weak symbols so that the dynamic linker can override them.
                     79:  */
                     80:
                     81: static char dlfcn_error[] = "Service unavailable";
                     82:
                     83: /*ARGSUSED*/
                     84: void *
                     85: dlopen(const char *name, int mode)
                     86: {
                     87:
                     88:        return NULL;
                     89: }
                     90:
                     91: /*ARGSUSED*/
                     92: int
                     93: dlclose(void *fd)
                     94: {
                     95:
                     96:        return -1;
                     97: }
                     98:
                     99: /*ARGSUSED*/
                    100: void *
                    101: dlsym(void *handle, const char *name)
                    102: {
                    103:
                    104:        return NULL;
                    105: }
                    106:
                    107: /*ARGSUSED*/
                    108: __aconst char *
                    109: dlerror()
                    110: {
                    111:
                    112:        return dlfcn_error;
                    113: }
                    114:
                    115: /*ARGSUSED*/
                    116: int
                    117: dladdr(const void *addr, Dl_info *dli)
                    118: {
                    119:
                    120:        return 0;
                    121: }
1.5.32.1  sborrill  122:
                    123: /*ARGSUSED*/
                    124: int
                    125: dlinfo(void *handle, int req, void *v)
                    126: {
                    127:
                    128:        return -1;
                    129: }
1.5.32.2! bouyer    130:
        !           131: /*ARGSUSED*/
        !           132: int
        !           133: dl_iterate_phdr(int (*callback)(struct dl_phdr_info *, size_t, void *),
        !           134:     void *data)
        !           135: {
        !           136:
        !           137:        return 0;
        !           138: }

CVSweb <webmaster@jp.NetBSD.org>