diff options
author | norly <ny-git@enpas.org> | 2013-05-27 03:18:00 +0100 |
---|---|---|
committer | norly <ny-git@enpas.org> | 2013-05-27 03:18:00 +0100 |
commit | 29dfd585e8f8d87d978259919f74815493899f01 (patch) | |
tree | 570de3bd6861dfb085234a1ab0440feb77fbf804 /src/model | |
parent | f4d5a2e8d569d68fe4fa536e4ce9c3aee7c9285c (diff) |
Turn elfu_gScnSizeFile into a macro
Diffstat (limited to 'src/model')
-rw-r--r-- | src/model/check.c | 4 | ||||
-rw-r--r-- | src/model/reladd.c | 4 | ||||
-rw-r--r-- | src/model/section-in-segment.c | 2 |
3 files changed, 5 insertions, 5 deletions
diff --git a/src/model/check.c b/src/model/check.c index 2c8c67e..4fb042c 100644 --- a/src/model/check.c +++ b/src/model/check.c @@ -68,7 +68,7 @@ int elfu_mCheck(ElfuElf *me) /* Check for overlapping sections */ for (i = 0; i < numSecs - 1; i++) { - if (sortedSecs[i]->shdr.sh_offset + elfu_gScnSizeFile(&sortedSecs[i]->shdr) + if (sortedSecs[i]->shdr.sh_offset + SCNFILESIZE(&sortedSecs[i]->shdr) > sortedSecs[i+1]->shdr.sh_offset) { ELFU_WARN("elfu_check: Found overlapping sections: %s and %s.\n", elfu_mScnName(me, sortedSecs[i]), @@ -89,7 +89,7 @@ int elfu_mCheck(ElfuElf *me) /* Check for sections overlapping with PHDRs */ for (i = 0; i < numSecs; i++) { if (isOverlapping(sortedSecs[i]->shdr.sh_offset, - elfu_gScnSizeFile(&sortedSecs[i]->shdr), + SCNFILESIZE(&sortedSecs[i]->shdr), me->ehdr.e_phoff, me->ehdr.e_phentsize * me->ehdr.e_phnum)) { ELFU_WARN("elfu_check: Found section overlapping with PHDRs: %s.\n", diff --git a/src/model/reladd.c b/src/model/reladd.c index 41d7cfb..549afcf 100644 --- a/src/model/reladd.c +++ b/src/model/reladd.c @@ -119,7 +119,7 @@ static ElfuScn* insertSection(ElfuElf *me, ElfuElf *mrel, ElfuScn *ms) // TODO: Error handling } else { - injOffset = lastScn->shdr.sh_offset + elfu_gScnSizeFile(&lastScn->shdr); + injOffset = lastScn->shdr.sh_offset + SCNFILESIZE(&lastScn->shdr); ELFU_INFO("Expanding at offset 0x%jx...\n", injOffset); @@ -129,7 +129,7 @@ static ElfuScn* insertSection(ElfuElf *me, ElfuElf *mrel, ElfuScn *ms) /* Recalculate injOffset in case we expanded a NOBITS section */ lastScn = elfu_mScnLastInSegment(me, injAnchor); - injOffset = lastScn->shdr.sh_offset + elfu_gScnSizeFile(&lastScn->shdr); + injOffset = lastScn->shdr.sh_offset + SCNFILESIZE(&lastScn->shdr); ELFU_INFO("Inserting %s at offset 0x%jx...\n", elfu_mScnName(mrel, ms), diff --git a/src/model/section-in-segment.c b/src/model/section-in-segment.c index ad7f037..0e513e2 100644 --- a/src/model/section-in-segment.c +++ b/src/model/section-in-segment.c @@ -44,7 +44,7 @@ ElfuScn* elfu_mScnLastInSegment(ElfuElf *me, ElfuPhdr *mp) CIRCLEQ_FOREACH(ms, &me->scnList, elem) { /* Get section size on disk - for NOBITS sections that is 0 bytes. */ - size_t size = elfu_gScnSizeFile(&ms->shdr); + size_t size = SCNFILESIZE(&ms->shdr); if (((ms->shdr.sh_offset + size >= mp->phdr.p_offset) && (ms->shdr.sh_offset + size <= mp->phdr.p_offset + mp->phdr.p_filesz))) { |