projects
/
centaur.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
e28b7c5
)
reladd: Work more with sh_addr instead of sh_offset
author
norly
<ny-git@enpas.org>
Sat, 22 Jun 2013 00:03:28 +0000
(
01:03
+0100)
committer
norly
<ny-git@enpas.org>
Sat, 22 Jun 2013 00:03:28 +0000
(
01:03
+0100)
src/libelfu/modelops/reladd.c
patch
|
blob
|
history
diff --git
a/src/libelfu/modelops/reladd.c
b/src/libelfu/modelops/reladd.c
index 82b562b557079d0ce03610d49bebb5853497f120..55438db523eb237552c7f70f41f6cba31eecb444 100644
(file)
--- a/
src/libelfu/modelops/reladd.c
+++ b/
src/libelfu/modelops/reladd.c
@@
-66,7
+66,13
@@
static ElfuScn* insertSection(ElfuElf *me, ElfuElf *mrel, ElfuScn *oldscn)
GElf_Off injOffset;
ElfuPhdr *injPhdr;
GElf_Off injOffset;
ElfuPhdr *injPhdr;
- if (oldscn->shdr.sh_flags & SHF_ALLOC) {
+ if (!(oldscn->shdr.sh_flags & SHF_ALLOC)) {
+ ELFU_WARN("insertSection: Skipping non-memory section %s (type %d flags %u).\n",
+ elfu_mScnName(mrel, oldscn),
+ oldscn->shdr.sh_type,
+ (unsigned)oldscn->shdr.sh_flags);
+ goto ERROR;
+ } else {
newscn = cloneScn(oldscn);
if (!newscn) {
return NULL;
newscn = cloneScn(oldscn);
if (!newscn) {
return NULL;
@@
-105,13
+111,14
@@
static ElfuScn* insertSection(ElfuElf *me, ElfuElf *mrel, ElfuScn *oldscn)
newscn->shdr.sh_addr = injAddr;
newscn->shdr.sh_offset = injOffset;
newscn->shdr.sh_addr = injAddr;
newscn->shdr.sh_offset = injOffset;
+ /* Insert section in child list, ordered by memory address */
if (CIRCLEQ_EMPTY(&injPhdr->childScnList)
if (CIRCLEQ_EMPTY(&injPhdr->childScnList)
- || CIRCLEQ_LAST(&injPhdr->childScnList)->shdr.sh_
offset < injOffset
) {
+ || CIRCLEQ_LAST(&injPhdr->childScnList)->shdr.sh_
addr < injAddr
) {
CIRCLEQ_INSERT_TAIL(&injPhdr->childScnList, newscn, elemChildScn);
} else {
ElfuScn *ms;
CIRCLEQ_FOREACH(ms, &injPhdr->childScnList, elemChildScn) {
CIRCLEQ_INSERT_TAIL(&injPhdr->childScnList, newscn, elemChildScn);
} else {
ElfuScn *ms;
CIRCLEQ_FOREACH(ms, &injPhdr->childScnList, elemChildScn) {
- if (inj
Offset < ms->shdr.sh_offset
) {
+ if (inj
Addr < ms->shdr.sh_addr
) {
CIRCLEQ_INSERT_BEFORE(&injPhdr->childScnList, ms, newscn, elemChildScn);
break;
}
CIRCLEQ_INSERT_BEFORE(&injPhdr->childScnList, ms, newscn, elemChildScn);
break;
}
@@
-148,12
+155,6
@@
static ElfuScn* insertSection(ElfuElf *me, ElfuElf *mrel, ElfuScn *oldscn)
}
return newscn;
}
return newscn;
- } else {
- ELFU_WARN("insertSection: Skipping non-memory section %s (type %d flags %u).\n",
- elfu_mScnName(mrel, oldscn),
- oldscn->shdr.sh_type,
- (unsigned)oldscn->shdr.sh_flags);
- goto ERROR;
}
ERROR:
}
ERROR: