Put AT_CLKTCK in ELF auxiliary vectors

Put AT_CLKTCK in ELF auxiliary vectors because some functions
use the value as described below.
1. GLRO(dl_clktck) set by
   _dl_aux_init (in glibc/elf/dl-support.c)
   or
   _dl_sysdep_start (in elf/dl-sysdep.c)

2. GLRO(dl_clktck) is referenced by
__sysconf (in glibc/sysdeps/posix/sysconf.c)
   __getclktck
      (in glibc/sysdeps/unix/sysv/linux/getclktck.c)
profil (in glibc/sysdeps/posix/profil.c)
   __profile_frequency
      (in glibc/sysdeps/unix/sysv/linux/prof-freq.c)
This commit is contained in:
Masamichi Takagi
2014-07-31 16:11:31 +09:00
parent 27bfe37b80
commit 0dd7a8deff
4 changed files with 5 additions and 0 deletions

View File

@@ -79,6 +79,7 @@ struct program_load_desc {
unsigned long at_phent;
unsigned long at_phnum;
unsigned long at_entry;
unsigned long at_clktck;
char *args;
unsigned long args_len;
char *envs;

View File

@@ -221,6 +221,7 @@ struct program_load_desc *load_elf(FILE *fp, char **interp_pathp)
desc->at_phent = sizeof(phdr);
desc->at_phnum = hdr.e_phnum;
desc->at_entry = hdr.e_entry;
desc->at_clktck = sysconf(_SC_CLK_TCK);
return desc;
}

View File

@@ -119,6 +119,7 @@ struct program_load_desc {
unsigned long at_phent;
unsigned long at_phnum;
unsigned long at_entry;
unsigned long at_clktck;
char *args;
unsigned long args_len;
char *envs;

View File

@@ -1396,6 +1396,8 @@ int init_process_stack(struct process *process, struct program_load_desc *pn,
p[s_ind--] = AT_PHDR;
p[s_ind--] = 4096; /* AT_PAGESZ */
p[s_ind--] = AT_PAGESZ;
p[s_ind--] = pn->at_clktck; /* AT_CLKTCK */
p[s_ind--] = AT_CLKTCK;
p[s_ind--] = 0; /* envp terminating NULL */
/* envp */
for (arg_ind = envc - 1; arg_ind > -1; --arg_ind) {