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>
diff --git a/util/cbfstool/elfparsing.h b/util/cbfstool/elfparsing.h
index 4ad46b3..2827748 100644
--- a/util/cbfstool/elfparsing.h
+++ b/util/cbfstool/elfparsing.h
@@ -26,10 +26,20 @@
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)