summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2017-01-22 17:58:46 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2017-01-22 17:58:46 (GMT)
commit56b84c3624c59c8a1796bf411b7ba950d12ddfc5 (patch)
tree1041e66043c7336da72a695730b5a32bc43bfa9b
parentad3bf849178921ead3bbbd3ba84f4b9405f69253 (diff)
Kept the nominal order between ELF program and section headers if possible.
-rw-r--r--ChangeLog5
-rw-r--r--src/glibext/gbinportion.c23
2 files changed, 24 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 0c3d3b7..0249b88 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
17-01-22 Cyrille Bagard <nocbos@gmail.com>
+ * src/glibext/gbinportion.c:
+ Keep the nominal order between ELF program and section headers if possible.
+
+17-01-22 Cyrille Bagard <nocbos@gmail.com>
+
* src/analysis/disass/area.c:
Update virtual addresses when filling the gap between two binary areas.
diff --git a/src/glibext/gbinportion.c b/src/glibext/gbinportion.c
index a28f1a7..542936a 100644
--- a/src/glibext/gbinportion.c
+++ b/src/glibext/gbinportion.c
@@ -693,15 +693,30 @@ void g_binary_portion_include(GBinPortion *portion, GBinPortion *sub)
/**
* On prend ici en compte le genre de situations suivantes :
*
- * [21] .bss NOBITS 00088240 07823c 0018c8 00 WA 0 0 8
- * [22] __libc_freeres_ptrs NOBITS 00089b08 07823c 000018 00 WA 0 0 4
- * [23] .comment PROGBITS 00000000 07823c 000022 01 MS 0 0 1
+ * [21] .bss NOBITS 00088240 07823c 0018c8 00 WA 0 0 8
+ * [22] __libc_freeres_ptrs NOBITS 00089b08 07823c 000018 00 WA 0 0 4
+ * [23] .comment PROGBITS 00000000 07823c 000022 01 MS 0 0 1
*
* Pendant le désassemblage, la procédure n'aime pas trop les intersections
* de zones mémoire.
+ *
+ * Par contre, on évite quand même les cas de figure où les portions sont identiques :
+ *
+ * En-têtes de section:
+ * [Nr] Nom Type Adr Décala.Taille ES Fan LN Inf Al
+ * ...
+ * [ 2] .data PROGBITS 00010098 000098 00000c 00 WA 0 0 1
+ *
+ * En-têtes de programme:
+ * Type Décalage Adr. vir. Adr.phys. T.Fich. T.Mém. Fan Alignement
+ * ...
+ * LOAD 0x000098 0x00010098 0x00010098 0x0000c 0x0000c RW 0x8000
+ *
+ * Ici l'ordre original doit être conservé !
*/
- if (mrange_includes_mrange(&sub->range, &portion->subs[best]->range) == 0)
+ if (mrange_includes_mrange(&sub->range, &portion->subs[best]->range) == 0
+ && cmp_mrange(&sub->range, &portion->subs[best]->range) != 0)
{
tmp = portion->subs[best];