Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 1 | Upstream-Status: Backport |
| 2 | |
| 3 | Remove unused variables from the code to prevent -Werror causing a build |
| 4 | failure on hosts with GCC 4.6. |
| 5 | |
| 6 | These changes are all upstream so should not be required once we've updated |
| 7 | to elfutils 0.152 or later. Therefore this patch consolidates several |
| 8 | changes from elfutils upstream by Roland McGrath into a single file so that |
| 9 | it's easier to remove later once we upgrade. |
| 10 | Links to upstream gitweb of the consolidated commits follow: |
| 11 | - http://git.fedorahosted.org/git?p=elfutils.git;a=commit;h=7094d00a169afb27e0323f8580e817798ae7c240 |
| 12 | - http://git.fedorahosted.org/git?p=elfutils.git;a=commit;h=fd992543185126eb0280c1ee0883e073020499b4 |
| 13 | - http://git.fedorahosted.org/git?p=elfutils.git;a=commit;h=4db89f04bb59327abd7a3b60e88f2e7e73c65c79 |
| 14 | - http://git.fedorahosted.org/git?p=elfutils.git;a=commit;h=8f6c1795ab9d41f03805eebd55767070ade55aac |
| 15 | - http://git.fedorahosted.org/git?p=elfutils.git;a=commit;h=240784b48aa276822c5a61c9ad6a4355051ce259 |
| 16 | |
| 17 | Joshua Lock <josh@linux.intel.com> - 06/04/11 |
| 18 | |
| 19 | Index: elfutils-0.148/libasm/asm_newscn.c |
| 20 | =================================================================== |
| 21 | --- elfutils-0.148.orig/libasm/asm_newscn.c |
| 22 | +++ elfutils-0.148/libasm/asm_newscn.c |
| 23 | @@ -162,7 +162,6 @@ asm_newscn (ctx, scnname, type, flags) |
| 24 | GElf_Xword flags; |
| 25 | { |
| 26 | size_t scnname_len = strlen (scnname) + 1; |
| 27 | - unsigned long int hval; |
| 28 | AsmScn_t *result; |
| 29 | |
| 30 | /* If no context is given there might be an earlier error. */ |
| 31 | @@ -180,8 +179,6 @@ asm_newscn (ctx, scnname, type, flags) |
| 32 | return NULL; |
| 33 | } |
| 34 | |
| 35 | - hval = elf_hash (scnname); |
| 36 | - |
| 37 | rwlock_wrlock (ctx->lock); |
| 38 | |
| 39 | /* This is a new section. */ |
| 40 | Index: elfutils-0.148/src/elflint.c |
| 41 | =================================================================== |
| 42 | --- elfutils-0.148.orig/src/elflint.c |
| 43 | +++ elfutils-0.148/src/elflint.c |
| 44 | @@ -707,9 +707,10 @@ section [%2d] '%s': symbol %zu: invalid |
| 45 | { |
| 46 | if (xndxdata == NULL) |
| 47 | { |
| 48 | - ERROR (gettext ("\ |
| 49 | + if (!no_xndx_warned) |
| 50 | + ERROR (gettext ("\ |
| 51 | section [%2d] '%s': symbol %zu: too large section index but no extended section index section\n"), |
| 52 | - idx, section_name (ebl, idx), cnt); |
| 53 | + idx, section_name (ebl, idx), cnt); |
| 54 | no_xndx_warned = true; |
| 55 | } |
| 56 | else if (xndx < SHN_LORESERVE) |
| 57 | @@ -1592,10 +1593,6 @@ check_dynamic (Ebl *ebl, GElf_Ehdr *ehdr |
| 58 | [DT_STRSZ] = true, |
| 59 | [DT_SYMENT] = true |
| 60 | }; |
| 61 | - GElf_Addr reladdr = 0; |
| 62 | - GElf_Word relsz = 0; |
| 63 | - GElf_Addr pltreladdr = 0; |
| 64 | - GElf_Word pltrelsz = 0; |
| 65 | |
| 66 | memset (has_dt, '\0', sizeof (has_dt)); |
| 67 | memset (has_val_dt, '\0', sizeof (has_val_dt)); |
| 68 | @@ -1694,15 +1691,6 @@ section [%2d] '%s': entry %zu: level 2 t |
| 69 | section [%2d] '%s': entry %zu: DT_PLTREL value must be DT_REL or DT_RELA\n"), |
| 70 | idx, section_name (ebl, idx), cnt); |
| 71 | |
| 72 | - if (dyn->d_tag == DT_REL) |
| 73 | - reladdr = dyn->d_un.d_ptr; |
| 74 | - if (dyn->d_tag == DT_RELSZ) |
| 75 | - relsz = dyn->d_un.d_val; |
| 76 | - if (dyn->d_tag == DT_JMPREL) |
| 77 | - pltreladdr = dyn->d_un.d_ptr; |
| 78 | - if (dyn->d_tag == DT_PLTRELSZ) |
| 79 | - pltrelsz = dyn->d_un.d_val; |
| 80 | - |
| 81 | /* Check that addresses for entries are in loaded segments. */ |
| 82 | switch (dyn->d_tag) |
| 83 | { |
| 84 | Index: elfutils-0.148/src/ldgeneric.c |
| 85 | =================================================================== |
| 86 | --- elfutils-0.148.orig/src/ldgeneric.c |
| 87 | +++ elfutils-0.148/src/ldgeneric.c |
| 88 | @@ -285,12 +285,10 @@ static int |
| 89 | check_for_duplicate2 (struct usedfiles *newp, struct usedfiles *list) |
| 90 | { |
| 91 | struct usedfiles *first; |
| 92 | - struct usedfiles *prevp; |
| 93 | |
| 94 | if (list == NULL) |
| 95 | return 0; |
| 96 | |
| 97 | - prevp = list; |
| 98 | list = first = list->next; |
| 99 | do |
| 100 | { |
| 101 | Index: elfutils-0.148/src/ldscript.y |
| 102 | =================================================================== |
| 103 | --- elfutils-0.148.orig/src/ldscript.y |
| 104 | +++ elfutils-0.148/src/ldscript.y |
| 105 | @@ -802,12 +802,9 @@ add_versions (struct version *versions) |
| 106 | |
| 107 | do |
| 108 | { |
| 109 | - struct version *oldp; |
| 110 | - |
| 111 | add_id_list (versions->versionname, versions->local_names, true); |
| 112 | add_id_list (versions->versionname, versions->global_names, false); |
| 113 | |
| 114 | - oldp = versions; |
| 115 | versions = versions->next; |
| 116 | } |
| 117 | while (versions != NULL); |
| 118 | Index: elfutils-0.148/src/unstrip.c |
| 119 | =================================================================== |
| 120 | --- elfutils-0.148.orig/src/unstrip.c |
| 121 | +++ elfutils-0.148/src/unstrip.c |
| 122 | @@ -1301,7 +1301,6 @@ more sections in stripped file than debu |
| 123 | /* Match each debuginfo section with its corresponding stripped section. */ |
| 124 | bool check_prelink = false; |
| 125 | Elf_Scn *unstripped_symtab = NULL; |
| 126 | - size_t unstripped_strtab_ndx = SHN_UNDEF; |
| 127 | size_t alloc_avail = 0; |
| 128 | scn = NULL; |
| 129 | while ((scn = elf_nextscn (unstripped, scn)) != NULL) |
| 130 | @@ -1313,7 +1312,6 @@ more sections in stripped file than debu |
| 131 | if (shdr->sh_type == SHT_SYMTAB) |
| 132 | { |
| 133 | unstripped_symtab = scn; |
| 134 | - unstripped_strtab_ndx = shdr->sh_link; |
| 135 | continue; |
| 136 | } |
| 137 | |
| 138 | Index: elfutils-0.148/src/ldscript.c |
| 139 | =================================================================== |
| 140 | --- elfutils-0.148.orig/src/ldscript.c |
| 141 | +++ elfutils-0.148/src/ldscript.c |
| 142 | @@ -2728,12 +2728,9 @@ add_versions (struct version *versions) |
| 143 | |
| 144 | do |
| 145 | { |
| 146 | - struct version *oldp; |
| 147 | - |
| 148 | add_id_list (versions->versionname, versions->local_names, true); |
| 149 | add_id_list (versions->versionname, versions->global_names, false); |
| 150 | |
| 151 | - oldp = versions; |
| 152 | versions = versions->next; |
| 153 | } |
| 154 | while (versions != NULL); |