[git commit ldso-future] ldso: hide some or make them static
Peter S. Mazinger
ps.m at gmx.net
Wed Mar 30 11:53:36 UTC 2011
commit: http://git.uclibc.org/uClibc/commit/?id=7b001e69b1416bb5d421f7b9810461f2dfaeeca3
branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/ldso-future
_start: make it hidden until running apps through ld.so becomes reality
_dl_skip_args: make it static until running apps through ld.so becomes reality
it's a noop for now
_dl_progname: make it static (used in ld.so and libdl.a)
_dl_pagesize: make it hidden (could be also static, but it will be needed later as is)
_dl_internal_error_number: used only in one, make it static
Signed-off-by: Peter S. Mazinger <ps.m at gmx.net>
---
ldso/include/ldso.h | 4 ++--
ldso/ldso/arm/dl-startup.h | 2 ++
ldso/ldso/avr32/dl-startup.h | 1 +
ldso/ldso/bfin/dl-startup.h | 1 +
ldso/ldso/c6x/dl-startup.h | 1 +
ldso/ldso/cris/dl-startup.h | 2 ++
ldso/ldso/dl-elf.c | 2 +-
ldso/ldso/dl-startup.c | 3 +++
ldso/ldso/i386/dl-startup.h | 1 +
ldso/ldso/ldso.c | 9 ++++-----
ldso/ldso/m68k/dl-startup.h | 1 +
ldso/ldso/mips/dl-startup.h | 1 +
ldso/ldso/powerpc/dl-startup.h | 1 +
ldso/ldso/sh/dl-startup.h | 1 +
ldso/ldso/sh64/dl-startup.h | 1 +
ldso/ldso/sparc/dl-startup.h | 1 +
ldso/ldso/x86_64/dl-startup.h | 1 +
ldso/ldso/xtensa/dl-startup.h | 1 +
ldso/libdl/libdl.c | 4 ++--
19 files changed, 28 insertions(+), 10 deletions(-)
diff --git a/ldso/include/ldso.h b/ldso/include/ldso.h
index 874e0db..a18406c 100644
--- a/ldso/include/ldso.h
+++ b/ldso/include/ldso.h
@@ -51,8 +51,7 @@
/* Global variables used within the shared library loader */
extern char *_dl_library_path attribute_hidden; /* Where we look for libraries */
extern char *_dl_ldsopath attribute_hidden; /* Where the shared lib loader was found */
-extern const char *_dl_progname; /* The name of the executable being run */
-extern size_t _dl_pagesize; /* Store the page size for use later */
+extern size_t _dl_pagesize attribute_hidden; /* Store the page size for later use */
#ifdef __UCLIBC_HAS_TLS__
extern void _dl_add_to_slotinfo (struct link_map *l);
@@ -131,6 +130,7 @@ extern void _dl_dprintf(int, const char *__restrict, ...) attribute_hidden;
# define DL_GET_READY_TO_RUN_EXTRA_ARGS
#endif
+/* include it after _dl_assert is defined */
#ifdef HAVE_DL_INLINES_H
#include <dl-inlines.h>
#endif
diff --git a/ldso/ldso/arm/dl-startup.h b/ldso/ldso/arm/dl-startup.h
index a95389d..f170dbd 100644
--- a/ldso/ldso/arm/dl-startup.h
+++ b/ldso/ldso/arm/dl-startup.h
@@ -12,6 +12,7 @@
__asm__(
" .text\n"
" .globl _start\n"
+ " .hidden _start\n"
" .type _start,%function\n"
"_start:\n"
" @ at start time, all the args are on the stack\n"
@@ -65,6 +66,7 @@ __asm__(
" .text\n"
" .arm\n"
" .globl _start\n"
+ " .hidden _start\n"
" .type _start,%function\n"
"_start:\n"
" @ dumb: can't persuade the linker to make the start address\n"
diff --git a/ldso/ldso/avr32/dl-startup.h b/ldso/ldso/avr32/dl-startup.h
index 066f65f..e9523cc 100644
--- a/ldso/ldso/avr32/dl-startup.h
+++ b/ldso/ldso/avr32/dl-startup.h
@@ -11,6 +11,7 @@
* afterwards. */
__asm__(" .text\n"
" .global _start\n"
+ " .hidden _start\n"
" .type _start, at function\n"
"_start:\n"
/* All arguments are on the stack initially */
diff --git a/ldso/ldso/bfin/dl-startup.h b/ldso/ldso/bfin/dl-startup.h
index 550b9bc..ae098cb 100644
--- a/ldso/ldso/bfin/dl-startup.h
+++ b/ldso/ldso/bfin/dl-startup.h
@@ -39,6 +39,7 @@ USA. */
__asm__(
" .text\n" \
" .global __start\n" \
+ " .hidden __start\n" \
" .type __start, at function\n" \
"__start:\n" \
" call .Lcall\n" \
diff --git a/ldso/ldso/c6x/dl-startup.h b/ldso/ldso/c6x/dl-startup.h
index b9ea304..da3e6f7 100644
--- a/ldso/ldso/c6x/dl-startup.h
+++ b/ldso/ldso/c6x/dl-startup.h
@@ -42,6 +42,7 @@ _dl_start (unsigned placeholder, \
__asm__(" .text\n"
".globl _start\n"
+ ".hidden _start\n"
"_start:\n"
" B .S2 _dl_start\n"
" STW .D2T2 B14, *+B14[1]\n"
diff --git a/ldso/ldso/cris/dl-startup.h b/ldso/ldso/cris/dl-startup.h
index 0bc48f8..f5a234b 100644
--- a/ldso/ldso/cris/dl-startup.h
+++ b/ldso/ldso/cris/dl-startup.h
@@ -9,6 +9,7 @@
__asm__("" \
" .text\n" \
" .globl _start\n" \
+" .hidden _start\n" \
" .type _start, at function\n" \
"_start:\n" \
" move.d $sp,$r10\n" \
@@ -27,6 +28,7 @@ __asm__("" \
__asm__("" \
" .text\n" \
" .globl _start\n" \
+" .hidden _start\n" \
" .type _start, at function\n" \
"_start:\n" \
" move.d $sp,$r10\n" \
diff --git a/ldso/ldso/dl-elf.c b/ldso/ldso/dl-elf.c
index af4f621..0d3640d 100644
--- a/ldso/ldso/dl-elf.c
+++ b/ldso/ldso/dl-elf.c
@@ -184,7 +184,7 @@ search_for_named_library(const char *name, int secure, const char *path_list,
/* Used to return error codes back to dlopen et. al. */
unsigned long _dl_error_number;
-unsigned long _dl_internal_error_number;
+static unsigned long _dl_internal_error_number;
struct elf_resolve *_dl_load_shared_library(int secure, struct dyn_elf **rpnt,
struct elf_resolve *tpnt, char *full_libname, int attribute_unused trace_loaded_objects)
diff --git a/ldso/ldso/dl-startup.c b/ldso/ldso/dl-startup.c
index 09b0a43..17629b5 100644
--- a/ldso/ldso/dl-startup.c
+++ b/ldso/ldso/dl-startup.c
@@ -91,6 +91,9 @@
#include <ldso.h>
+/* Needed for standalone execution */
+static __attribute_used__ unsigned long _dl_skip_args = 0;
+
/* Pull in all the arch specific stuff */
#include <dl-startup.h>
diff --git a/ldso/ldso/i386/dl-startup.h b/ldso/ldso/i386/dl-startup.h
index 0c34514..e31e639 100644
--- a/ldso/ldso/i386/dl-startup.h
+++ b/ldso/ldso/i386/dl-startup.h
@@ -6,6 +6,7 @@
__asm__ (
" .text\n"
" .globl _start\n"
+ " .hidden _start\n"
" .type _start, at function\n"
"_start:\n"
" call _dl_start\n"
diff --git a/ldso/ldso/ldso.c b/ldso/ldso/ldso.c
index e0d1eb8..f2ea13b 100644
--- a/ldso/ldso/ldso.c
+++ b/ldso/ldso/ldso.c
@@ -43,6 +43,8 @@
#include "dl-tls.c"
#endif
+static const char *_dl_progname = UCLIBC_LDSO; /* The name of the executable being run */
+
/* Pull in the value of _dl_progname */
#include LDSO_ELFINTERP
#include "elfinterp_common.c"
@@ -54,16 +56,13 @@ static char *_dl_preload = NULL; /* Things to be loaded before the libs */
#endif
char *_dl_ldsopath = NULL; /* Location of the shared lib loader */
int _dl_errno = 0; /* We can't use the real errno in ldso */
-size_t _dl_pagesize = 0; /* Store the page size for use later */
+size_t _dl_pagesize = 0; /* Store the page size for later use */
struct r_debug *_dl_debug_addr = NULL; /* Used to communicate with the gdb debugger */
void *(*_dl_malloc_function) (size_t size) = NULL;
void (*_dl_free_function) (void *p) = NULL;
static int _dl_secure = 1; /* Are we dealing with setuid stuff? */
-/* Needed for standalone execution. */
-unsigned long attribute_hidden _dl_skip_args = 0;
-const char *_dl_progname = UCLIBC_LDSO; /* The name of the executable being run */
void _dl_get_ready_to_run(struct elf_resolve *tpnt, DL_LOADADDR_TYPE load_addr,
ElfW(auxv_t) auxvt[AT_EGID + 1], char **envp, char **argv
@@ -94,7 +93,7 @@ static unsigned char *_dl_mmap_zero = NULL; /* Also used by _dl_malloc */
static struct elf_resolve **init_fini_list;
static unsigned int nlist; /* # items in init_fini_list */
-extern void _start(void);
+extern void _start(void) attribute_hidden;
#ifdef __UCLIBC_HAS_SSP__
# include <dl-osinfo.h>
diff --git a/ldso/ldso/m68k/dl-startup.h b/ldso/ldso/m68k/dl-startup.h
index 13530e0..dccf772 100644
--- a/ldso/ldso/m68k/dl-startup.h
+++ b/ldso/ldso/m68k/dl-startup.h
@@ -18,6 +18,7 @@
__asm__ ("\
.text\n\
.globl _start\n\
+ .hidden _start\n\
.type _start, at function\n\
_start:\n\
move.l %sp, -(%sp)\n\
diff --git a/ldso/ldso/mips/dl-startup.h b/ldso/ldso/mips/dl-startup.h
index 31730d4..35dcee1 100644
--- a/ldso/ldso/mips/dl-startup.h
+++ b/ldso/ldso/mips/dl-startup.h
@@ -10,6 +10,7 @@
__asm__(""
" .text\n"
" .globl _start\n"
+ " .hidden _start\n"
" .ent _start\n"
" .type _start, at function\n"
"_start:\n"
diff --git a/ldso/ldso/powerpc/dl-startup.h b/ldso/ldso/powerpc/dl-startup.h
index e471aa0..29a2559 100644
--- a/ldso/ldso/powerpc/dl-startup.h
+++ b/ldso/ldso/powerpc/dl-startup.h
@@ -7,6 +7,7 @@
__asm__(
" .text\n"
" .globl _start\n"
+ " .hidden _start\n"
" .type _start, at function\n"
"_start:\n"
" mr 3,1\n" /* Pass SP to _dl_start in r3 */
diff --git a/ldso/ldso/sh/dl-startup.h b/ldso/ldso/sh/dl-startup.h
index ae7e224..a34cf5b 100644
--- a/ldso/ldso/sh/dl-startup.h
+++ b/ldso/ldso/sh/dl-startup.h
@@ -5,6 +5,7 @@
__asm__(
" .text\n"
" .globl _start\n"
+ " .hidden _start\n"
" .type _start, at function\n"
"_start:\n"
" mov r15, r4\n"
diff --git a/ldso/ldso/sh64/dl-startup.h b/ldso/ldso/sh64/dl-startup.h
index 7531341..6711b3c 100644
--- a/ldso/ldso/sh64/dl-startup.h
+++ b/ldso/ldso/sh64/dl-startup.h
@@ -6,6 +6,7 @@
__asm__("" \
" .section .text..SHmedia32,\"ax\"\n" \
" .globl _start\n" \
+" .hidden _start\n" \
" .type _start, @function\n" \
" .align 5\n" \
"_start:\n" \
diff --git a/ldso/ldso/sparc/dl-startup.h b/ldso/ldso/sparc/dl-startup.h
index 1abad11..a59eb92 100644
--- a/ldso/ldso/sparc/dl-startup.h
+++ b/ldso/ldso/sparc/dl-startup.h
@@ -7,6 +7,7 @@
__asm__ ("\
.text\n\
.global _start\n\
+ .hidden _start\n\
.type _start,%function\n\
.align 32\n\
.register %g2, #scratch\n\
diff --git a/ldso/ldso/x86_64/dl-startup.h b/ldso/ldso/x86_64/dl-startup.h
index 7e05846..f7b7a57 100644
--- a/ldso/ldso/x86_64/dl-startup.h
+++ b/ldso/ldso/x86_64/dl-startup.h
@@ -9,6 +9,7 @@
__asm__ (
" .text\n"
" .global _start\n"
+ " .hidden _start\n"
" .type _start,%function\n"
"_start:\n"
" movq %rsp, %rdi\n"
diff --git a/ldso/ldso/xtensa/dl-startup.h b/ldso/ldso/xtensa/dl-startup.h
index 8ae9624..6d35b5d 100644
--- a/ldso/ldso/xtensa/dl-startup.h
+++ b/ldso/ldso/xtensa/dl-startup.h
@@ -12,6 +12,7 @@ __asm__ (
" .text\n"
" .align 4\n"
" .global _start\n"
+ " .hidden _start\n"
" .type _start, @function\n"
"_start:\n"
" # Compute load offset in a2: the GOT has not yet been relocated\n"
diff --git a/ldso/libdl/libdl.c b/ldso/libdl/libdl.c
index 93bbb4c..c8f7e77 100644
--- a/ldso/libdl/libdl.c
+++ b/ldso/libdl/libdl.c
@@ -39,13 +39,13 @@
/* When libdl is linked as a static library, we need to replace all
* the symbols that otherwise would have been loaded in from ldso... */
-const char *_dl_progname = ""; /* Program name */
+static const char *_dl_progname= ""; /* Program name */
void *(*_dl_malloc_function)(size_t);
void (*_dl_free_function) (void *p);
char *_dl_library_path = NULL; /* Where we look for libraries */
char *_dl_ldsopath = NULL; /* Location of the shared lib loader */
int _dl_errno = 0; /* We can't use the real errno in ldso */
-size_t _dl_pagesize = PAGE_SIZE; /* Store the page size for use later */
+size_t _dl_pagesize = PAGE_SIZE; /* Store the page size for later use */
/* This global variable is also to communicate with debuggers such as gdb. */
struct r_debug *_dl_debug_addr = NULL;
--
1.7.3.4
More information about the uClibc-cvs
mailing list