Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/libexec/ld.elf_so/arch/hppa Avoid compiler warnings about un...



details:   https://anonhg.NetBSD.org/src/rev/35ec05c1523d
branches:  trunk
changeset: 972118:35ec05c1523d
user:      skrll <skrll%NetBSD.org@localhost>
date:      Sat May 16 16:43:00 2020 +0000

description:
Avoid compiler warnings about uninitialised symnum

diffstat:

 libexec/ld.elf_so/arch/hppa/hppa_reloc.c |  9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)

diffs (41 lines):

diff -r 111c163443d6 -r 35ec05c1523d libexec/ld.elf_so/arch/hppa/hppa_reloc.c
--- a/libexec/ld.elf_so/arch/hppa/hppa_reloc.c  Sat May 16 16:16:59 2020 +0000
+++ b/libexec/ld.elf_so/arch/hppa/hppa_reloc.c  Sat May 16 16:43:00 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: hppa_reloc.c,v 1.46 2020/05/10 06:42:38 skrll Exp $    */
+/*     $NetBSD: hppa_reloc.c,v 1.47 2020/05/16 16:43:00 skrll Exp $    */
 
 /*-
  * Copyright (c) 2002, 2004 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: hppa_reloc.c,v 1.46 2020/05/10 06:42:38 skrll Exp $");
+__RCSID("$NetBSD: hppa_reloc.c,v 1.47 2020/05/16 16:43:00 skrll Exp $");
 #endif /* not lint */
 
 #include <stdlib.h>
@@ -420,12 +420,12 @@
        for (rela = obj->rela; rela < obj->relalim; rela++) {
                Elf_Addr        *where;
                Elf_Addr         tmp;
-               unsigned long    symnum;
 
                where = (Elf_Addr *)(obj->relocbase + rela->r_offset);
 
+               unsigned long symnum = ELF_R_SYM(rela->r_info);
                /* First, handle DIR32 and PLABEL32 without symbol. */
-               if (ELF_R_SYM(rela->r_info) == 0) {
+               if (symnum == 0) {
                        switch (ELF_R_TYPE(rela->r_info)) {
                        default:
                                break;
@@ -474,7 +474,6 @@
                case R_TYPE(TLS_TPREL32):
                case R_TYPE(TLS_DTPMOD32):
                case R_TYPE(TLS_DTPOFF32):
-                       symnum = ELF_R_SYM(rela->r_info);
                        if (last_symnum != symnum) {
                                last_symnum = symnum;
                                if (ELF_R_TYPE(rela->r_info) == R_TYPE(DIR32)) {



Home | Main Index | Thread Index | Old Index