diff --git a/tests/notebook.ipynb b/tests/notebook.ipynb deleted file mode 100644 index be432c2..0000000 --- a/tests/notebook.ipynb +++ /dev/null @@ -1,1087 +0,0 @@ -{ - "cells": [ - { - "cell_type": "code", - "execution_count": 13, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The autoreload extension is already loaded. To reload it, use:\n", - " %reload_ext autoreload\n" - ] - } - ], - "source": [ - "%load_ext autoreload\n", - "%autoreload 2" - ] - }, - { - "cell_type": "code", - "execution_count": 38, - "metadata": {}, - "outputs": [], - "source": [ - "import pelfy\n", - "import pandas as pd" - ] - }, - { - "cell_type": "code", - "execution_count": 41, - "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "\n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - "\n", - "\n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - "\n", - "\n", - "
indexsymbol nametypecalculation
0_gp_dispR_MIPS_HI16((A + S) >> 16) & 0xFFFF
1_gp_dispR_MIPS_LO16(A + S) & 0xFFFF
2result_floatR_MIPS_GOT16G + A
3result_floatR_MIPS_TLS_DTPREL32S + A - TLS_DTV_OFFSET
4_gp_dispR_MIPS_HI16((A + S) >> 16) & 0xFFFF
5_gp_dispR_MIPS_LO16(A + S) & 0xFFFF
6result_floatR_MIPS_GOT16G + A
7result_floatR_MIPS_TLS_DTPREL32S + A - TLS_DTV_OFFSET
8_gp_dispR_MIPS_HI16((A + S) >> 16) & 0xFFFF
9_gp_dispR_MIPS_LO16(A + S) & 0xFFFF
10read_float_retR_MIPS_GOT16G + A
11result_float_floatR_MIPS_GOT16G + A
12result_float_floatR_MIPS_TLS_DTPREL32S + A - TLS_DTV_OFFSET
\n" - ], - "text/plain": [ - " index symbol name type calculation \n", - "--------------------------------------------------------------------------\n", - " 0 _gp_disp R_MIPS_HI16 ((A + S) >> 16) & 0xFFFF \n", - " 1 _gp_disp R_MIPS_LO16 (A + S) & 0xFFFF \n", - " 2 result_float R_MIPS_GOT16 G + A \n", - " 3 result_float R_MIPS_TLS_DTPREL32 S + A - TLS_DTV_OFFSET \n", - " 4 _gp_disp R_MIPS_HI16 ((A + S) >> 16) & 0xFFFF \n", - " 5 _gp_disp R_MIPS_LO16 (A + S) & 0xFFFF \n", - " 6 result_float R_MIPS_GOT16 G + A \n", - " 7 result_float R_MIPS_TLS_DTPREL32 S + A - TLS_DTV_OFFSET \n", - " 8 _gp_disp R_MIPS_HI16 ((A + S) >> 16) & 0xFFFF \n", - " 9 _gp_disp R_MIPS_LO16 (A + S) & 0xFFFF \n", - " 10 read_float_ret R_MIPS_GOT16 G + A \n", - " 11 result_float_float R_MIPS_GOT16 G + A \n", - " 12 result_float_float R_MIPS_TLS_DTPREL32 S + A - TLS_DTV_OFFSET " - ] - }, - "metadata": {}, - "output_type": "display_data" - }, - { - "data": { - "text/html": [ - "\n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - "\n", - "\n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - "\n", - "\n", - "
indexnametypedescription
0SHT_NULLSection header table entry unused
1.textSHT_PROGBITSProgram data
2.rel.textSHT_RELRelocation entries, no addends
3.dataSHT_PROGBITSProgram data
4.bssSHT_NOBITSProgram space with no data (bss)
5.reginfo0x70000006Application-specific
6.MIPS.abiflags0x7000002aApplication-specific
7.pdrSHT_PROGBITSProgram data
8.rel.pdrSHT_RELRelocation entries, no addends
9.mdebug.abi32SHT_PROGBITSProgram data
10.commentSHT_PROGBITSProgram data
11.note.GNU-stackSHT_PROGBITSProgram data
12.gnu.attributes0x6ffffff5Processor-specific
13.symtabSHT_SYMTABSymbol table
14.strtabSHT_STRTABString table
15.shstrtabSHT_STRTABString table
\n" - ], - "text/plain": [ - " index name type description \n", - "-------------------------------------------------------------------------\n", - " 0 SHT_NULL Section header table entry unused \n", - " 1 .text SHT_PROGBITS Program data \n", - " 2 .rel.text SHT_REL Relocation entries, no addends \n", - " 3 .data SHT_PROGBITS Program data \n", - " 4 .bss SHT_NOBITS Program space with no data (bss) \n", - " 5 .reginfo 0x70000006 Application-specific \n", - " 6 .MIPS.abiflags 0x7000002a Application-specific \n", - " 7 .pdr SHT_PROGBITS Program data \n", - " 8 .rel.pdr SHT_REL Relocation entries, no addends \n", - " 9 .mdebug.abi32 SHT_PROGBITS Program data \n", - " 10 .comment SHT_PROGBITS Program data \n", - " 11 .note.GNU-stack SHT_PROGBITS Program data \n", - " 12 .gnu.attributes 0x6ffffff5 Processor-specific \n", - " 13 .symtab SHT_SYMTAB Symbol table \n", - " 14 .strtab SHT_STRTAB String table \n", - " 15 .shstrtab SHT_STRTAB String table " - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], - "source": [ - "elf = pelfy.open_elf_file('obj/test-mips-o3.o')\n", - "display(elf.code_relocations)\n", - "#display(elf.architecture)\n", - "#display(elf)\n", - "display(elf.sections)" - ] - }, - { - "cell_type": "code", - "execution_count": 47, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "16" - ] - }, - "execution_count": 47, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "len(elf.sections)" - ] - }, - { - "cell_type": "code", - "execution_count": 57, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "e_ident[EI_MAG] 2135247942 0x7F followed by ELF(45 4c 46) in ASCII; these four bytes constitute the magic number\n", - "e_ident[EI_CLASS] 1 This byte is set to either 1 or 2 to signify 32- or 64-bit format, respectively\n", - "e_ident[EI_DATA] 2 This byte is set to either 1 or 2 to signify little or big endianness, respectively This affects interpretation of multi-byte fields starting with offset 0x10\n", - "e_ident[EI_VERSION] 1 Set to 1 for the original and current version of ELF\n", - "e_ident[EI_OSABI] 0 Identifies the target operating system ABI\n", - "e_ident[EI_ABIVERSION] 0 Further specifies the ABI version\n", - "e_ident[EI_PAD] 0 Reserved padding bytes Currently unused Should be filled with zeros and ignored when read\n", - "e_type 1 Identifies object file type\n", - "e_machine 8 Specifies target instruction set architecture\n", - "e_version 1 Set to 1 for the original version of ELF\n", - "e_entry 0 This is the memory address of the entry point from where the process starts executing This field is either 32 or 64 bits long, depending on the format defined earlier (byte 0x04) If the file doesn't have an associated entry point, then this holds zero\n", - "e_phoff 0 Points to the start of the program header table It usually follows the file header immediately following this one, making the offset 0x34 or 0x40 for 32- and 64-bit ELF executables, respectively\n", - "e_shoff 1140 Points to the start of the section header table\n", - "e_flags 1879052295 Interpretation of this field depends on the target architecture\n", - "e_ehsize 52 Contains the size of this header, normally 64 Bytes for 64-bit and 52 Bytes for 32-bit format\n", - "e_phentsize 0 Contains the size of a program header table entry As explained below, this will typically be 0x20 (32 bit) or 0x38 (64 bit)\n", - "e_phnum 0 Contains the number of entries in the program header table\n", - "e_shentsize 40 Contains the size of a section header table entry As explained below, this will typically be 0x28 (32 bit) or 0x40 (64 bit)\n", - "e_shnum 16 Contains the number of entries in the section header table\n", - "e_shstrndx 15 Contains index of the section header table entry that contains the section names" - ] - }, - "execution_count": 57, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "s = list(elf.sections)\n", - "s[0].file" - ] - }, - { - "cell_type": "code", - "execution_count": 22, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "'EM_MIPS'" - ] - }, - "execution_count": 22, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "elf.architecture" - ] - }, - { - "cell_type": "code", - "execution_count": 21, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "index 2\n", - "name .rel.text\n", - "type SHT_REL (Relocation entries, no addends)\n", - "sh_name 27 An offset to a string in the .shstrtab section that represents the name of this section.\n", - "sh_type 9 Identifies the type of this header.\n", - "sh_flags 64 Identifies the attributes of the section.\n", - "sh_addr 0 Virtual address of the section in memory, for sections that are loaded.\n", - "sh_offset 860 Offset of the section in the file image.\n", - "sh_size 104 Size in bytes of the section in the file image. May be 0.\n", - "sh_link 13 Contains the section index of an associated section. This field is used for several purposes, depending on the type of section.\n", - "sh_info 1 Contains extra information about the section. This field is used for several purposes, depending on the type of section.\n", - "sh_addralign 4 Contains the required alignment of the section. This field must be a power of two.\n", - "sh_entsize 8 Contains the size, in bytes, of each entry, for sections that contain fixed-size entries. Otherwise, this field contains zero." - ] - }, - "execution_count": 21, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "elf.sections['.rel.text']" - ] - }, - { - "cell_type": "code", - "execution_count": 31, - "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "\n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "\n", - "\n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "\n", - "\n", - "
indexnameinfosizestbdescription
0STT_NOTYPE0STB_LOCALSymbol type is unspecified
1test.cSTT_FILE0STB_LOCALSymbol's name is file name
2STT_SECTION0STB_LOCALSymbol associated with a section
3STT_SECTION0STB_LOCALSymbol associated with a section
4STT_SECTION0STB_LOCALSymbol associated with a section
5STT_SECTION0STB_LOCALSymbol associated with a section
6STT_SECTION0STB_LOCALSymbol associated with a section
7STT_SECTION0STB_LOCALSymbol associated with a section
8STT_SECTION0STB_LOCALSymbol associated with a section
9STT_SECTION0STB_LOCALSymbol associated with a section
10STT_SECTION0STB_LOCALSymbol associated with a section
11STT_SECTION0STB_LOCALSymbol associated with a section
12result_floatSTT_FUNC12STB_GLOBALSymbol is a code object
13result_float_floatSTT_FUNC24STB_GLOBALSymbol is a code object
14add_float_floatSTT_FUNC24STB_GLOBALSymbol is a code object
15_gp_dispSTT_OBJECT0STB_GLOBALSymbol is a data object
16mul_float_floatSTT_FUNC24STB_GLOBALSymbol is a code object
17read_floatSTT_FUNC28STB_GLOBALSymbol is a code object
18read_float_retSTT_OBJECT4STB_GLOBALSymbol is a data object
\n" - ], - "text/plain": [ - " index name info size stb description \n", - "--------------------------------------------------------------------------------------------\n", - " 0 STT_NOTYPE 0 STB_LOCAL Symbol type is unspecified \n", - " 1 test.c STT_FILE 0 STB_LOCAL Symbol's name is file name \n", - " 2 STT_SECTION 0 STB_LOCAL Symbol associated with a section \n", - " 3 STT_SECTION 0 STB_LOCAL Symbol associated with a section \n", - " 4 STT_SECTION 0 STB_LOCAL Symbol associated with a section \n", - " 5 STT_SECTION 0 STB_LOCAL Symbol associated with a section \n", - " 6 STT_SECTION 0 STB_LOCAL Symbol associated with a section \n", - " 7 STT_SECTION 0 STB_LOCAL Symbol associated with a section \n", - " 8 STT_SECTION 0 STB_LOCAL Symbol associated with a section \n", - " 9 STT_SECTION 0 STB_LOCAL Symbol associated with a section \n", - " 10 STT_SECTION 0 STB_LOCAL Symbol associated with a section \n", - " 11 STT_SECTION 0 STB_LOCAL Symbol associated with a section \n", - " 12 result_float STT_FUNC 12 STB_GLOBAL Symbol is a code object \n", - " 13 result_float_float STT_FUNC 24 STB_GLOBAL Symbol is a code object \n", - " 14 add_float_float STT_FUNC 24 STB_GLOBAL Symbol is a code object \n", - " 15 _gp_disp STT_OBJECT 0 STB_GLOBAL Symbol is a data object \n", - " 16 mul_float_float STT_FUNC 24 STB_GLOBAL Symbol is a code object \n", - " 17 read_float STT_FUNC 28 STB_GLOBAL Symbol is a code object \n", - " 18 read_float_ret STT_OBJECT 4 STB_GLOBAL Symbol is a data object " - ] - }, - "execution_count": 31, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "elf.symbols" - ] - }, - { - "cell_type": "code", - "execution_count": 33, - "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "\n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - "\n", - "\n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - "\n", - "\n", - "
indexsymbol nametypecalculation
0_gp_dispR_MIPS_HI16((A + S) >> 16) & 0xFFFF
1_gp_dispR_MIPS_LO16(A + S) & 0xFFFF
2result_floatR_MIPS_GOT16G + A
3result_floatR_MIPS_TLS_DTPREL32S + A - TLS_DTV_OFFSET
4_gp_dispR_MIPS_HI16((A + S) >> 16) & 0xFFFF
5_gp_dispR_MIPS_LO16(A + S) & 0xFFFF
6result_floatR_MIPS_GOT16G + A
7result_floatR_MIPS_TLS_DTPREL32S + A - TLS_DTV_OFFSET
8_gp_dispR_MIPS_HI16((A + S) >> 16) & 0xFFFF
9_gp_dispR_MIPS_LO16(A + S) & 0xFFFF
10read_float_retR_MIPS_GOT16G + A
11result_float_floatR_MIPS_GOT16G + A
12result_float_floatR_MIPS_TLS_DTPREL32S + A - TLS_DTV_OFFSET
0result_floatR_MIPS_32S + A
1result_float_floatR_MIPS_32S + A
2add_float_floatR_MIPS_32S + A
3mul_float_floatR_MIPS_32S + A
4read_floatR_MIPS_32S + A
\n" - ], - "text/plain": [ - " index symbol name type calculation \n", - "--------------------------------------------------------------------------\n", - " 0 _gp_disp R_MIPS_HI16 ((A + S) >> 16) & 0xFFFF \n", - " 1 _gp_disp R_MIPS_LO16 (A + S) & 0xFFFF \n", - " 2 result_float R_MIPS_GOT16 G + A \n", - " 3 result_float R_MIPS_TLS_DTPREL32 S + A - TLS_DTV_OFFSET \n", - " 4 _gp_disp R_MIPS_HI16 ((A + S) >> 16) & 0xFFFF \n", - " 5 _gp_disp R_MIPS_LO16 (A + S) & 0xFFFF \n", - " 6 result_float R_MIPS_GOT16 G + A \n", - " 7 result_float R_MIPS_TLS_DTPREL32 S + A - TLS_DTV_OFFSET \n", - " 8 _gp_disp R_MIPS_HI16 ((A + S) >> 16) & 0xFFFF \n", - " 9 _gp_disp R_MIPS_LO16 (A + S) & 0xFFFF \n", - " 10 read_float_ret R_MIPS_GOT16 G + A \n", - " 11 result_float_float R_MIPS_GOT16 G + A \n", - " 12 result_float_float R_MIPS_TLS_DTPREL32 S + A - TLS_DTV_OFFSET \n", - " 0 result_float R_MIPS_32 S + A \n", - " 1 result_float_float R_MIPS_32 S + A \n", - " 2 add_float_float R_MIPS_32 S + A \n", - " 3 mul_float_float R_MIPS_32 S + A \n", - " 4 read_float R_MIPS_32 S + A " - ] - }, - "execution_count": 33, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "elf.get_relocations()" - ] - }, - { - "cell_type": "code", - "execution_count": 36, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "index 12\n", - "symbol result_float\n", - "relocation type R_MIPS_GOT16 (G + A)\n", - "r_offset 48\n", - "r_info 3081\n", - "r_addend 0" - ] - }, - "execution_count": 36, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "elf.get_relocations('.rel.text')[2]#['result_float']" - ] - }, - { - "cell_type": "code", - "execution_count": 11, - "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "\n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "\n", - "\n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "\n", - "\n", - "
indexnameinfosizestbdescription
0STT_NOTYPE0STB_LOCALType is unspecified
1test.cSTT_FILE0STB_LOCALRepresents a file name
2STT_SECTION0STB_LOCALAssociated with a section
3STT_SECTION0STB_LOCALAssociated with a section
4STT_SECTION0STB_LOCALAssociated with a section
5STT_SECTION0STB_LOCALAssociated with a section
6STT_SECTION0STB_LOCALAssociated with a section
7STT_SECTION0STB_LOCALAssociated with a section
8STT_SECTION0STB_LOCALAssociated with a section
9STT_SECTION0STB_LOCALAssociated with a section
10STT_SECTION0STB_LOCALAssociated with a section
11STT_SECTION0STB_LOCALAssociated with a section
12read_float_retSTT_OBJECT4STB_GLOBALData object (variable, array, etc.)
13result_floatSTT_FUNC48STB_GLOBALFunction or executable code
14result_float_floatSTT_FUNC68STB_GLOBALFunction or executable code
15add_float_floatSTT_FUNC104STB_GLOBALFunction or executable code
16_gp_dispSTT_OBJECT0STB_GLOBALData object (variable, array, etc.)
17mul_float_floatSTT_FUNC104STB_GLOBALFunction or executable code
18read_floatSTT_FUNC100STB_GLOBALFunction or executable code
\n" - ], - "text/plain": [ - " index name info size stb description \n", - "-----------------------------------------------------------------------------------------------\n", - " 0 STT_NOTYPE 0 STB_LOCAL Type is unspecified \n", - " 1 test.c STT_FILE 0 STB_LOCAL Represents a file name \n", - " 2 STT_SECTION 0 STB_LOCAL Associated with a section \n", - " 3 STT_SECTION 0 STB_LOCAL Associated with a section \n", - " 4 STT_SECTION 0 STB_LOCAL Associated with a section \n", - " 5 STT_SECTION 0 STB_LOCAL Associated with a section \n", - " 6 STT_SECTION 0 STB_LOCAL Associated with a section \n", - " 7 STT_SECTION 0 STB_LOCAL Associated with a section \n", - " 8 STT_SECTION 0 STB_LOCAL Associated with a section \n", - " 9 STT_SECTION 0 STB_LOCAL Associated with a section \n", - " 10 STT_SECTION 0 STB_LOCAL Associated with a section \n", - " 11 STT_SECTION 0 STB_LOCAL Associated with a section \n", - " 12 read_float_ret STT_OBJECT 4 STB_GLOBAL Data object (variable, array, etc.) \n", - " 13 result_float STT_FUNC 48 STB_GLOBAL Function or executable code \n", - " 14 result_float_float STT_FUNC 68 STB_GLOBAL Function or executable code \n", - " 15 add_float_float STT_FUNC 104 STB_GLOBAL Function or executable code \n", - " 16 _gp_disp STT_OBJECT 0 STB_GLOBAL Data object (variable, array, etc.) \n", - " 17 mul_float_float STT_FUNC 104 STB_GLOBAL Function or executable code \n", - " 18 read_float STT_FUNC 100 STB_GLOBAL Function or executable code " - ] - }, - "execution_count": 11, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "elf.symbols" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": 42, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "'00 00 00 74 00 00 10 05 00 00 00 78 00 00 10 06 00 00 00 AC 00 00 0D 09 00 00 00 B4 00 00 0D 25 00 00 00 DC 00 00 10 05 00 00 00 E0 00 00 10 06 00 00 01 14 00 00 0D 09 00 00 01 1C 00 00 0D 25 00 00 01 44 00 00 10 05 00 00 01 48 00 00 10 06 00 00 01 68 00 00 0C 09 00 00 01 78 00 00 0E 09 00 00 01 80 00 00 0E 25'" - ] - }, - "execution_count": 42, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "elf.sections['.rel.text'].get_data_hex()" - ] - }, - { - "cell_type": "code", - "execution_count": 32, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "'80 B4 83 B0 00 AF 87 ED 01 0A D7 ED 01 7A FD EE E7 7A 17 EE 90 3A 18 46 0C 37 BD 46 5D F8 04 7B 70 47 80 B4 83 B0 00 AF 87 ED 01 0A C7 ED 00 0A D7 ED 01 7A FD EE E7 7A 17 EE 90 2A D7 ED 00 7A FD EE E7 7A 17 EE 90 3A 13 44 18 46 0C 37 BD 46 5D F8 04 7B 70 47 80 B5 82 B0 00 AF 87 ED 01 0A C7 ED 00 0A 97 ED 01 7A D7 ED 00 7A 77 EE 27 7A B0 EE 67 0A FF F7 FE FF 00 BF 08 37 BD 46 80 BD 80 B5 82 B0 00 AF 87 ED 01 0A C7 ED 00 0A 97 ED 01 7A D7 ED 00 7A 67 EE 27 7A B0 EE 67 0A FF F7 FE FF 00 BF 08 37 BD 46 80 BD 80 B5 82 B0 00 AF 87 ED 01 0A 06 4B 7B 44 D3 ED 00 7A F0 EE 67 0A 97 ED 01 0A FF F7 FE FF 00 BF 08 37 BD 46 80 BD 16 00 00 00'" - ] - }, - "execution_count": 32, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "elf.sections[1].get_data_hex()" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] - } - ], - "metadata": { - "kernelspec": { - "display_name": "pykingas", - "language": "python", - "name": "pykingas" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.10.6" - } - }, - "nbformat": 4, - "nbformat_minor": 2 -}