[PATCH] S/390: Get rid of warning unused variable in dl-machine.h.

Stefan Liebler stli@linux.vnet.ibm.com
Tue Oct 7 15:20:00 GMT 2014


Hi,

This patch gets rid of warning generated by compiling elf/rtld.c on s390-64:
In file included from dynamic-link.h:88:0,
                  from rtld.c:352:
../sysdeps/s390/s390-64/dl-machine.h: In function ‘elf_machine_rela’:
../sysdeps/s390/s390-64/dl-machine.h:282:30: warning: unused variable 
‘refsym’ [-Wunused-variable]

The refsym variable in the function elf_machine_rela is declared and 
used in the following lines in dl-machine.h:
281:#ifndef RESOLVE_CONFLICT_FIND_MAP
     282:      const Elf64_Sym *const refsym = sym;
283:#endif

348: #ifndef RTLD_BOOTSTRAP
349: # ifndef RESOLVE_CONFLICT_FIND_MAP
     356:   if (__builtin_expect (sym->st_size > refsym->st_size, 0)
     357:       || (__builtin_expect (sym->st_size < refsym->st_size, 0)
     365: RTLD_PROGNAME, strtab + refsym->st_name);
     368:   MIN (sym->st_size, refsym->st_size));
370:# endif
406:#endif

This patch adds the #if !defined RTLD_BOOTSTRAP around the variable 
declaration.

This patch for s390-64 is equal to the patch for s390-32 with patch
"S/390: Get rid of unused variable warning in dl-machine.h" 
(c5eebdd084b77b0b581a3aa02213fa7cc5851216 by Andreas Krebbel 2014-01-07 
09:40:00).

Bye
Stefan

---
2014-10-07  Stefan Liebler  <stli@linux.vnet.ibm.com>

	* sysdeps/s390/s390-64/dl-machine.h (elf_machine_rela):
	Gate the definition of refsym additionally with !RTLD_BOOTSTRAP
	to get rid of unused variable warning.
-------------- next part --------------
diff --git a/sysdeps/s390/s390-64/dl-machine.h b/sysdeps/s390/s390-64/dl-machine.h
index e48d355..16a17bb 100644
--- a/sysdeps/s390/s390-64/dl-machine.h
+++ b/sysdeps/s390/s390-64/dl-machine.h
@@ -278,7 +278,8 @@ elf_machine_rela (struct link_map *map, const Elf64_Rela *reloc,
     return;
   else
     {
-#ifndef RESOLVE_CONFLICT_FIND_MAP
+#if !defined RTLD_BOOTSTRAP && !defined RESOLVE_CONFLICT_FIND_MAP
+      /* Only needed for R_390_COPY below.  */
       const Elf64_Sym *const refsym = sym;
 #endif
       struct link_map *sym_map = RESOLVE_MAP (&sym, version, r_type);


More information about the Libc-alpha mailing list