1 /* 2 * Copyright 2003-2016 Gentoo Foundation 3 * Distributed under the terms of the GNU General Public License v2 4 * 5 * Copyright 2003-2012 Ned Ludd - <solar@gentoo.org> 6 * Copyright 2004-2016 Mike Frysinger - <vapier@gentoo.org> 7 */ 8 9 #ifndef _PAX_LDSO_H 10 #define _PAX_LDSO_H 11 12 /* 13 * ld.so.cache logic 14 */ 15 16 #if !defined(__GLIBC__) && \ 17 !defined(__UCLIBC__) 18 # ifdef __ELF__ 19 # warning Cache support not implemented for your target 20 # endif 21 # define PAX_LDSO_CACHE 0 22 #else 23 # define PAX_LDSO_CACHE 1 24 #endif 25 26 #if PAX_LDSO_CACHE 27 extern char *ldso_cache_lookup_lib(elfobj *elf, const char *fname); 28 #else ldso_cache_lookup_lib(__unused__ elfobj * elf,__unused__ const char * fname)29static inline char *ldso_cache_lookup_lib(__unused__ elfobj *elf, __unused__ const char *fname) 30 { 31 return NULL; 32 } 33 #endif 34 35 /* 36 * ld.so.conf logic 37 */ 38 39 #if !defined(__GLIBC__) && \ 40 !defined(__UCLIBC__) && \ 41 !defined(__NetBSD__) && \ 42 !defined(__FreeBSD__) && \ 43 !defined(__DragonFly__) 44 # ifdef __ELF__ 45 # warning Cache config support not implemented for your target 46 # endif 47 # define PAX_LDSO_CONFIG 0 48 #else 49 # define PAX_LDSO_CONFIG 1 50 #endif 51 52 /* Consumers refer to ldpaths directly, so can't hide its def. */ 53 extern array_t *ldpaths; 54 #if PAX_LDSO_CONFIG 55 extern int ldso_config_load(const char *fname); 56 #else ldso_config_load(__unused__ const char * fname)57static inline int ldso_config_load(__unused__ const char *fname) 58 { 59 return 0; 60 } 61 #endif 62 63 #if PAX_LDSO_CACHE || PAX_LDSO_CONFIG 64 extern void paxldso_cleanup(void); 65 #else 66 # define paxldso_cleanup() 67 #endif 68 69 /* Path to ld.so.cache. Usually overridden for tests. */ 70 extern const char *ldcache_path; 71 72 #endif 73