diff options
Diffstat (limited to 'tools/perf')
| -rw-r--r-- | tools/perf/util/symbol-elf.c | 35 |
1 files changed, 13 insertions, 22 deletions
diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c index f78ea3dc4c08..475d88d0a1c9 100644 --- a/tools/perf/util/symbol-elf.c +++ b/tools/perf/util/symbol-elf.c | |||
| @@ -1271,8 +1271,6 @@ out_close: | |||
| 1271 | static int kcore__init(struct kcore *kcore, char *filename, int elfclass, | 1271 | static int kcore__init(struct kcore *kcore, char *filename, int elfclass, |
| 1272 | bool temp) | 1272 | bool temp) |
| 1273 | { | 1273 | { |
| 1274 | GElf_Ehdr *ehdr; | ||
| 1275 | |||
| 1276 | kcore->elfclass = elfclass; | 1274 | kcore->elfclass = elfclass; |
| 1277 | 1275 | ||
| 1278 | if (temp) | 1276 | if (temp) |
| @@ -1289,9 +1287,7 @@ static int kcore__init(struct kcore *kcore, char *filename, int elfclass, | |||
| 1289 | if (!gelf_newehdr(kcore->elf, elfclass)) | 1287 | if (!gelf_newehdr(kcore->elf, elfclass)) |
| 1290 | goto out_end; | 1288 | goto out_end; |
| 1291 | 1289 | ||
| 1292 | ehdr = gelf_getehdr(kcore->elf, &kcore->ehdr); | 1290 | memset(&kcore->ehdr, 0, sizeof(GElf_Ehdr)); |
| 1293 | if (!ehdr) | ||
| 1294 | goto out_end; | ||
| 1295 | 1291 | ||
| 1296 | return 0; | 1292 | return 0; |
| 1297 | 1293 | ||
| @@ -1348,23 +1344,18 @@ static int kcore__copy_hdr(struct kcore *from, struct kcore *to, size_t count) | |||
| 1348 | static int kcore__add_phdr(struct kcore *kcore, int idx, off_t offset, | 1344 | static int kcore__add_phdr(struct kcore *kcore, int idx, off_t offset, |
| 1349 | u64 addr, u64 len) | 1345 | u64 addr, u64 len) |
| 1350 | { | 1346 | { |
| 1351 | GElf_Phdr gphdr; | 1347 | GElf_Phdr phdr = { |
| 1352 | GElf_Phdr *phdr; | 1348 | .p_type = PT_LOAD, |
| 1353 | 1349 | .p_flags = PF_R | PF_W | PF_X, | |
| 1354 | phdr = gelf_getphdr(kcore->elf, idx, &gphdr); | 1350 | .p_offset = offset, |
| 1355 | if (!phdr) | 1351 | .p_vaddr = addr, |
| 1356 | return -1; | 1352 | .p_paddr = 0, |
| 1357 | 1353 | .p_filesz = len, | |
| 1358 | phdr->p_type = PT_LOAD; | 1354 | .p_memsz = len, |
| 1359 | phdr->p_flags = PF_R | PF_W | PF_X; | 1355 | .p_align = page_size, |
| 1360 | phdr->p_offset = offset; | 1356 | }; |
| 1361 | phdr->p_vaddr = addr; | 1357 | |
| 1362 | phdr->p_paddr = 0; | 1358 | if (!gelf_update_phdr(kcore->elf, idx, &phdr)) |
| 1363 | phdr->p_filesz = len; | ||
| 1364 | phdr->p_memsz = len; | ||
| 1365 | phdr->p_align = page_size; | ||
| 1366 | |||
| 1367 | if (!gelf_update_phdr(kcore->elf, idx, phdr)) | ||
| 1368 | return -1; | 1359 | return -1; |
| 1369 | 1360 | ||
| 1370 | return 0; | 1361 | return 0; |
