summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/libelfu/modeltypes.h3
-rw-r--r--src/model/fromFile.c21
2 files changed, 20 insertions, 4 deletions
diff --git a/include/libelfu/modeltypes.h b/include/libelfu/modeltypes.h
index c02eb34..961f904 100644
--- a/include/libelfu/modeltypes.h
+++ b/include/libelfu/modeltypes.h
@@ -12,7 +12,8 @@ typedef struct ElfuScn {
Elf_Data data;
- struct ElfuScn *link;
+ struct ElfuScn *linkptr;
+ struct ElfuScn *infoptr;
CIRCLEQ_ENTRY(ElfuScn) elemPhdrToScn;
CIRCLEQ_ENTRY(ElfuScn) elem;
diff --git a/src/model/fromFile.c b/src/model/fromFile.c
index 125ea77..bd085f6 100644
--- a/src/model/fromFile.c
+++ b/src/model/fromFile.c
@@ -124,7 +124,8 @@ static ElfuScn* modelFromSection(Elf_Scn *scn)
}
}
- ms->link = NULL;
+ ms->linkptr = NULL;
+ ms->infoptr = NULL;
return ms;
@@ -224,8 +225,22 @@ ElfuElf* elfu_mFromElf(Elf *e)
for (i = 0; i < numShdr - 1; i++) {
ElfuScn *ms = secArray[i];
- if (ms->shdr.sh_link > 0) {
- ms->link = secArray[ms->shdr.sh_link - 1];
+ switch (ms->shdr.sh_type) {
+ case SHT_REL:
+ case SHT_RELA:
+ if (ms->shdr.sh_info > 0) {
+ ms->infoptr = secArray[ms->shdr.sh_info - 1];
+ }
+ case SHT_DYNAMIC:
+ case SHT_HASH:
+ case SHT_SYMTAB:
+ case SHT_DYNSYM:
+ case SHT_GNU_versym:
+ case SHT_GNU_verdef:
+ case SHT_GNU_verneed:
+ if (ms->shdr.sh_link > 0) {
+ ms->linkptr = secArray[ms->shdr.sh_link - 1];
+ }
}
}