cbfstool: add relocation parsing to ELF parser

Optionally parse the relocation entries found within an ELF
file.

Change-Id: I343647f104901eb8a6a997ddf44aa5d36c31b44b
Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: http://review.coreboot.org/5374
Tested-by: build bot (Jenkins)
Reviewed-by: Marc Jones <marc.jones@se-eng.com>
This commit is contained in:
Aaron Durbin
2014-03-05 13:57:30 -06:00
committed by Aaron Durbin
parent d0f6165923
commit ccb5ad8d3c
2 changed files with 97 additions and 0 deletions

View File

@@ -26,10 +26,20 @@ struct parsed_elf {
Elf64_Ehdr ehdr;
Elf64_Phdr *phdr;
Elf64_Shdr *shdr;
/*
* The relocs array contains pointers to arrays of relocation
* structures. Each index into the relocs array corresponds to its
* corresponding section index. i.e. if a section i is of type SHT_REL
* or SHT_RELA then the corresponding index into the relocs array will
* contain the associated relocations. Otherwise thee entry will be
* NULL.
*/
Elf64_Rela **relocs;
};
#define ELF_PARSE_PHDR (1 << 0)
#define ELF_PARSE_SHDR (1 << 1)
#define ELF_PARSE_RELOC (1 << 2)
#define ELF_PARSE_ALL (-1)