Skip to content

Commit b95b52c

Browse files
committed
CHB:ELF: update for change in global variables
1 parent 0849ccc commit b95b52c

File tree

2 files changed

+19
-4
lines changed

2 files changed

+19
-4
lines changed

CodeHawk/CHB/bchlibelf/bCHELFSymbolTable.ml

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,8 @@ object (self)
135135

136136
method get_st_type = st_info land 15
137137

138+
method get_st_size = st_size
139+
138140
method get_st_value = st_value
139141

140142
method get_value = st_value
@@ -145,6 +147,11 @@ object (self)
145147

146148
method has_address_value = not (st_value#equal wordzero)
147149

150+
method has_size = not (st_size#equal wordzero)
151+
152+
method get_size: int option =
153+
if self#has_size then Some st_size#to_int else None
154+
148155
method write_xml (node:xml_element_int) =
149156
let set = node#setAttribute in
150157
let seti = node#setIntAttribute in
@@ -243,10 +250,15 @@ object
243250
method set_data_object_names =
244251
H.iter (fun _ e ->
245252
if e#is_data_object && e#has_address_value && e#has_name then
246-
BCHGlobalMemoryMap.global_memory_map#add_location
247-
~name:(Some e#get_name)
248-
~desc:(Some "symbol-table")
249-
e#get_st_value
253+
match (BCHGlobalMemoryMap.global_memory_map#add_location
254+
~name:(Some e#get_name)
255+
~desc:(Some "symbol-table")
256+
~size:e#get_size
257+
e#get_st_value) with
258+
| Error e ->
259+
ch_error_log#add
260+
"ELF: set_data_object_names" (STR (String.concat "; " e))
261+
| _ -> ()
250262
else
251263
()
252264
) entries

CodeHawk/CHB/bchlibelf/bCHELFTypes.mli

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,9 +255,12 @@ class type elf_symbol_table_entry_int =
255255
method get_st_type: int
256256
method get_st_name: doubleword_int
257257
method get_st_value: doubleword_int
258+
method get_st_size: doubleword_int
258259
method get_value: doubleword_int
260+
method get_size: int option
259261
method has_address_value: bool
260262
method has_name: bool
263+
method has_size: bool
261264
method is_function: bool
262265
method is_data_object: bool
263266
method to_rep_record: string list * int list

0 commit comments

Comments
 (0)