diff options
author | 2016-07-25 00:09:46 +0530 | |
---|---|---|
committer | 2016-11-12 02:10:03 -0500 | |
commit | 9ae5c22341a0484319c15d12cae1a46835c48379 (patch) | |
tree | a4ad7c8f02865184507b8651940e730bf3daae45 /paxldso.h | |
parent | split out fs related helper funcs as lib code (diff) | |
download | pax-utils-9ae5c22341a0484319c15d12cae1a46835c48379.tar.gz pax-utils-9ae5c22341a0484319c15d12cae1a46835c48379.tar.bz2 pax-utils-9ae5c22341a0484319c15d12cae1a46835c48379.zip |
split out ld.so.cache & ld.so.conf parsing logic
These are getting a bit big & unwieldy for keeping inlined in scanelf.
Split them out to a dedicated file instead.
Diffstat (limited to 'paxldso.h')
-rw-r--r-- | paxldso.h | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/paxldso.h b/paxldso.h new file mode 100644 index 0000000..2fdc540 --- /dev/null +++ b/paxldso.h @@ -0,0 +1,69 @@ +/* + * Copyright 2003-2016 Gentoo Foundation + * Distributed under the terms of the GNU General Public License v2 + * + * Copyright 2003-2012 Ned Ludd - <solar@gentoo.org> + * Copyright 2004-2016 Mike Frysinger - <vapier@gentoo.org> + */ + +#ifndef _PAX_LDSO_H +#define _PAX_LDSO_H + +/* + * ld.so.cache logic + */ + +#if !defined(__GLIBC__) && \ + !defined(__UCLIBC__) && \ + !defined(__NetBSD__) +# ifdef __ELF__ +# warning Cache support not implemented for your target +# endif +# define PAX_LDSO_CACHE 0 +#else +# define PAX_LDSO_CACHE 1 +#endif + +#if PAX_LDSO_CACHE +extern char *ldso_cache_lookup_lib(elfobj *elf, const char *fname); +#else +static inline char *ldso_cache_lookup_lib(elfobj *elf, const char *fname) +{ + return NULL; +} +#endif + +/* + * ld.so.conf logic + */ + +#if !defined(__GLIBC__) && \ + !defined(__UCLIBC__) && \ + !defined(__NetBSD__) && \ + !defined(__FreeBSD__) && \ + !defined(__DragonFly__) +# ifdef __ELF__ +# warning Cache config support not implemented for your target +# endif +# define PAX_LDSO_CONFIG 0 +#else +# define PAX_LDSO_CONFIG 1 +#endif + +#if PAX_LDSO_CONFIG +extern array_t *ldpaths; +extern int ldso_config_load(const char *fname); +#else +static inline int ldso_config_load(const char *fname) +{ + return 0; +} +#endif + +#if PAX_LDSO_CACHE || PAX_LDSO_CONFIG +extern void paxldso_cleanup(void); +#else +# define paxldso_cleanup() +#endif + +#endif |