Merge pull request #971 from kamalesh-babulal/readelf

lookup: Fix format string for symtab_read() on PPC64LE
This commit is contained in:
Joe Lawrence 2019-06-10 11:16:37 -04:00 committed by GitHub
commit 04977cb736
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -209,8 +209,18 @@ static void symtab_read(struct lookup_table *table, char *path)
ERROR("fopen");
while (fgets(line, 256, file)) {
matched = sscanf(line, "%*s %lx %s %s %s %*s %s %s\n",
&value, size, type, bind, ndx, name);
if (strstr(line, "[<localentry>: 8]")) {
/*
* 23: 0000000000000008 96 FUNC LOCAL DEFAULT [<localentry>: 8] 4 cmdline_proc_show
* On Power, local func syms Ndx is preceded with "[<localentry>: 8]"
* denoting local entry point offset of the function.
*/
matched = sscanf(line, "%*s %lx %s %s %s %*s [<localentry>: 8] %s %s\n",
&value, size, type, bind, ndx, name);
} else {
matched = sscanf(line, "%*s %lx %s %s %s %*s %s %s\n",
&value, size, type, bind, ndx, name);
}
if (matched == 5) {
name[0] = '\0';
@ -233,8 +243,13 @@ static void symtab_read(struct lookup_table *table, char *path)
rewind(file);
while (fgets(line, 256, file)) {
matched = sscanf(line, "%*s %lx %s %s %s %*s %s %s\n",
&value, size, type, bind, ndx, name);
if (strstr(line, "[<localentry>: 8]")) {
matched = sscanf(line, "%*s %lx %s %s %s %*s [<localentry>: 8] %s %s\n",
&value, size, type, bind, ndx, name);
} else {
matched = sscanf(line, "%*s %lx %s %s %s %*s %s %s\n",
&value, size, type, bind, ndx, name);
}
if (matched == 5) {
name[0] = '\0';