11(* =============================================================================
2- CodeHawk Binary Analyzer
2+ CodeHawk Binary Analyzer
33 Author: A. Cody Schuffelen and Henny Sipma
44 ------------------------------------------------------------------------------
55 The MIT License (MIT)
6-
6+
77 Copyright (c) 2005-2020 Kestrel Technology LLC
88 Copyright (c) 2020 Henny Sipma
99 Copyright (c) 2021-2024 Aarno Labs LLC
1414 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1515 copies of the Software, and to permit persons to whom the Software is
1616 furnished to do so, subject to the following conditions:
17-
17+
1818 The above copyright notice and this permission notice shall be included in all
1919 copies or substantial portions of the Software.
20-
20+
2121 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
2222 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
2323 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
3131 References used:
3232
3333 The standard /usr/include/elf.h in Arch Linux
34- The latest draft of the System V Application Binary Interface:
34+ The latest draft of the System V Application Binary Interface:
3535 http://www.sco.com/developers/gabi/latest/contents.html
36- March 19, 1997 draft copy of the Intel Supplement to the System V
36+ March 19, 1997 draft copy of the Intel Supplement to the System V
3737 Application Binary Interface
38- ----------------------------------------------------------------------------- *)
38+ ----------------------------------------------------------------------------- *)
3939
4040(* chlib *)
4141open CHNumerical
@@ -51,47 +51,47 @@ open BCHLibTypes
5151open BCHDwarfTypes
5252
5353
54- type elf_section_header_type_t =
55- | SHT_NullSection
54+ type elf_section_header_type_t =
55+ | SHT_NullSection
5656 | SHT_ProgBits
57- | SHT_SymTab
58- | SHT_StrTab
59- | SHT_Rela
60- | SHT_Hash
61- | SHT_Dynamic
62- | SHT_Note
63- | SHT_NoBits
64- | SHT_Rel
65- | SHT_ShLib
66- | SHT_DynSym
67- | SHT_InitArray
57+ | SHT_SymTab
58+ | SHT_StrTab
59+ | SHT_Rela
60+ | SHT_Hash
61+ | SHT_Dynamic
62+ | SHT_Note
63+ | SHT_NoBits
64+ | SHT_Rel
65+ | SHT_ShLib
66+ | SHT_DynSym
67+ | SHT_InitArray
6868 | SHT_FiniArray
69- | SHT_PreinitArray
70- | SHT_Group
69+ | SHT_PreinitArray
70+ | SHT_Group
7171 | SHT_SymTabShndx
7272 | SHT_GNU_verdef
7373 | SHT_GNU_verneed
7474 | SHT_GNU_versym
7575 | SHT_MIPS_RegInfo
76- | SHT_OSSection of doubleword_int
77- | SHT_ProcSection of doubleword_int
78- | SHT_UserSection of doubleword_int
76+ | SHT_OSSection of doubleword_int
77+ | SHT_ProcSection of doubleword_int
78+ | SHT_UserSection of doubleword_int
7979 | SHT_UnknownType of doubleword_int
80-
80+
8181type elf_program_header_type_t =
82- | PT_Null
83- | PT_Load
84- | PT_Dynamic
85- | PT_Interpreter
86- | PT_Note
87- | PT_Reference
82+ | PT_Null
83+ | PT_Load
84+ | PT_Dynamic
85+ | PT_Interpreter
86+ | PT_Note
87+ | PT_Reference
8888 | PT_ThreadLocalStorage
8989 | PT_RegInfo
90- | PT_OSSpecific of doubleword_int
90+ | PT_OSSpecific of doubleword_int
9191 | PT_ProcSpecific of doubleword_int
9292
9393type elf_dynamic_tag_value_t = DTV_d_val | DTV_d_ptr | DTV_d_none
94-
94+
9595type elf_dynamic_tag_t =
9696 | DT_Null
9797 | DT_Needed
@@ -205,7 +205,7 @@ class type elf_dictionary_int =
205205 method read_xml : xml_element_int -> unit
206206 method toPretty : pretty_t
207207 end
208-
208+
209209class type elf_raw_section_int =
210210 object
211211 method get_size : int
@@ -248,7 +248,7 @@ class type elf_string_table_int =
248248class type elf_symbol_table_entry_int =
249249 object
250250 method id : int
251- method read : pushback_stream_int -> unit
251+ method read : pushback_stream_int -> unit
252252 method set_name : string -> unit
253253 method get_name : string
254254 method get_st_binding : int
@@ -761,6 +761,7 @@ object
761761
762762 (* predicates *)
763763 method is_executable : bool
764+ method is_readonly : bool
764765 method is_string_table : bool
765766 method is_symbol_table : bool
766767 method is_relocation_table : bool
@@ -816,6 +817,11 @@ object
816817 within a program section that is not an executable section. *)
817818 method is_data_address : doubleword_int -> bool
818819
820+ (* * [read_readonly_address va] returns [true] if virtual address [va] is an
821+ address within a program section that is not writeable (it may be
822+ executable). *)
823+ method is_readonly_address : doubleword_int -> bool
824+
819825 method is_uninitialized_data_address : doubleword_int -> bool
820826 method is_global_offset_table_address : doubleword_int -> bool
821827 method has_xsubstring : doubleword_int -> int -> bool
0 commit comments