mirror of
https://github.com/dynup/kpatch
synced 2025-01-03 03:02:01 +00:00
lookup: Skip .dynsym table in symtab_read()
On powerpc, "readelf -s" of vmlinux shows both .dynsym and .symtab. .dynsym is just a subset of .symtab, so skip it to avoid duplicates. Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
This commit is contained in:
parent
7e48138185
commit
e4d37dad5d
@ -35,6 +35,7 @@
|
||||
#include <gelf.h>
|
||||
#include <unistd.h>
|
||||
#include <libgen.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "lookup.h"
|
||||
#include "log.h"
|
||||
@ -203,6 +204,7 @@ static void symtab_read(struct lookup_table *table, char *path)
|
||||
long unsigned int value;
|
||||
int alloc_nr = 0, i = 0;
|
||||
int matched;
|
||||
bool skip = false;
|
||||
char line[256], name[256], size[16], type[16], bind[16], ndx[16];
|
||||
|
||||
if ((file = fopen(path, "r")) == NULL)
|
||||
@ -224,6 +226,22 @@ static void symtab_read(struct lookup_table *table, char *path)
|
||||
|
||||
/* Now read the actual entries: */
|
||||
while (fgets(line, 256, file)) {
|
||||
|
||||
/*
|
||||
* On powerpc, "readelf -s" shows both .dynsym and .symtab
|
||||
* tables. .dynsym is just a subset of .symtab, so skip it to
|
||||
* avoid duplicates.
|
||||
*/
|
||||
if (strstr(line, ".dynsym")) {
|
||||
skip = true;
|
||||
continue;
|
||||
} else if (strstr(line, ".symtab")) {
|
||||
skip = false;
|
||||
continue;
|
||||
}
|
||||
if (skip)
|
||||
continue;
|
||||
|
||||
matched = sscanf(line, "%*s %lx %s %s %s %*s %s %s\n",
|
||||
&value, size, type, bind, ndx, name);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user