Skip to content

Commit 6f2c2f9

Browse files
committed
scripts/sorttable: Remove unneeded Elf_Rel
The code had references to initialize the Elf_Rel relocation tables, but it was never used. Remove it. Cc: bpf <[email protected]> Cc: Masami Hiramatsu <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Mathieu Desnoyers <[email protected]> Cc: Andrew Morton <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Masahiro Yamada <[email protected]> Cc: Nathan Chancellor <[email protected]> Cc: Nicolas Schier <[email protected]> Cc: Zheng Yejian <[email protected]> Cc: Martin Kelly <[email protected]> Cc: Christophe Leroy <[email protected]> Cc: Josh Poimboeuf <[email protected]> Link: https://lore.kernel.org/[email protected] Signed-off-by: Steven Rostedt (Google) <[email protected]>
1 parent 4f48a28 commit 6f2c2f9

File tree

1 file changed

+2
-21
lines changed

1 file changed

+2
-21
lines changed

scripts/sorttable.h

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
#undef Elf_Addr
2727
#undef Elf_Ehdr
2828
#undef Elf_Shdr
29-
#undef Elf_Rel
3029
#undef Elf_Sym
3130
#undef ELF_ST_TYPE
3231
#undef uint_t
@@ -42,7 +41,6 @@
4241
# define Elf_Addr Elf64_Addr
4342
# define Elf_Ehdr Elf64_Ehdr
4443
# define Elf_Shdr Elf64_Shdr
45-
# define Elf_Rel Elf64_Rel
4644
# define Elf_Sym Elf64_Sym
4745
# define ELF_ST_TYPE ELF64_ST_TYPE
4846
# define uint_t uint64_t
@@ -57,7 +55,6 @@
5755
# define Elf_Addr Elf32_Addr
5856
# define Elf_Ehdr Elf32_Ehdr
5957
# define Elf_Shdr Elf32_Shdr
60-
# define Elf_Rel Elf32_Rel
6158
# define Elf_Sym Elf32_Sym
6259
# define ELF_ST_TYPE ELF32_ST_TYPE
6360
# define uint_t uint32_t
@@ -248,14 +245,10 @@ static int do_sort(Elf_Ehdr *ehdr,
248245
Elf32_Word *symtab_shndx = NULL;
249246
Elf_Sym *sort_needed_sym = NULL;
250247
Elf_Shdr *sort_needed_sec;
251-
Elf_Rel *relocs = NULL;
252-
int relocs_size = 0;
253248
uint32_t *sort_needed_loc;
254249
const char *secstrings;
255250
const char *strtab;
256251
char *extab_image;
257-
int extab_index = 0;
258-
int i;
259252
int idx;
260253
unsigned int shnum;
261254
unsigned int shstrndx;
@@ -279,23 +272,15 @@ static int do_sort(Elf_Ehdr *ehdr,
279272
if (shnum == SHN_UNDEF)
280273
shnum = _r(&shdr[0].sh_size);
281274

282-
for (i = 0, s = shdr; s < shdr + shnum; i++, s++) {
275+
for (s = shdr; s < shdr + shnum; s++) {
283276
idx = r(&s->sh_name);
284-
if (!strcmp(secstrings + idx, "__ex_table")) {
277+
if (!strcmp(secstrings + idx, "__ex_table"))
285278
extab_sec = s;
286-
extab_index = i;
287-
}
288279
if (!strcmp(secstrings + idx, ".symtab"))
289280
symtab_sec = s;
290281
if (!strcmp(secstrings + idx, ".strtab"))
291282
strtab_sec = s;
292283

293-
if ((r(&s->sh_type) == SHT_REL ||
294-
r(&s->sh_type) == SHT_RELA) &&
295-
r(&s->sh_info) == extab_index) {
296-
relocs = (void *)ehdr + _r(&s->sh_offset);
297-
relocs_size = _r(&s->sh_size);
298-
}
299284
if (r(&s->sh_type) == SHT_SYMTAB_SHNDX)
300285
symtab_shndx = (Elf32_Word *)((const char *)ehdr +
301286
_r(&s->sh_offset));
@@ -397,10 +382,6 @@ static int do_sort(Elf_Ehdr *ehdr,
397382
extable_ent_size, compare_extable);
398383
}
399384

400-
/* If there were relocations, we no longer need them. */
401-
if (relocs)
402-
memset(relocs, 0, relocs_size);
403-
404385
/* find the flag main_extable_sort_needed */
405386
for (sym = (void *)ehdr + _r(&symtab_sec->sh_offset);
406387
sym < sym + _r(&symtab_sec->sh_size) / sizeof(Elf_Sym);

0 commit comments

Comments
 (0)