diff options
author | Ulrich Drepper <drepper@redhat.com> | 2004-01-15 06:38:27 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2004-01-15 06:38:27 +0000 |
commit | 392a6b52656c1bb40305375b0ea9020455044f9d (patch) | |
tree | 7f1b5fa05ad490bae7df8b3947d6f59f98aa082a /elf | |
parent | cb6ee14a12384563853788c938a86c5354fdea2d (diff) | |
download | glibc-392a6b52656c1bb40305375b0ea9020455044f9d.zip glibc-392a6b52656c1bb40305375b0ea9020455044f9d.tar.gz glibc-392a6b52656c1bb40305375b0ea9020455044f9d.tar.bz2 |
Update.
2004-01-14 Ulrich Drepper <drepper@redhat.com>
* configure.in: Define HAVE_Z_RELRO if the linker supports -z relro.
* config.h.in: Add entry for HAVE_Z_RELRO.
* include/libc-symbols.h: Define attribute_relro.
* elf/dl-load.c: Add attribute_relro to env_path_list, capstr, ncapstr,
max_capstrlen, and max_dirnamelen definitions.
* elf/rtld.c: Add attribute_relro to _dl_argc, _dl_argv, _dl_skip_args,
load_time, start_time, library_path, preloadlist, version_info,
any_debug.
Remove rtld_total_time. Make it a local variable. Pass pointer to
it to print_statistics. Change print_statistics accordingly.
* sysdeps/generic/dl-sysdep.c: Add attribute_relro to _dl_auxv. Use
attribute_relro instead of explicitly assigning variable to the
.data.rel.ro section for __libc_enable_secure and __libc_stack_end.
* sysdeps/generic/ldsodefs.h: Declare __libc_stack_end, _dl_argc,
_dl_argv, _dl_argv_internal with attribute_relro.
Diffstat (limited to 'elf')
-rw-r--r-- | elf/dl-load.c | 12 | ||||
-rw-r--r-- | elf/rtld.c | 42 |
2 files changed, 27 insertions, 27 deletions
diff --git a/elf/dl-load.c b/elf/dl-load.c index 99ca6a0..527a5f1 100644 --- a/elf/dl-load.c +++ b/elf/dl-load.c @@ -121,12 +121,12 @@ struct filebuf }; /* This is the decomposed LD_LIBRARY_PATH search path. */ -static struct r_search_path_struct env_path_list; +static struct r_search_path_struct env_path_list attribute_relro; /* List of the hardware capabilities we might end up using. */ -static const struct r_strlenpair *capstr; -static size_t ncapstr; -static size_t max_capstrlen; +static const struct r_strlenpair *capstr attribute_relro; +static size_t ncapstr attribute_relro; +static size_t max_capstrlen attribute_relro; /* Get the generated information about the trusted directories. */ @@ -357,9 +357,9 @@ add_name_to_object (struct link_map *l, const char *name) } /* Standard search directories. */ -static struct r_search_path_struct rtld_search_dirs; +static struct r_search_path_struct rtld_search_dirs attribute_relro; -static size_t max_dirnamelen; +static size_t max_dirnamelen attribute_relro; static struct r_search_path_elem ** fillin_rpath (char *rpath, struct r_search_path_elem **result, const char *sep, @@ -57,7 +57,7 @@ static void print_missing_version (int errcode, const char *objname, const char *errsting); /* Print the various times we collected. */ -static void print_statistics (void); +static void print_statistics (hp_timing_t *total_timep); /* This is a list of all the modes the dynamic loader can be in. */ enum mode { normal, list, verify, trace }; @@ -67,12 +67,12 @@ enum mode { normal, list, verify, trace }; all the entries. */ static void process_envvars (enum mode *modep); -int _dl_argc attribute_hidden; -char **_dl_argv = NULL; +int _dl_argc attribute_relro attribute_hidden; +char **_dl_argv attribute_relro; INTDEF(_dl_argv) /* Nonzero if we were run directly. */ -unsigned int _dl_skip_args attribute_hidden; +unsigned int _dl_skip_args attribute_relro attribute_hidden; /* Set nonzero during loading and initialization of executable and libraries, cleared before the executable's entry point runs. This @@ -115,6 +115,7 @@ extern struct rtld_global _rtld_local static void dl_main (const ElfW(Phdr) *phdr, ElfW(Word) phnum, ElfW(Addr) *user_entry); +/* These two variables cannot be moved into .data.rel.ro. */ static struct libname_list _dl_rtld_libname; static struct libname_list _dl_rtld_libname2; @@ -126,10 +127,9 @@ static struct libname_list _dl_rtld_libname2; /* Variable for statistics. */ #ifndef HP_TIMING_NONAVAIL -static hp_timing_t rtld_total_time; static hp_timing_t relocate_time; -static hp_timing_t load_time; -static hp_timing_t start_time; +static hp_timing_t load_time attribute_relro; +static hp_timing_t start_time attribute_relro; #endif /* Additional definitions needed by TLS initialization. */ @@ -263,6 +263,7 @@ _dl_start_final (void *arg, struct dl_start_final_info *info) start_addr = _dl_sysdep_start (arg, &dl_main); #ifndef HP_TIMING_NONAVAIL + hp_timing_t rtld_total_time; if (HP_TIMING_AVAIL) { hp_timing_t end_time; @@ -276,7 +277,7 @@ _dl_start_final (void *arg, struct dl_start_final_info *info) #endif if (__builtin_expect (GL(dl_debug_mask) & DL_DEBUG_STATISTICS, 0)) - print_statistics (); + print_statistics (&rtld_total_time); return start_addr; } @@ -619,10 +620,12 @@ static void rtld_lock_default_unlock_recursive (void *lock) #endif -static const char *library_path; /* The library search path. */ -static const char *preloadlist; /* The list preloaded objects. */ -static int version_info; /* Nonzero if information about - versions has to be printed. */ +/* The library search path. */ +static const char *library_path attribute_relro; +/* The list preloaded objects. */ +static const char *preloadlist attribute_relro; +/* Nonzero if information about versions has to be printed. */ +static int version_info attribute_relro; static void dl_main (const ElfW(Phdr) *phdr, @@ -1815,7 +1818,7 @@ print_missing_version (int errcode __attribute__ ((unused)), } /* Nonzero if any of the debugging options is enabled. */ -static int any_debug; +static int any_debug attribute_relro; /* Process the string given as the parameter which explains which debugging options are enabled. */ @@ -2127,7 +2130,7 @@ process_envvars (enum mode *modep) /* Print the various times we collected. */ static void -print_statistics (void) +print_statistics (hp_timing_t *rtld_total_timep) { #ifndef HP_TIMING_NONAVAIL char buf[200]; @@ -2137,18 +2140,15 @@ print_statistics (void) /* Total time rtld used. */ if (HP_TIMING_AVAIL) { - HP_TIMING_PRINT (buf, sizeof (buf), rtld_total_time); + HP_TIMING_PRINT (buf, sizeof (buf), *rtld_total_timep); INTUSE(_dl_debug_printf) ("\nruntime linker statistics:\n" " total startup time in dynamic loader: %s\n", buf); - } - /* Print relocation statistics. */ - if (HP_TIMING_AVAIL) - { + /* Print relocation statistics. */ char pbuf[30]; HP_TIMING_PRINT (buf, sizeof (buf), relocate_time); - cp = _itoa ((1000ULL * relocate_time) / rtld_total_time, + cp = _itoa ((1000ULL * relocate_time) / *rtld_total_timep, pbuf + sizeof (pbuf), 10, 0); wp = pbuf; switch (pbuf + sizeof (pbuf) - cp) @@ -2198,7 +2198,7 @@ print_statistics (void) { char pbuf[30]; HP_TIMING_PRINT (buf, sizeof (buf), load_time); - cp = _itoa ((1000ULL * load_time) / rtld_total_time, + cp = _itoa ((1000ULL * load_time) / *rtld_total_timep, pbuf + sizeof (pbuf), 10, 0); wp = pbuf; switch (pbuf + sizeof (pbuf) - cp) |