Skip to content

Commit 27afb7f

Browse files
committed
CHB:ELF: fix section-header creation inconsistency
1 parent af31637 commit 27afb7f

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

CodeHawk/CHB/bchlibelf/bCHELFSectionHeaderCreator.ml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -752,6 +752,10 @@ object (self)
752752
* - addr: DT_FINI
753753
* - offset: DT_FINI - ph#get_vaddr
754754
* - size: ?
755+
*
756+
* If no other information is present the size of the .fini section is
757+
* assumed to be 0x4c (to be kept consistent with the starting address
758+
* of the .rodata section).
755759
*)
756760
method private create_fini_header =
757761
let sectionname = ".fini" in
@@ -766,7 +770,7 @@ object (self)
766770
if ud_has_size sectionname then
767771
ud_get_size sectionname
768772
else
769-
s2d "0x54" in
773+
s2d "0x4c" in
770774
let addralign = s2d "0x4" in
771775
begin
772776
sh#set_fields
@@ -777,9 +781,12 @@ object (self)
777781
pr_debug [STR "Assumption violation: DT_FINI not present"; NL; NL]
778782

779783
(* inputs: from program header, type PT_Load (1)
780-
* - addr: DT_FINI + 0x50
784+
* - addr: DT_FINI + 0x4c
781785
* - offset: addr - ph#get_vaddr
782-
* - size: PT_Load(end) - DT_FINI - 0x50
786+
* - size: PT_Load(end) - DT_FINI - 0x4c
787+
*
788+
* If no other information is present the size of the .fini section is
789+
* assumed to be 0x4c.
783790
*)
784791
method private create_rodata_header =
785792
let sectionname = ".rodata" in

0 commit comments

Comments
 (0)