Index: libexec/rtld-elf/libmap.c =================================================================== --- libexec/rtld-elf/libmap.c +++ libexec/rtld-elf/libmap.c @@ -25,7 +25,7 @@ TAILQ_ENTRY(lm) lm_link; }; -TAILQ_HEAD(lmp_list, lmp) lmp_head = TAILQ_HEAD_INITIALIZER(lmp_head); +static TAILQ_HEAD(lmp_list, lmp) lmp_head = TAILQ_HEAD_INITIALIZER(lmp_head); struct lmp { char *p; enum { T_EXACT=0, T_BASENAME, T_DIRECTORY } type; Index: libexec/rtld-elf/malloc.c =================================================================== --- libexec/rtld-elf/malloc.c +++ libexec/rtld-elf/malloc.c @@ -340,7 +340,7 @@ * is extern so the caller can modify it). If that fails we just copy * however many bytes was given to realloc() and hope it's not huge. */ -int realloc_srchlen = 4; /* 4 should be plenty, -1 =>'s whole list */ +static int realloc_srchlen = 4; /* 4 should be plenty, -1 =>'s whole list */ void * realloc(cp, nbytes) Index: libexec/rtld-elf/rtld.c =================================================================== --- libexec/rtld-elf/rtld.c +++ libexec/rtld-elf/rtld.c @@ -73,6 +73,14 @@ typedef void (*func_ptr_type)(void); typedef void * (*path_enum_proc) (const char *path, size_t len, void *arg); + +/* Variables that cannot be static: */ +extern struct r_debug r_debug; /* For GDB */ +extern int _thread_autoinit_dummy_decl; +extern char* __progname; +extern void (*__cleanup)(void); + + /* * Function declarations. */ @@ -242,7 +250,8 @@ Elf_Addr _rtld_bind(Obj_Entry *obj, Elf_Size reloff); -int npagesizes, osreldate; +int npagesizes; +static int osreldate; size_t *pagesizes; static int stack_prot = PROT_READ | PROT_WRITE | RTLD_DEFAULT_STACK_EXEC; @@ -267,11 +276,11 @@ size_t tls_last_offset; /* Static TLS offset of last module */ size_t tls_last_size; /* Static TLS size of last module */ size_t tls_static_space; /* Static TLS space allocated */ -size_t tls_static_max_align; +static size_t tls_static_max_align; size_t tls_dtv_generation = 1; /* Used to detect when dtv size changes */ int tls_max_index = 1; /* Largest module index allocated */ -bool ld_library_path_rpath = false; +static bool ld_library_path_rpath = false; /* * Globals for path names, and such Index: libexec/rtld-elf/rtld_lock.c =================================================================== --- libexec/rtld-elf/rtld_lock.c +++ libexec/rtld-elf/rtld_lock.c @@ -184,7 +184,7 @@ } #define RTLD_LOCK_CNT 3 -struct rtld_lock { +static struct rtld_lock { void *handle; int mask; } rtld_locks[RTLD_LOCK_CNT];