From 7969407a01a108298ea506e0c37c1d6b7c9d424c Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Sun, 3 Feb 2002 00:31:37 +0000 Subject: Update. Change ld.so to not use functions which are exported. One cannot interpose them anyway. Use INT() to mark uses, INTDEF() to mark definitions. * include/libc-symbols.h: Define INT and INTDEF. * sysdeps/generic/ldsodefs.h: Declare _dl_debug_printf_internal, _dl_signal_error_internal, _dl_map_object_internal, _dl_map_object_deps_internal, _dl_lookup_symbol_internal, _dl_lookup_versioned_symbol_internal, _dl_relocate_object_internal, _dl_debug_state_internal, _dl_start_profile_internal, and _dl_unload_cache_internal. * include/dlfcn.h: Declare _dl_catch_error_internal. * elf/rtld.c: Use INT for calls to any of the *_internal functions above. Add INTDEF to function definitions. * elf/dl-debug.c: Likewise. * elf/dl-deps.c: Likewise. * elf/dl-dst.h: Likewise. * elf/dl-error.c: Likewise. * elf/dl-fini.c: Likewise. * elf/dl-init.c: Likewise. * elf/dl-load.c: Likewise. * elf/dl-lookup.c: Likewise. * elf/dl-misc.c: Likewise. * elf/dl-open.c: Likewise. * elf/dl-profile.c: Likewise. * elf/dl-reloc.c: Likewise. * elf/dl-runtime.c: Likewise. * elf/dl-version.c: Likewise. * elf/do-lookup.h: Likewise. * sysdeps/generic/dl-cache.c: Likewise. * sysdeps/generic/dl-sysdep.c: Likewise. * sysdeps/alpha/dl-machine.h (RTLD_START): Call _dl_init_internal instead of _dl_init. * sysdeps/arm/dl-machine.h: Likewise. * sysdeps/cris/dl-machine.h: Likewise. * sysdeps/hppa/dl-machine.h: Likewise. * sysdeps/i386/dl-machine.h: Likewise. * sysdeps/ia64/dl-machine.h: Likewise. * sysdeps/m68k/dl-machine.h: Likewise. * sysdeps/mips/dl-machine.h: Likewise. * sysdeps/mips/mips64/dl-machine.h: Likewise. * sysdeps/s390/s390-32/dl-machine.h: Likewise. * sysdeps/s390/s390-64/dl-machine.h: Likewise. * sysdeps/sh/dl-machine.h: Likewise. * sysdeps/sparc/sparc32/dl-machine.h: Likewise. * sysdeps/sparc/sparc64/dl-machine.h: Likewise. * sysdeps/x86_64/dl-machine.h: Likewise. * sysdeps/powerpc/dl-start.S (_dl_start_user): Likewise. * elf/Versions: Don't export _dl_check_all_versions, _dl_sysdep_start, and _dl_debug_initialize. --- sysdeps/alpha/dl-machine.h | 2 +- sysdeps/arm/dl-machine.h | 2 +- sysdeps/cris/dl-machine.h | 2 +- sysdeps/generic/dl-cache.c | 5 +++-- sysdeps/generic/dl-sysdep.c | 4 ++-- sysdeps/generic/ldsodefs.h | 40 ++++++++++++++++++++++++++++++++++++++ sysdeps/hppa/dl-machine.h | 2 +- sysdeps/i386/dl-machine.h | 2 +- sysdeps/ia64/dl-machine.h | 2 +- sysdeps/m68k/dl-machine.h | 2 +- sysdeps/mips/dl-machine.h | 2 +- sysdeps/mips/mips64/dl-machine.h | 4 ++-- sysdeps/powerpc/dl-start.S | 2 +- sysdeps/s390/s390-32/dl-machine.h | 2 +- sysdeps/s390/s390-64/dl-machine.h | 2 +- sysdeps/sh/dl-machine.h | 2 +- sysdeps/sparc/sparc32/dl-machine.h | 2 +- sysdeps/sparc/sparc64/dl-machine.h | 2 +- sysdeps/x86_64/dl-machine.h | 2 +- 19 files changed, 62 insertions(+), 21 deletions(-) (limited to 'sysdeps') diff --git a/sysdeps/alpha/dl-machine.h b/sysdeps/alpha/dl-machine.h index 9e4c6f4ebf..5feb46d69c 100644 --- a/sysdeps/alpha/dl-machine.h +++ b/sysdeps/alpha/dl-machine.h @@ -333,7 +333,7 @@ $fixup_stack_ret: \n\ lda $18, 8($sp) \n\ s8addq $17, 8, $19 \n\ addq $19, $18, $19 \n\ - jsr $26, _dl_init \n\ + jsr $26, _dl_init_internal \n\ /* Pass our finalizer function to the user in $0. */ \n\ lda $0, _dl_fini \n\ /* Jump to the user's entry point. */ \n\ diff --git a/sysdeps/arm/dl-machine.h b/sysdeps/arm/dl-machine.h index 4c302b5bf5..5d1656480d 100644 --- a/sysdeps/arm/dl-machine.h +++ b/sysdeps/arm/dl-machine.h @@ -302,7 +302,7 @@ _dl_start_user: ldr r0, [sl, r0] ldr r0, [r0] @ call _dl_init - bl _dl_init(PLT) + bl _dl_init_internal(PLT) @ clear the startup flag ldr r2, .L_STARTUP_FLAG ldr r1, [sl, r2] diff --git a/sysdeps/cris/dl-machine.h b/sysdeps/cris/dl-machine.h index ff27005f2a..34d29fa3ac 100644 --- a/sysdeps/cris/dl-machine.h +++ b/sysdeps/cris/dl-machine.h @@ -214,7 +214,7 @@ _dl_start_user: ; main_map: at _dl_loaded. move.d [$r0+_rtld_global:GOT16],$r9 move.d [$r9],$r10 - move.d _dl_init:PLTG,$r9 + move.d _dl_init_internal:PLTG,$r9 add.d $r0,$r9 jsr $r9 ; Pass our finalizer function to the user in R10. diff --git a/sysdeps/generic/dl-cache.c b/sysdeps/generic/dl-cache.c index 3800a677cc..a95f61f009 100644 --- a/sysdeps/generic/dl-cache.c +++ b/sysdeps/generic/dl-cache.c @@ -149,7 +149,7 @@ _dl_load_cache_lookup (const char *name) /* Print a message if the loading of libs is traced. */ if (__builtin_expect (GL(dl_debug_mask) & DL_DEBUG_LIBS, 0)) - _dl_debug_printf (" search cache=%s\n", LD_SO_CACHE); + INT(_dl_debug_printf) (" search cache=%s\n", LD_SO_CACHE); if (cache == NULL) { @@ -251,7 +251,7 @@ _dl_load_cache_lookup (const char *name) /* Print our result if wanted. */ if (__builtin_expect (GL(dl_debug_mask) & DL_DEBUG_LIBS, 0) && best != NULL) - _dl_debug_printf (" trying file=%s\n", best); + INT(_dl_debug_printf) (" trying file=%s\n", best); return best; } @@ -270,4 +270,5 @@ _dl_unload_cache (void) cache = NULL; } } +INTDEF (_dl_unload_cache) #endif diff --git a/sysdeps/generic/dl-sysdep.c b/sysdeps/generic/dl-sysdep.c index d3d5a8cefb..0fb40cb744 100644 --- a/sysdeps/generic/dl-sysdep.c +++ b/sysdeps/generic/dl-sysdep.c @@ -298,8 +298,8 @@ _dl_important_hwcaps (const char *platform, size_t platform_len, size_t *sz, if (result == NULL) { no_memory: - _dl_signal_error (ENOMEM, NULL, NULL, - N_("cannot create capability list")); + INT(_dl_signal_error) (ENOMEM, NULL, NULL, + N_("cannot create capability list")); } result[0].str = (char *) result; /* Does not really matter. */ diff --git a/sysdeps/generic/ldsodefs.h b/sysdeps/generic/ldsodefs.h index be6b172ece..0f63799524 100644 --- a/sysdeps/generic/ldsodefs.h +++ b/sysdeps/generic/ldsodefs.h @@ -352,6 +352,8 @@ extern int _dl_sysdep_open_zero_fill (void); /* dl-sysdep.c */ tag showing the PID. */ extern void _dl_debug_printf (const char *fmt, ...) __attribute__ ((__format__ (__printf__, 1, 2))); +extern void _dl_debug_printf_internal (const char *fmt, ...) + __attribute__ ((__format__ (__printf__, 1, 2))); /* Write message on the debug file descriptor. The parameters are interpreted as for a `printf' call. All the lines buf the first @@ -395,6 +397,11 @@ extern void _dl_signal_error (int errcode, const char *object, const char *occurred, const char *errstring) internal_function __attribute__ ((__noreturn__)); +extern void _dl_signal_error_internal (int errcode, const char *object, + const char *occurred, + const char *errstring) + internal_function + __attribute__ ((__noreturn__)); /* Like _dl_signal_error, but may return when called in the context of _dl_receive_error. */ @@ -420,6 +427,12 @@ extern struct link_map *_dl_map_object (struct link_map *loader, const char *name, int preloaded, int type, int trace_mode, int mode) internal_function; +extern struct link_map *_dl_map_object_internal (struct link_map *loader, + const char *name, + int preloaded, + int type, int trace_mode, + int mode) + internal_function; /* Call _dl_map_object on the dependencies of MAP, and set up MAP->l_searchlist. PRELOADS points to a vector of NPRELOADS previously @@ -429,6 +442,11 @@ extern void _dl_map_object_deps (struct link_map *map, struct link_map **preloads, unsigned int npreloads, int trace_mode) internal_function; +extern void _dl_map_object_deps_internal (struct link_map *map, + struct link_map **preloads, + unsigned int npreloads, + int trace_mode) + internal_function; /* Cache the locations of MAP's hash table. */ extern void _dl_setup_hash (struct link_map *map) internal_function; @@ -449,6 +467,12 @@ extern lookup_t _dl_lookup_symbol (const char *undef, struct r_scope_elem *symbol_scope[], int type_class, int explicit) internal_function; +extern lookup_t _dl_lookup_symbol_internal (const char *undef, + struct link_map *undef_map, + const ElfW(Sym) **sym, + struct r_scope_elem *symbol_scope[], + int type_class, int explicit) + internal_function; /* Lookup versioned symbol. */ extern lookup_t _dl_lookup_versioned_symbol (const char *undef, @@ -458,6 +482,14 @@ extern lookup_t _dl_lookup_versioned_symbol (const char *undef, const struct r_found_version *version, int type_class, int explicit) internal_function; +extern lookup_t _dl_lookup_versioned_symbol_internal (const char *undef, + struct link_map *undef_map, + const ElfW(Sym) **sym, + struct r_scope_elem *symbol_scope[], + const struct r_found_version *version, + int type_class, + int explicit) + internal_function; /* For handling RTLD_NEXT we must be able to skip shared objects. */ extern lookup_t _dl_lookup_symbol_skip (const char *undef, @@ -493,6 +525,9 @@ extern struct link_map *_dl_new_object (char *realname, const char *libname, extern void _dl_relocate_object (struct link_map *map, struct r_scope_elem *scope[], int lazy, int consider_profiling); +extern void _dl_relocate_object_internal (struct link_map *map, + struct r_scope_elem *scope[], + int lazy, int consider_profiling); /* Call _dl_signal_error with a message about an unhandled reloc type. TYPE is the result of ELFW(R_TYPE) (r_info), i.e. an R__* value. @@ -532,6 +567,7 @@ extern void _dl_fini (void) internal_function; says what change is taking place. This function's address is the value of the `r_brk' member. */ extern void _dl_debug_state (void); +extern void _dl_debug_state_internal (void); /* Initialize `struct r_debug' if it has not already been done. The argument is the run-time load address of the dynamic linker, to be put @@ -546,6 +582,9 @@ extern void _dl_init_paths (const char *library_path) internal_function; the timers. */ extern void _dl_start_profile (struct link_map *map, const char *output_dir) internal_function; +extern void _dl_start_profile_internal (struct link_map *map, + const char *output_dir) + internal_function; /* The actual functions used to keep book on the calls. */ extern void _dl_mcount (ElfW(Addr) frompc, ElfW(Addr) selfpc); @@ -579,6 +618,7 @@ extern const char *_dl_load_cache_lookup (const char *name) Therefore we provide this function to close the file and open it again once needed. */ extern void _dl_unload_cache (void); +extern void _dl_unload_cache_internal (void); /* System-dependent function to read a file's whole contents in the most convenient manner available. *SIZEP gets the size of the diff --git a/sysdeps/hppa/dl-machine.h b/sysdeps/hppa/dl-machine.h index 449fa9dbef..bc3a9839f7 100644 --- a/sysdeps/hppa/dl-machine.h +++ b/sysdeps/hppa/dl-machine.h @@ -372,7 +372,7 @@ asm ( \ \ /* envp = argv + argc + 1 */ \ " sh2add %r25,%r24,%r23\n" \ -" bl _dl_init,%r2\n" \ +" bl _dl_init_internal,%r2\n" \ " ldo 4(%r23),%r23\n" /* delay slot */ \ \ /* Reload argc, argv to the registers start.S expects them in (feh) */ \ diff --git a/sysdeps/i386/dl-machine.h b/sysdeps/i386/dl-machine.h index a3d3f2580f..69a0c5550e 100644 --- a/sysdeps/i386/dl-machine.h +++ b/sysdeps/i386/dl-machine.h @@ -243,7 +243,7 @@ _dl_start_user:\n\ pushl %eax\n\ movl (%esi), %eax\n\ # Call the function to run the initializers.\n\ - call _dl_init@PLT\n\ + call _dl_init_internal@PLT\n\ # Pass our finalizer function to the user in %edx, as per ELF ABI.\n\ movl _dl_fini@GOT(%ebx), %edx\n\ # Jump to the user's entry point.\n\ diff --git a/sysdeps/ia64/dl-machine.h b/sysdeps/ia64/dl-machine.h index 04381fe60d..49a5ef27bb 100644 --- a/sysdeps/ia64/dl-machine.h +++ b/sysdeps/ia64/dl-machine.h @@ -402,7 +402,7 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile) " { .mmb\n" \ " ld8 out0 = [out0] /* get the linkmap */\n" \ " st8 [r2] = r17 /* Load the new _dl_argv. */\n" \ -" br.call.sptk.many b0 = _dl_init#\n" \ +" br.call.sptk.many b0 = _dl_init_internal#\n" \ " ;;\n" \ " }\n" \ " /* Pass our finializer function to the user,\n" \ diff --git a/sysdeps/m68k/dl-machine.h b/sysdeps/m68k/dl-machine.h index 3b99978554..1645d83888 100644 --- a/sysdeps/m68k/dl-machine.h +++ b/sysdeps/m68k/dl-machine.h @@ -177,7 +177,7 @@ _dl_start_user:\n\ pea 8(%sp)\n\ move.l %d1, -(%sp)\n\ move.l ([_rtld_global@GOT.w, %a5]), -(%sp)\n\ - jbsr _dl_init@PLTPC\n\ + jbsr _dl_init_internal@PLTPC\n\ addq.l #8, %sp\n\ addq.l #8, %sp\n\ | Pass our finalizer function to the user in %a1.\n\ diff --git a/sysdeps/mips/dl-machine.h b/sysdeps/mips/dl-machine.h index 4c28e17c9f..18eb3eb377 100644 --- a/sysdeps/mips/dl-machine.h +++ b/sysdeps/mips/dl-machine.h @@ -449,7 +449,7 @@ _dl_start_user:\n\ addu $7, $7, 4\n\ subu $29, 16\n\ # Call the function to run the initializers.\n\ - jal _dl_init + jal _dl_init_internal\n\ addiu $29, 16\n\ # Pass our finalizer function to the user in $2 as per ELF ABI.\n\ la $2, _dl_fini\n\ diff --git a/sysdeps/mips/mips64/dl-machine.h b/sysdeps/mips/mips64/dl-machine.h index 7ee3cf52aa..6f89c0bb11 100644 --- a/sysdeps/mips/mips64/dl-machine.h +++ b/sysdeps/mips/mips64/dl-machine.h @@ -486,7 +486,7 @@ _dl_start_user:\n\ dla $7, 8($29)\n\ dsubu $29, 16\n\ # Call the function to run the initializers.\n\ - jal _dl_init + jal _dl_init_internal\n\ daddiu $29, 16\n\ # Pass our finalizer function to the user in ra.\n\ dla $31, _dl_fini\n\ @@ -498,7 +498,7 @@ _dl_start_user:\n\ la $7, 8($29)\n\ subu $29, 16\n\ # Call the function to run the initializers.\n\ - jal _dl_init + jal _dl_init_internal\n\ addiu $29, 16\n\ # Pass our finalizer function to the user in ra.\n\ dla $31, _dl_fini\n\ diff --git a/sysdeps/powerpc/dl-start.S b/sysdeps/powerpc/dl-start.S index 1bca5d5118..527982bfdf 100644 --- a/sysdeps/powerpc/dl-start.S +++ b/sysdeps/powerpc/dl-start.S @@ -63,7 +63,7 @@ ENTRY(_dl_start_user) slwi r6,r4,2 add r6,r5,r6 addi r6,r6,4 - bl _dl_init@local + bl _dl_init_internal@local /* Now, to conform to the ELF ABI, we have to: */ /* Pass argc (actually _dl_argc) in r3; */ diff --git a/sysdeps/s390/s390-32/dl-machine.h b/sysdeps/s390/s390-32/dl-machine.h index 2c7ba2ea6c..344d247550 100644 --- a/sysdeps/s390/s390-32/dl-machine.h +++ b/sysdeps/s390/s390-32/dl-machine.h @@ -305,7 +305,7 @@ _dl_start_user:\n\ .Llit:\n\ .Ladr0: .long _GLOBAL_OFFSET_TABLE_-.Llit\n\ .Ladr1: .long _dl_start-.Llit\n\ -.Ladr4: .long _dl_init@PLT-.Llit\n\ +.Ladr4: .long _dl_init_internal@PLT-.Llit\n\ "); #ifndef RTLD_START_SPECIAL_INIT diff --git a/sysdeps/s390/s390-64/dl-machine.h b/sysdeps/s390/s390-64/dl-machine.h index a6df8ddecd..fcbd02ed10 100644 --- a/sysdeps/s390/s390-64/dl-machine.h +++ b/sysdeps/s390/s390-64/dl-machine.h @@ -270,7 +270,7 @@ _dl_start_user:\n\ lgr %r5,%r3\n\ sllg %r5,%r5,3\n\ la %r5,176(%r5,%r15)\n\ - brasl %r14,_dl_init@PLT\n + brasl %r14,_dl_init_internal@PLT\n # Pass our finalizer function to the user in %r14, as per ELF ABI.\n\ lghi %r14,_dl_fini@GOT lg %r14,0(%r14,%r12)\n\ diff --git a/sysdeps/sh/dl-machine.h b/sysdeps/sh/dl-machine.h index 705e8d614b..72ea757dcb 100644 --- a/sysdeps/sh/dl-machine.h +++ b/sysdeps/sh/dl-machine.h @@ -386,7 +386,7 @@ _dl_start_user:\n\ .L_dl_skip_args:\n\ .long _dl_skip_args@GOT\n\ .L_dl_init:\n\ - .long _dl_init@PLT\n\ + .long _dl_init_internal@PLT\n\ .L_dl_loaded:\n\ .long _rtld_global@GOT\n\ .L_dl_starting_up:\n\ diff --git a/sysdeps/sparc/sparc32/dl-machine.h b/sysdeps/sparc/sparc32/dl-machine.h index 7544707447..69054572b8 100644 --- a/sysdeps/sparc/sparc32/dl-machine.h +++ b/sysdeps/sparc/sparc32/dl-machine.h @@ -320,7 +320,7 @@ _dl_start_user: add %o3, 4, %o3 mov %i5, %o1 add %o2, %o3, %o3 - call _dl_init + call _dl_init_internal ld [%o0], %o0 /* Pass our finalizer function to the user in %g1. */ sethi %hi(_dl_fini), %g1 diff --git a/sysdeps/sparc/sparc64/dl-machine.h b/sysdeps/sparc/sparc64/dl-machine.h index 8cfed7b8ec..c0cccf3b5c 100644 --- a/sysdeps/sparc/sparc64/dl-machine.h +++ b/sysdeps/sparc/sparc64/dl-machine.h @@ -753,7 +753,7 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile) " add %o3, 8, %o3\n" \ " mov %i5, %o1\n" \ " add %o2, %o3, %o3\n" \ -" call _dl_init\n" \ +" call _dl_init_internal\n" \ " ldx [%o0], %o0\n" \ " /* Pass our finalizer function to the user in %g1. */\n" \ " sethi %hi(_dl_fini), %g1\n" \ diff --git a/sysdeps/x86_64/dl-machine.h b/sysdeps/x86_64/dl-machine.h index 504c75e01b..949e8ec301 100644 --- a/sysdeps/x86_64/dl-machine.h +++ b/sysdeps/x86_64/dl-machine.h @@ -257,7 +257,7 @@ _dl_start_user:\n\ # argv -> rdx\n\ leaq 8(%rsp), %rdx\n\ # Call the function to run the initializers.\n\ - call _dl_init@PLT\n\ + call _dl_init_internal@PLT\n\ # Pass our finalizer function to the user in %rdx, as per ELF ABI.\n\ movq _dl_fini@GOTPCREL(%rip), %rdx\n\ # Jump to the user's entry point.\n\ -- cgit v1.2.3