1/* 2 * Copyright (c) 2007, 2008, 2009, ETH Zurich. 3 * All rights reserved. 4 * 5 * This file is distributed under the terms in the attached LICENSE file. 6 * If you do not find this file, copies can be found by writing to: 7 * ETH Zurich D-INFK, Universitaetstrasse 6, CH-8092 Zurich. Attn: Systems Group. 8 */ 9 10#include <dlfcn.h> 11#include <stdio.h> 12#include <string.h> 13#include <sys/link_elf.h> 14#include "posixcompat.h" 15 16static struct function_entry *ftable = 0; 17static int nr_entries = 0; 18 19void dlopen_set_params(struct function_entry *fk, int nrk) 20{ 21 ftable = fk; 22 nr_entries = nrk; 23} 24 25void *dlopen(const char *filename, int flags) 26{ 27 POSIXCOMPAT_DEBUG("dlopen(%s)\n", filename); 28 return (dlopen); 29} 30 31 32void *dlsym(void *handle, const char *symbol) 33{ 34 int i; 35 if (ftable == 0) { 36 return (0); 37 } 38 for (i = 0; i < nr_entries; i++) { 39 if (strcmp(symbol, ftable[i].name) == 0) { 40 return (ftable[i].f); 41 } 42 } 43 return (0); 44} 45 46 47char *dlerror(void) 48{ 49 return("ok"); 50} 51 52int dlclose(void *handle) 53{ 54 return (0); 55} 56 57int dladdr (const void *address, Dl_info *info) 58{ 59 printf("WARNING: dladdr is not implemented.\n"); 60 abort(); 61#if 0 62 const ElfW(Addr) addr = DL_LOOKUP_ADDRESS (address); 63 int result = 0; 64 65 /* Protect against concurrent loads and unloads. */ 66 __rtld_lock_lock_recursive (GL(dl_load_lock)); 67 68 struct link_map *l = _dl_find_dso_for_object (addr); 69 70 if (l) 71 { 72 determine_info (addr, l, info, mapp, symbolp); 73 result = 1; 74 } 75 76 __rtld_lock_unlock_recursive (GL(dl_load_lock)); 77 78 return result; 79#endif 80 return 0; 81} 82 83#pragma weak _rtld_addr_phdr 84int 85_rtld_addr_phdr(const void *addr, struct dl_phdr_info *phdr_info) 86{ 87 88 return (0); 89} 90