]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
linux: Constify rfv variable in dl_vdso_vsym
authorAlan Modra <amodra@gmail.com>
Sat, 22 Jan 2022 03:02:39 +0000 (13:32 +1030)
committerAlan Modra <amodra@gmail.com>
Sat, 9 Apr 2022 23:03:02 +0000 (08:33 +0930)
Compilers may decide to put the rfv variable in .data rather than on
the stack.  It's slightly better to put it in .data.rel.ro.local
instead.  Regardles of that, making it const may enable further
optimisations.  Found when examining relative relocations (GOT ones
in particular) as part of enabling static-pie for PowerPC64.

sysdeps/unix/sysv/linux/dl-vdso.h

index bfefce8f35d49f8ec8f02b5e7c8ce1be194fd0c4..8611488accfb02e037109500ddae6053534c0800 100644 (file)
@@ -45,7 +45,7 @@ dl_vdso_vsym (const char *name)
   ElfW (Sym) wsym = { 0 };
   wsym.st_info = (unsigned char) ELFW (ST_INFO (STB_WEAK, STT_NOTYPE));
 
-  struct r_found_version rfv = { VDSO_NAME, VDSO_HASH, 1, NULL };
+  const struct r_found_version rfv = { VDSO_NAME, VDSO_HASH, 1, NULL };
 
   /* Search the scope of the vdso map.  */
   const ElfW (Sym) *ref = &wsym;