summaryrefslogtreecommitdiffstats
path: root/libexec
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2015-04-12 06:45:40 +0000
committerkib <kib@FreeBSD.org>2015-04-12 06:45:40 +0000
commit39372044850f47dd4bea491cc717b227b8214a46 (patch)
tree44179ca0f62fcdabf76a69020223ce74137e5250 /libexec
parent0fe937192c3bb4e05e924beb5bbc3749efc648cc (diff)
downloadFreeBSD-src-39372044850f47dd4bea491cc717b227b8214a46.zip
FreeBSD-src-39372044850f47dd4bea491cc717b227b8214a46.tar.gz
MFC r280816:
Change default visibility for rtld to hidden, on x86.
Diffstat (limited to 'libexec')
-rw-r--r--libexec/rtld-elf/Makefile3
-rw-r--r--libexec/rtld-elf/amd64/reloc.c1
-rw-r--r--libexec/rtld-elf/amd64/rtld_machdep.h2
-rw-r--r--libexec/rtld-elf/amd64/rtld_start.S4
-rw-r--r--libexec/rtld-elf/i386/reloc.c1
-rw-r--r--libexec/rtld-elf/i386/rtld_machdep.h4
-rw-r--r--libexec/rtld-elf/i386/rtld_start.S4
-rw-r--r--libexec/rtld-elf/rtld.c23
-rw-r--r--libexec/rtld-elf/rtld.h2
-rw-r--r--libexec/rtld-elf/rtld_lock.c4
-rw-r--r--libexec/rtld-elf/rtld_lock.h6
-rw-r--r--libexec/rtld-elf/rtld_tls.h5
12 files changed, 43 insertions, 16 deletions
diff --git a/libexec/rtld-elf/Makefile b/libexec/rtld-elf/Makefile
index 66a20d3..8359d36 100644
--- a/libexec/rtld-elf/Makefile
+++ b/libexec/rtld-elf/Makefile
@@ -42,6 +42,9 @@ CFLAGS+= -fPIC
CFLAGS+= -fpic
.endif
CFLAGS+= -DPIC $(DEBUG)
+.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386"
+CFLAGS+= -fvisibility=hidden
+.endif
LDFLAGS+= -shared -Wl,-Bsymbolic
DPADD= ${LIBC_PIC}
LDADD= -lc_pic
diff --git a/libexec/rtld-elf/amd64/reloc.c b/libexec/rtld-elf/amd64/reloc.c
index 35f33cc..53d2bdc 100644
--- a/libexec/rtld-elf/amd64/reloc.c
+++ b/libexec/rtld-elf/amd64/reloc.c
@@ -47,6 +47,7 @@
#include "debug.h"
#include "rtld.h"
+#include "rtld_tls.h"
/*
* Process the special R_X86_64_COPY relocations in the main program. These
diff --git a/libexec/rtld-elf/amd64/rtld_machdep.h b/libexec/rtld-elf/amd64/rtld_machdep.h
index 7b5d4d2..cb5e9a1 100644
--- a/libexec/rtld-elf/amd64/rtld_machdep.h
+++ b/libexec/rtld-elf/amd64/rtld_machdep.h
@@ -74,7 +74,7 @@ typedef struct {
unsigned long ti_offset;
} tls_index;
-extern void *__tls_get_addr(tls_index *ti);
+void *__tls_get_addr(tls_index *ti) __exported;
#define RTLD_DEFAULT_STACK_PF_EXEC PF_X
#define RTLD_DEFAULT_STACK_EXEC PROT_EXEC
diff --git a/libexec/rtld-elf/amd64/rtld_start.S b/libexec/rtld-elf/amd64/rtld_start.S
index 2481f09..387d26c 100644
--- a/libexec/rtld-elf/amd64/rtld_start.S
+++ b/libexec/rtld-elf/amd64/rtld_start.S
@@ -36,7 +36,7 @@
movq %rsp,%rsi # save address of exit proc
movq %rsp,%rdx # construct address of obj_main
addq $8,%rdx
- call _rtld@PLT # Call rtld(sp); returns entry point
+ call _rtld # Call rtld(sp); returns entry point
popq %rsi # Get exit procedure address
movq %r12,%rdi # *ap
/*
@@ -118,7 +118,7 @@ _rtld_bind_start:
leaq (%rsi,%rsi,2),%rsi # multiply by 3
leaq (,%rsi,8),%rsi # now 8, for 24 (sizeof Elf_Rela)
- call _rtld_bind@PLT # Transfer control to the binder
+ call _rtld_bind # Transfer control to the binder
/* Now %rax contains the entry point of the function being called. */
movq %rax,0x60(%rsp) # Store target over reloff argument
diff --git a/libexec/rtld-elf/i386/reloc.c b/libexec/rtld-elf/i386/reloc.c
index c1e0a39..55b6537 100644
--- a/libexec/rtld-elf/i386/reloc.c
+++ b/libexec/rtld-elf/i386/reloc.c
@@ -48,6 +48,7 @@
#include "debug.h"
#include "rtld.h"
+#include "rtld_tls.h"
/*
* Process the special R_386_COPY relocations in the main program. These
diff --git a/libexec/rtld-elf/i386/rtld_machdep.h b/libexec/rtld-elf/i386/rtld_machdep.h
index dfbe2e1..5c328da 100644
--- a/libexec/rtld-elf/i386/rtld_machdep.h
+++ b/libexec/rtld-elf/i386/rtld_machdep.h
@@ -74,8 +74,8 @@ typedef struct {
unsigned long ti_offset;
} tls_index;
-extern void *___tls_get_addr(tls_index *ti) __attribute__((__regparm__(1)));
-extern void *__tls_get_addr(tls_index *ti);
+void *___tls_get_addr(tls_index *ti) __attribute__((__regparm__(1))) __exported;
+void *__tls_get_addr(tls_index *ti) __exported;
#define RTLD_DEFAULT_STACK_PF_EXEC PF_X
#define RTLD_DEFAULT_STACK_EXEC PROT_EXEC
diff --git a/libexec/rtld-elf/i386/rtld_start.S b/libexec/rtld-elf/i386/rtld_start.S
index e7df748..87dca0e 100644
--- a/libexec/rtld-elf/i386/rtld_start.S
+++ b/libexec/rtld-elf/i386/rtld_start.S
@@ -42,7 +42,7 @@
pushl %ecx # Pass address of obj_main
pushl %ebx # Pass address of exit proc
pushl %eax # Pass initial stack pointer to rtld
- call _rtld@PLT # Call rtld(sp); returns entry point
+ call _rtld # Call rtld(sp); returns entry point
addl $16,%esp # Remove arguments from stack
popl %edx # Get exit procedure address
movl %esi,%esp # Ignore obj_main
@@ -78,7 +78,7 @@ _rtld_bind_start:
pushl 20(%esp) # Copy reloff argument
pushl 20(%esp) # Copy obj argument
- call _rtld_bind@PLT # Transfer control to the binder
+ call _rtld_bind # Transfer control to the binder
/* Now %eax contains the entry point of the function being called. */
addl $8,%esp # Discard binder arguments
diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c
index 4753d13..94ae21f 100644
--- a/libexec/rtld-elf/rtld.c
+++ b/libexec/rtld-elf/rtld.c
@@ -161,14 +161,14 @@ static uint32_t gnu_hash(const char *);
static bool matched_symbol(SymLook *, const Obj_Entry *, Sym_Match_Result *,
const unsigned long);
-void r_debug_state(struct r_debug *, struct link_map *) __noinline;
-void _r_debug_postinit(struct link_map *) __noinline;
+void r_debug_state(struct r_debug *, struct link_map *) __noinline __exported;
+void _r_debug_postinit(struct link_map *) __noinline __exported;
/*
* Data declarations.
*/
static char *error_message; /* Message for dlerror(), or NULL */
-struct r_debug r_debug; /* for GDB; */
+struct r_debug r_debug __exported; /* for GDB; */
static bool libmap_disable; /* Disable libmap */
static bool ld_loadfltr; /* Immediate filters processing */
static char *libmap_override; /* Maps to use in addition to libmap.conf */
@@ -207,6 +207,23 @@ extern Elf_Dyn _DYNAMIC;
#define RTLD_IS_DYNAMIC() (&_DYNAMIC != NULL)
#endif
+int dlclose(void *) __exported;
+char *dlerror(void) __exported;
+void *dlopen(const char *, int) __exported;
+void *fdlopen(int, int) __exported;
+void *dlsym(void *, const char *) __exported;
+dlfunc_t dlfunc(void *, const char *) __exported;
+void *dlvsym(void *, const char *, const char *) __exported;
+int dladdr(const void *, Dl_info *) __exported;
+void dllockinit(void *, void *(*)(void *), void (*)(void *), void (*)(void *),
+ void (*)(void *), void (*)(void *), void (*)(void *)) __exported;
+int dlinfo(void *, int , void *) __exported;
+int dl_iterate_phdr(__dl_iterate_hdr_callback, void *) __exported;
+int _rtld_addr_phdr(const void *, struct dl_phdr_info *) __exported;
+int _rtld_get_stack_prot(void) __exported;
+int _rtld_is_dlopened(void *) __exported;
+void _rtld_error(const char *, ...) __exported;
+
int npagesizes, osreldate;
size_t *pagesizes;
diff --git a/libexec/rtld-elf/rtld.h b/libexec/rtld-elf/rtld.h
index e539117..e16e46a 100644
--- a/libexec/rtld-elf/rtld.h
+++ b/libexec/rtld-elf/rtld.h
@@ -353,7 +353,7 @@ typedef struct Struct_SymLook {
struct Struct_RtldLockState *lockstate;
} SymLook;
-void _rtld_error(const char *, ...) __printflike(1, 2);
+void _rtld_error(const char *, ...) __printflike(1, 2) __exported;
const char *rtld_strerror(int);
Obj_Entry *map_object(int, const char *, const struct stat *);
void *xcalloc(size_t, size_t);
diff --git a/libexec/rtld-elf/rtld_lock.c b/libexec/rtld-elf/rtld_lock.c
index ea16c4d..f31546c 100644
--- a/libexec/rtld-elf/rtld_lock.c
+++ b/libexec/rtld-elf/rtld_lock.c
@@ -51,6 +51,10 @@
#include "rtld.h"
#include "rtld_machdep.h"
+void _rtld_thread_init(struct RtldLockInfo *) __exported;
+void _rtld_atfork_pre(int *) __exported;
+void _rtld_atfork_post(int *) __exported;
+
#define WAFLAG 0x1 /* A writer holds the lock */
#define RC_INCR 0x2 /* Adjusts count of readers desiring lock */
diff --git a/libexec/rtld-elf/rtld_lock.h b/libexec/rtld-elf/rtld_lock.h
index fa63787..3d5aaad 100644
--- a/libexec/rtld-elf/rtld_lock.h
+++ b/libexec/rtld-elf/rtld_lock.h
@@ -44,9 +44,9 @@ struct RtldLockInfo
void (*at_fork)(void);
};
-extern void _rtld_thread_init(struct RtldLockInfo *);
-extern void _rtld_atfork_pre(int *);
-extern void _rtld_atfork_post(int *);
+extern void _rtld_thread_init(struct RtldLockInfo *) __exported;
+extern void _rtld_atfork_pre(int *) __exported;
+extern void _rtld_atfork_post(int *) __exported;
#ifdef IN_RTLD
diff --git a/libexec/rtld-elf/rtld_tls.h b/libexec/rtld-elf/rtld_tls.h
index b85db59..40f71c2 100644
--- a/libexec/rtld-elf/rtld_tls.h
+++ b/libexec/rtld-elf/rtld_tls.h
@@ -57,13 +57,14 @@
* The value returned from this function is suitable for installing
* directly into the thread pointer register.
*/
-extern void *_rtld_allocate_tls(void* oldtls, size_t tcbsize, size_t tcbalign);
+void *_rtld_allocate_tls(void* oldtls, size_t tcbsize, size_t tcbalign)
+ __exported;
/*
* Free a TLS block allocated using _rtld_allocate_tls(). The tcbsize
* and tcbalign parameters must be the same as those used to allocate
* the block.
*/
-extern void _rtld_free_tls(void *tcb, size_t tcbsize, size_t tcbalign);
+void _rtld_free_tls(void *tcb, size_t tcbsize, size_t tcbalign) __exported;
#endif
OpenPOWER on IntegriCloud