123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545(*Generated by Lem from elf_symbol_table.lem.*)(** [elf_symbol_table] provides types, functions and other definitions for
* working with ELF symbol tables.
*)openLem_basic_classesopenLem_boolopenLem_listopenLem_maybeopenLem_numopenLem_stringopenLem_tuple(*import Set*)openByte_sequenceopenErroropenMissing_pervasivesopenShowopenElf_headeropenElf_types_native_uintopenEndiannessopenString_table(** Undefined symbol index *)letstn_undef:Nat_big_num.num=((Nat_big_num.of_int0))(** Symbol binding *)(** Local symbols are not visible outside of the object file containing their
* definition.
*)letstb_local:Nat_big_num.num=((Nat_big_num.of_int0))(** Global symbols are visible to all object files being combined.
*)letstb_global:Nat_big_num.num=((Nat_big_num.of_int1))(** Weak symbols resemble global symbols but their definitions have lower
* precedence.
*)letstb_weak:Nat_big_num.num=((Nat_big_num.of_int2))(** Values in the following range have reserved OS specific semantics.
*)letstb_loos:Nat_big_num.num=((Nat_big_num.of_int10))letstb_hios:Nat_big_num.num=((Nat_big_num.of_int12))(** Values in the following range have reserved processor specific semantics.
*)letstb_loproc:Nat_big_num.num=((Nat_big_num.of_int13))letstb_hiproc:Nat_big_num.num=((Nat_big_num.of_int15))(** string_of_symbol_binding b os proc] produces a string representation of
* binding [m] using printing functions [os] and [proc] for OS- and processor-
* specific values respectively.
* OCaml specific definition.
*)(*val string_of_symbol_binding : natural -> (natural -> string) -> (natural -> string) -> string*)letstring_of_symbol_bindingmosproc:string=(ifNat_big_num.equalmstb_localthen"LOCAL"elseifNat_big_num.equalmstb_globalthen"GLOBAL"elseifNat_big_num.equalmstb_weakthen"WEAK"elseifNat_big_num.greater_equalmstb_loos&&Nat_big_num.less_equalmstb_hiosthenosmelseifNat_big_num.greater_equalmstb_loproc&&Nat_big_num.less_equalmstb_hiprocthenprocmelse"Invalid symbol binding")(** Symbol types *)(** The symbol's type is not specified.
*)letstt_notype:Nat_big_num.num=((Nat_big_num.of_int0))(** The symbol is associated with a data object such as a variable.
*)letstt_object:Nat_big_num.num=((Nat_big_num.of_int1))(** The symbol is associated with a function or other executable code.
*)letstt_func:Nat_big_num.num=((Nat_big_num.of_int2))(** The symbol is associated with a section.
*)letstt_section:Nat_big_num.num=((Nat_big_num.of_int3))(** Conventionally the symbol's value gives the name of the source file associated
* with the object file.
*)letstt_file:Nat_big_num.num=((Nat_big_num.of_int4))(** The symbol is an uninitialised common block.
*)letstt_common:Nat_big_num.num=((Nat_big_num.of_int5))(** The symbol specified a Thread Local Storage (TLS) entity.
*)letstt_tls:Nat_big_num.num=((Nat_big_num.of_int6))(** Values in the following range are reserved solely for OS-specific semantics.
*)letstt_loos:Nat_big_num.num=((Nat_big_num.of_int10))letstt_hios:Nat_big_num.num=((Nat_big_num.of_int12))(** Values in the following range are reserved solely for processor-specific
* semantics.
*)letstt_loproc:Nat_big_num.num=((Nat_big_num.of_int13))letstt_hiproc:Nat_big_num.num=((Nat_big_num.of_int15))(** [string_of_symbol_type sym os proc] produces a string representation of
* symbol type [m] using [os] and [proc] to pretty-print values reserved for
* OS- and processor-specific functionality.
*)(*val string_of_symbol_type : natural -> (natural -> string) -> (natural -> string) -> string*)letstring_of_symbol_typemosproc:string=(ifNat_big_num.equalmstt_notypethen"NOTYPE"elseifNat_big_num.equalmstt_objectthen"OBJECT"elseifNat_big_num.equalmstt_functhen"FUNC"elseifNat_big_num.equalmstt_sectionthen"SECTION"elseifNat_big_num.equalmstt_filethen"FILE"elseifNat_big_num.equalmstt_commonthen"COMMON"elseifNat_big_num.equalmstt_tlsthen"TLS"elseifNat_big_num.greater_equalmstt_loos&&Nat_big_num.less_equalmstt_hiosthenosmelseifNat_big_num.greater_equalmstt_loproc&&Nat_big_num.less_equalmstt_hiprocthenprocmelse"Invalid symbol type")(** Symbol visibility *)(** The visibility of the symbol is as specified by the symbol's binding type.
*)letstv_default:Nat_big_num.num=((Nat_big_num.of_int0))(** The meaning of this visibility may be defined by processor supplements to
* further constrain hidden symbols.
*)letstv_internal:Nat_big_num.num=((Nat_big_num.of_int1))(** The symbol's name is not visible in other components.
*)letstv_hidden:Nat_big_num.num=((Nat_big_num.of_int2))(** The symbol is visible in other components but not pre-emptable. That is,
* references to the symbol in the same component resolve to this symbol even
* if other symbols of the same name in other components would normally be
* resolved to instead if we followed the normal rules of symbol resolution.
*)letstv_protected:Nat_big_num.num=((Nat_big_num.of_int3))(** [string_of_symbol_visibility m] produces a string representation of symbol
* visibility [m].
*)(*val string_of_symbol_visibility : natural -> string*)letstring_of_symbol_visibilitym:string=(ifNat_big_num.equalmstv_defaultthen"DEFAULT"elseifNat_big_num.equalmstv_internalthen"INTERNAL"elseifNat_big_num.equalmstv_hiddenthen"HIDDEN"elseifNat_big_num.equalmstv_protectedthen"PROTECTED"else"Invalid symbol visibility")(** Symbol table entry type *)(** [elf32_symbol_table_entry] is an entry in a symbol table.
*)typeelf32_symbol_table_entry={elf32_st_name:Uint32_wrapper.uint32(** Index into the object file's string table *);elf32_st_value:Uint32_wrapper.uint32(** Gives the value of the associated symbol *);elf32_st_size:Uint32_wrapper.uint32(** Size of the associated symbol *);elf32_st_info:Uint32_wrapper.uint32(** Specifies the symbol's type and binding attributes *);elf32_st_other:Uint32_wrapper.uint32(** Currently specifies the symbol's visibility *);elf32_st_shndx:Uint32_wrapper.uint32(** Section header index symbol is defined with respect to *)}(** [elf32_symbol_table_entry_compare ent1 ent2] is an ordering-comparison function
* for symbol table entries suitable for constructing sets, finite maps and other
* ordered data structures from.
*)(*val elf32_symbol_table_entry_compare : elf32_symbol_table_entry ->
elf32_symbol_table_entry -> ordering*)letelf32_symbol_table_entry_compareent1ent2:int=(sextupleCompareNat_big_num.compareNat_big_num.compareNat_big_num.compareNat_big_num.compareNat_big_num.compareNat_big_num.compare(Uint32_wrapper.to_bigintent1.elf32_st_name,Uint32_wrapper.to_bigintent1.elf32_st_value,Uint32_wrapper.to_bigintent1.elf32_st_size,Uint32_wrapper.to_bigintent1.elf32_st_info,Uint32_wrapper.to_bigintent1.elf32_st_other,Uint32_wrapper.to_bigintent1.elf32_st_shndx)(Uint32_wrapper.to_bigintent2.elf32_st_name,Uint32_wrapper.to_bigintent2.elf32_st_value,Uint32_wrapper.to_bigintent2.elf32_st_size,Uint32_wrapper.to_bigintent2.elf32_st_info,Uint32_wrapper.to_bigintent2.elf32_st_other,Uint32_wrapper.to_bigintent2.elf32_st_shndx))letinstance_Basic_classes_Ord_Elf_symbol_table_elf32_symbol_table_entry_dict:(elf32_symbol_table_entry)ord_class=({compare_method=elf32_symbol_table_entry_compare;isLess_method=(funf1->(funf2->(Lem.orderingEqual(elf32_symbol_table_entry_comparef1f2)(-1))));isLessEqual_method=(funf1->(funf2->Pset.mem(elf32_symbol_table_entry_comparef1f2)(Pset.from_listcompare[(-1);0])));isGreater_method=(funf1->(funf2->(Lem.orderingEqual(elf32_symbol_table_entry_comparef1f2)1)));isGreaterEqual_method=(funf1->(funf2->Pset.mem(elf32_symbol_table_entry_comparef1f2)(Pset.from_listcompare[1;0])))})(** [elf64_symbol_table_entry] is an entry in a symbol table.
*)typeelf64_symbol_table_entry={elf64_st_name:Uint32_wrapper.uint32(** Index into the object file's string table *);elf64_st_info:Uint32_wrapper.uint32(** Specifies the symbol's type and binding attributes *);elf64_st_other:Uint32_wrapper.uint32(** Currently specifies the symbol's visibility *);elf64_st_shndx:Uint32_wrapper.uint32(** Section header index symbol is defined with respect to *);elf64_st_value:Uint64_wrapper.uint64(** Gives the value of the associated symbol *);elf64_st_size:Uint64_wrapper.uint64(** Size of the associated symbol *)}(** [elf64_symbol_table_entry_compare ent1 ent2] is an ordering-comparison function
* for symbol table entries suitable for constructing sets, finite maps and other
* ordered data structures from.
*)(*val elf64_symbol_table_entry_compare : elf64_symbol_table_entry -> elf64_symbol_table_entry ->
ordering*)letelf64_symbol_table_entry_compareent1ent2:int=(sextupleCompareNat_big_num.compareNat_big_num.compareNat_big_num.compareNat_big_num.compareNat_big_num.compareNat_big_num.compare(Uint32_wrapper.to_bigintent1.elf64_st_name,Ml_bindings.nat_big_num_of_uint64ent1.elf64_st_value,Ml_bindings.nat_big_num_of_uint64ent1.elf64_st_size,Uint32_wrapper.to_bigintent1.elf64_st_info,Uint32_wrapper.to_bigintent1.elf64_st_other,Uint32_wrapper.to_bigintent1.elf64_st_shndx)(Uint32_wrapper.to_bigintent2.elf64_st_name,Ml_bindings.nat_big_num_of_uint64ent2.elf64_st_value,Ml_bindings.nat_big_num_of_uint64ent2.elf64_st_size,Uint32_wrapper.to_bigintent2.elf64_st_info,Uint32_wrapper.to_bigintent2.elf64_st_other,Uint32_wrapper.to_bigintent2.elf64_st_shndx))letinstance_Basic_classes_Ord_Elf_symbol_table_elf64_symbol_table_entry_dict:(elf64_symbol_table_entry)ord_class=({compare_method=elf64_symbol_table_entry_compare;isLess_method=(funf1->(funf2->(Lem.orderingEqual(elf64_symbol_table_entry_comparef1f2)(-1))));isLessEqual_method=(funf1->(funf2->Pset.mem(elf64_symbol_table_entry_comparef1f2)(Pset.from_listcompare[(-1);0])));isGreater_method=(funf1->(funf2->(Lem.orderingEqual(elf64_symbol_table_entry_comparef1f2)1)));isGreaterEqual_method=(funf1->(funf2->Pset.mem(elf64_symbol_table_entry_comparef1f2)(Pset.from_listcompare[1;0])))})typeelf32_symbol_table=elf32_symbol_table_entrylisttypeelf64_symbol_table=elf64_symbol_table_entrylist(** Extraction of symbol table data *)(* Functions below common to 32- and 64-bit! *)(** [extract_symbol_binding u] extracts a symbol table entry's symbol binding. [u]
* in this case is the [elfXX_st_info] field from a symbol table entry.
*)(*val extract_symbol_binding : unsigned_char -> natural*)letextract_symbol_bindingentry:Nat_big_num.num=(Uint32_wrapper.to_bigint(Uint32_wrapper.shift_rightentry4))(** [extract_symbol_type u] extracts a symbol table entry's symbol type. [u]
* in this case is the [elfXX_st_info] field from a symbol table entry.
*)(*val extract_symbol_type : unsigned_char -> natural*)letextract_symbol_typeentry:Nat_big_num.num=(Uint32_wrapper.to_bigint(Uint32_wrapper.logandentry(Uint32_wrapper.of_bigint((Nat_big_num.of_int15)))))(* 0xf *)(** [get_symbol_info u] extracts a symbol table entry's symbol info. [u]
* in this case is the [elfXX_st_info] field from a symbol table entry.
*)(*val make_symbol_info : natural -> natural -> unsigned_char*)letmake_symbol_infobinding1symtype:Uint32_wrapper.uint32=(Uint32_wrapper.add(Uint32_wrapper.shift_left(Uint32_wrapper.of_bigintbinding1)4)(Uint32_wrapper.logand(Uint32_wrapper.of_bigintsymtype)(Uint32_wrapper.of_bigint((Nat_big_num.of_int15)))))(*0xf*)(** [get_symbol_visibility u] extracts a symbol table entry's symbol visibility. [u]
* in this case is the [elfXX_st_other] field from a symbol table entry.
*)(*val get_symbol_visibility : unsigned_char -> natural*)letget_symbol_visibilityinfo:Nat_big_num.num=(Uint32_wrapper.to_bigint(Uint32_wrapper.logandinfo(Uint32_wrapper.of_bigint((Nat_big_num.of_int3)))))(* 0x3*)(** [make_symbol_other m] converts a natural [m] to an unsigned char suitable
* for use in a symbol table entry's "other" field.
* XXX: WHY?
*)(*val make_symbol_other : natural -> unsigned_char*)letmake_symbol_othervisibility:Uint32_wrapper.uint32=(Uint32_wrapper.of_bigintvisibility)(** [is_elf32_shndx_too_large ent] tests whether the symbol table entry's
* [shndx] field is equal to SHN_XINDEX, in which case the real value is stored
* elsewhere.
*)(*val is_elf32_shndx_too_large : elf32_symbol_table_entry -> bool*)letis_elf32_shndx_too_largesyment:bool=(Nat_big_num.equal(Uint32_wrapper.to_bigintsyment.elf32_st_shndx)shn_xindex)(** [is_elf64_shndx_too_large ent] tests whether the symbol table entry's
* [shndx] field is equal to SHN_XINDEX, in which case the real value is stored
* elsewhere.
*)(*val is_elf64_shndx_too_large : elf64_symbol_table_entry -> bool*)letis_elf64_shndx_too_largesyment:bool=(Nat_big_num.equal(Uint32_wrapper.to_bigintsyment.elf64_st_shndx)shn_xindex)(** NULL tests *)(** [is_elf32_null_entry ent] tests whether [ent] is a null symbol table entry,
* i.e. all fields set to [0].
*)(*val is_elf32_null_entry : elf32_symbol_table_entry -> bool*)letis_elf32_null_entryent:bool=(Nat_big_num.equal(Uint32_wrapper.to_bigintent.elf32_st_name)((Nat_big_num.of_int0))&&((Nat_big_num.equal(Uint32_wrapper.to_bigintent.elf32_st_value)((Nat_big_num.of_int0)))&&((Nat_big_num.equal(Uint32_wrapper.to_bigintent.elf32_st_size)((Nat_big_num.of_int0)))&&((Nat_big_num.equal(Uint32_wrapper.to_bigintent.elf32_st_info)((Nat_big_num.of_int0)))&&((Nat_big_num.equal(Uint32_wrapper.to_bigintent.elf32_st_other)((Nat_big_num.of_int0)))&&(Nat_big_num.equal(Uint32_wrapper.to_bigintent.elf32_st_shndx)((Nat_big_num.of_int0))))))))(** [is_elf64_null_entry ent] tests whether [ent] is a null symbol table entry,
* i.e. all fields set to [0].
*)(*val is_elf64_null_entry : elf64_symbol_table_entry -> bool*)letis_elf64_null_entryent:bool=(Nat_big_num.equal(Uint32_wrapper.to_bigintent.elf64_st_name)((Nat_big_num.of_int0))&&((Nat_big_num.equal(Ml_bindings.nat_big_num_of_uint64ent.elf64_st_value)((Nat_big_num.of_int0)))&&((Nat_big_num.equal(Ml_bindings.nat_big_num_of_uint64ent.elf64_st_size)((Nat_big_num.of_int0)))&&((Nat_big_num.equal(Uint32_wrapper.to_bigintent.elf64_st_info)((Nat_big_num.of_int0)))&&((Nat_big_num.equal(Uint32_wrapper.to_bigintent.elf64_st_other)((Nat_big_num.of_int0)))&&(Nat_big_num.equal(Uint32_wrapper.to_bigintent.elf64_st_shndx)((Nat_big_num.of_int0))))))))(** Printing symbol table entries *)typesymtab_print_bundle=(Nat_big_num.num->string)*(Nat_big_num.num->string)(** [string_of_elf32_symbol_table_entry ent] produces a string based representation
* of symbol table entry [ent].
*)(*val string_of_elf32_symbol_table_entry : elf32_symbol_table_entry -> string*)letstring_of_elf32_symbol_table_entryentry:string=(unlines[("\t"^("Name: "^Uint32_wrapper.to_stringentry.elf32_st_name));("\t"^("Value: "^Uint32_wrapper.to_stringentry.elf32_st_value));("\t"^("Size: "^Uint32_wrapper.to_stringentry.elf32_st_size));("\t"^("Info: "^Uint32_wrapper.to_stringentry.elf32_st_info));("\t"^("Other: "^Uint32_wrapper.to_stringentry.elf32_st_other));("\t"^("Shndx: "^Uint32_wrapper.to_stringentry.elf32_st_shndx))])(** [string_of_elf64_symbol_table_entry ent] produces a string based representation
* of symbol table entry [ent].
*)(*val string_of_elf64_symbol_table_entry : elf64_symbol_table_entry -> string*)letstring_of_elf64_symbol_table_entryentry:string=(unlines[("\t"^("Name: "^Uint32_wrapper.to_stringentry.elf64_st_name));("\t"^("Info: "^Uint32_wrapper.to_stringentry.elf64_st_info));("\t"^("Other: "^Uint32_wrapper.to_stringentry.elf64_st_other));("\t"^("Shndx: "^Uint32_wrapper.to_stringentry.elf64_st_shndx));("\t"^("Value: "^Uint64_wrapper.to_stringentry.elf64_st_value));("\t"^("Size: "^Uint64_wrapper.to_stringentry.elf64_st_size))])(** [string_of_elf32_symbol_table stbl] produces a string based representation
* of symbol table [stbl].
*)(*val string_of_elf32_symbol_table : elf32_symbol_table -> string*)letstring_of_elf32_symbol_tablesymtab:string=(unlines(Lem_list.mapstring_of_elf32_symbol_table_entrysymtab))(** [elf64_null_symbol_table_entry] is the null symbol table entry, with all
* fields set to zero.
*)(*val elf64_null_symbol_table_entry : elf64_symbol_table_entry*)letelf64_null_symbol_table_entry:elf64_symbol_table_entry=({elf64_st_name=(Uint32_wrapper.of_bigint((Nat_big_num.of_int0)));elf64_st_info=(Uint32_wrapper.of_bigint((Nat_big_num.of_int0)));elf64_st_other=(Uint32_wrapper.of_bigint((Nat_big_num.of_int0)));elf64_st_shndx=(Uint32_wrapper.of_bigint((Nat_big_num.of_int0)));elf64_st_value=(Uint64_wrapper.of_bigint((Nat_big_num.of_int0)));elf64_st_size=(Uint64_wrapper.of_bigint((Nat_big_num.of_int0)))})(*val string_of_elf64_symbol_table : elf64_symbol_table -> string*)letstring_of_elf64_symbol_tablesymtab:string=(unlines(Lem_list.mapstring_of_elf64_symbol_table_entrysymtab))letinstance_Show_Show_Elf_symbol_table_elf32_symbol_table_entry_dict:(elf32_symbol_table_entry)show_class=({show_method=string_of_elf32_symbol_table_entry})letinstance_Show_Show_Elf_symbol_table_elf64_symbol_table_entry_dict:(elf64_symbol_table_entry)show_class=({show_method=string_of_elf64_symbol_table_entry})(** Reading in symbol table (entries) *)(** [read_elf32_symbol_table_entry endian bs0] reads an ELF symbol table entry
* record from byte sequence [bs0] assuming endianness [endian], returning the
* remainder of the byte sequence. Fails if the byte sequence is not long enough.
*)(*val read_elf32_symbol_table_entry : endianness -> byte_sequence ->
error (elf32_symbol_table_entry * byte_sequence)*)letread_elf32_symbol_table_entryendianbs0:(elf32_symbol_table_entry*Byte_sequence_wrapper.byte_sequence)error=(bind(read_elf32_wordendianbs0)(fun(st_name,bs0)->bind(read_elf32_addrendianbs0)(fun(st_value,bs0)->bind(read_elf32_wordendianbs0)(fun(st_size,bs0)->bind(read_unsigned_charendianbs0)(fun(st_info,bs0)->bind(read_unsigned_charendianbs0)(fun(st_other,bs0)->bind(read_elf32_halfendianbs0)(fun(st_shndx,bs0)->return({elf32_st_name=st_name;elf32_st_value=st_value;elf32_st_size=st_size;elf32_st_info=st_info;elf32_st_other=st_other;elf32_st_shndx=st_shndx},bs0))))))))(*val bytes_of_elf32_symbol_table_entry : endianness ->
elf32_symbol_table_entry -> byte_sequence*)letbytes_of_elf32_symbol_table_entryendianentry:Byte_sequence_wrapper.byte_sequence=(Byte_sequence.from_byte_lists[bytes_of_elf32_wordendianentry.elf32_st_name;bytes_of_elf32_addrendianentry.elf32_st_value;bytes_of_elf32_wordendianentry.elf32_st_size;bytes_of_unsigned_charentry.elf32_st_info;bytes_of_unsigned_charentry.elf32_st_other;bytes_of_elf32_halfendianentry.elf32_st_shndx])(** [read_elf64_symbol_table_entry endian bs0] reads an ELF symbol table entry
* record from byte sequence [bs0] assuming endianness [endian], returning the
* remainder of the byte sequence. Fails if the byte sequence is not long enough.
*)(*val read_elf64_symbol_table_entry : endianness -> byte_sequence ->
error (elf64_symbol_table_entry * byte_sequence)*)letread_elf64_symbol_table_entryendianbs0:(elf64_symbol_table_entry*Byte_sequence_wrapper.byte_sequence)error=(bind(read_elf64_wordendianbs0)(fun(st_name,bs0)->bind(read_unsigned_charendianbs0)(fun(st_info,bs0)->bind(read_unsigned_charendianbs0)(fun(st_other,bs0)->bind(read_elf64_halfendianbs0)(fun(st_shndx,bs0)->bind(read_elf64_addrendianbs0)(fun(st_value,bs0)->bind(read_elf64_xwordendianbs0)(fun(st_size,bs0)->return({elf64_st_name=st_name;elf64_st_info=st_info;elf64_st_other=st_other;elf64_st_shndx=st_shndx;elf64_st_value=st_value;elf64_st_size=st_size},bs0))))))))(*val bytes_of_elf64_symbol_table_entry : endianness ->
elf64_symbol_table_entry -> byte_sequence*)letbytes_of_elf64_symbol_table_entryendianentry:Byte_sequence_wrapper.byte_sequence=(Byte_sequence.from_byte_lists[bytes_of_elf64_wordendianentry.elf64_st_name;bytes_of_unsigned_charentry.elf64_st_info;bytes_of_unsigned_charentry.elf64_st_other;bytes_of_elf64_halfendianentry.elf64_st_shndx;bytes_of_elf64_addrendianentry.elf64_st_value;bytes_of_elf64_xwordendianentry.elf64_st_size])(** [read_elf32_symbol_table endian bs0] reads a symbol table from byte sequence
* [bs0] assuming endianness [endian]. Assumes [bs0]'s length modulo the size
* of a symbol table entry is 0. Fails otherwise.
*)(*val read_elf32_symbol_table : endianness -> byte_sequence -> error elf32_symbol_table*)letrecread_elf32_symbol_tableendianbs0:((elf32_symbol_table_entry)list)error=(ifNat_big_num.equal(Byte_sequence.length0bs0)((Nat_big_num.of_int0))thenreturn[]elsebind(read_elf32_symbol_table_entryendianbs0)(fun(head,bs0)->bind(read_elf32_symbol_tableendianbs0)(funtail->return(head::tail))))(** [read_elf64_symbol_table endian bs0] reads a symbol table from byte sequence
* [bs0] assuming endianness [endian]. Assumes [bs0]'s length modulo the size
* of a symbol table entry is 0. Fails otherwise.
*)(*val read_elf64_symbol_table : endianness -> byte_sequence -> error elf64_symbol_table*)letrecread_elf64_symbol_tableendianbs0:((elf64_symbol_table_entry)list)error=(ifNat_big_num.equal(Byte_sequence.length0bs0)((Nat_big_num.of_int0))thenreturn[]elsebind(read_elf64_symbol_table_entryendianbs0)(fun(head,bs0)->bind(read_elf64_symbol_tableendianbs0)(funtail->return(head::tail))))(** Association map of symbol name, symbol type, symbol size, symbol address
* and symbol binding.
* A PPCMemism.
*)typesymbol_address_map=(string*(Nat_big_num.num*Nat_big_num.num*Nat_big_num.num*Nat_big_num.num))list(** [get_elf32_symbol_image_address symtab stbl] extracts the symbol address map
* from the symbol table [symtab] using the string table [stbl].
* A PPCMemism.
*)(*val get_elf32_symbol_image_address : elf32_symbol_table -> string_table ->
error symbol_address_map*)letget_elf32_symbol_image_addresssymtabstrtab:((string*(Nat_big_num.num*Nat_big_num.num*Nat_big_num.num*Nat_big_num.num))list)error=(mapM(funentry->letname1=(Uint32_wrapper.to_bigintentry.elf32_st_name)inletaddr=(Uint32_wrapper.to_bigintentry.elf32_st_value)inletsize2=(Nat_big_num.mul(Uint32_wrapper.to_bigintentry.elf32_st_size)((Nat_big_num.of_int8)))inlettyp=(extract_symbol_typeentry.elf32_st_info)inletbnd=(extract_symbol_bindingentry.elf32_st_info)inbind(String_table.get_string_atname1strtab)(funstr->return(str,(typ,size2,addr,bnd))))symtab)(** [get_elf64_symbol_image_address symtab stbl] extracts the symbol address map
* from the symbol table [symtab] using the string table [stbl].
* A PPCMemism.
*)(*val get_elf64_symbol_image_address : elf64_symbol_table -> string_table ->
error symbol_address_map*)letget_elf64_symbol_image_addresssymtabstrtab:((string*(Nat_big_num.num*Nat_big_num.num*Nat_big_num.num*Nat_big_num.num))list)error=(mapM(funentry->letname1=(Uint32_wrapper.to_bigintentry.elf64_st_name)inletaddr=(Ml_bindings.nat_big_num_of_uint64entry.elf64_st_value)inletsize2=(Ml_bindings.nat_big_num_of_uint64entry.elf64_st_size)inlettyp=(extract_symbol_typeentry.elf64_st_info)inletbnd=(extract_symbol_bindingentry.elf64_st_info)inbind(String_table.get_string_atname1strtab)(funstr->return(str,(typ,size2,addr,bnd))))symtab)(** [get_el32_symbol_type ent] extracts the symbol type from symbol table entry
* [ent].
*)(*val get_elf32_symbol_type : elf32_symbol_table_entry -> natural*)letget_elf32_symbol_typesyment:Nat_big_num.num=(extract_symbol_typesyment.elf32_st_info)(** [get_el64_symbol_type ent] extracts the symbol type from symbol table entry
* [ent].
*)(*val get_elf64_symbol_type : elf64_symbol_table_entry -> natural*)letget_elf64_symbol_typesyment:Nat_big_num.num=(extract_symbol_typesyment.elf64_st_info)(** [get_el32_symbol_binding ent] extracts the symbol binding from symbol table entry
* [ent].
*)(*val get_elf32_symbol_binding : elf32_symbol_table_entry -> natural*)letget_elf32_symbol_bindingsyment:Nat_big_num.num=(extract_symbol_bindingsyment.elf32_st_info)(** [get_el64_symbol_binding ent] extracts the symbol binding from symbol table entry
* [ent].
*)(*val get_elf64_symbol_binding : elf64_symbol_table_entry -> natural*)letget_elf64_symbol_bindingsyment:Nat_big_num.num=(extract_symbol_bindingsyment.elf64_st_info)