{
Byte *pb_data;
Byte *pb_dynstr;
- Byte b_flagRelType;
+ //Byte b_flagRelType;
int i_sz_elfdyn;
DWord dw_secid;
QWord qw_tag;
LibGoblin_BinaryFile *p_bfile;
LibGoblin_SectionInfo *p_sec_dynamic;
LibGoblin_SectionInfo *p_sec_dynstr;
- LibGoblin_SectionInfo *p_secnow;
+ //LibGoblin_SectionInfo *p_secnow;
LibGoblin_ProgramInfo *p_pginfo;
assert( NULL != p_binfo );
ELF_Dynamic_SetSectionAddress( p_pginfo, LIBGOBLIN_SECTION_ID_GNU_VERSION_R, ptr_addr );
break;
+ /* 0x6ffffef5 - GNU-style hash table */
+ case DT_GNU_HASH:
+ ELF_Dynamic_SetSectionAddress( p_pginfo, LIBGOBLIN_SECTION_ID_GNU_HASH, ptr_addr );
+ // XXX
+ break;
+ /* 0x6ffffff9 - number of RELATIVE relocations */
+ case DT_RELACOUNT:
+ // XXX
+ break;
+ /* 0x6ffffffc - Address of verdef section. */
+ case DT_VERDEF:
+ // XXX
+ break;
+ /* 0x6ffffffd - Number of elems in verdef section */
+ case DT_VERDEFNUM:
+ // XXX
+ break;
+
/* 0x6fffffff - Number of elems in verneed section */
case DT_VERNEEDNUM:
// XXX
break;
+ /* 05 - Address of string table. */
+ case DT_STRTAB:
+ // NONE Proc.
+ break;
+ /* 10 - Size of string table. */
+ case DT_STRSZ:
+ // NONE Proc.
+ break;
+ /* 20 - Type of relocation used for PLT. */
+ case DT_PLTREL:
+ // NONE Proc.
+ break;
+ case DT_NULL:
+ // NONE Proc.
+ break;
// #define DT_HIOS 0x6ffff000 // Last OS-specific
default:
- printf(" [WARNING] NOT Support for TAG = %8llx\n", qw_tag );
+ printf(" [WARNING] NOT Support for TAG = %8lx\n", qw_tag );
break;
}
}
// Set ProgramHdr Value to ObjectInfo ---
+ p_objinfo->b_type = OBJINFO_TYPE_PROGHDR;
+ p_objinfo->file.i_fid = p_binfo->i_binfile;
+ p_objinfo->file.pv_offset = (void *)(pb_data + p_proghdr->p_offset);
+ p_objinfo->file.qw_size = p_proghdr->p_filesz;
+
+ p_objinfo->info.proghdr.qw_align = p_proghdr->p_align;
// for Next-Loop proc.
p_proghdr = (Elf64_Phdr *)(pb_data + p_elfhdr->e_phoff + (i_cnt * i_phdrsize));
assert( 0 == p_objinfo->i_id );
- p_objinfo->ptr_address = 0x0000000000000000;
- p_objinfo->qw_size = 0xffffffffffffffff;
+ p_objinfo->addr.ptr_addr = 0x0000000000000000;
+ p_objinfo->addr.qw_size = 0xffffffffffffffff;
p_pginfo->objinfo.i_topid = p_objinfo->i_id;
p_objover = p_objnow;
p_objprev = NULL;
do {
-/*
- printf( " INPUT=(%16llx,%16llx) <=> OBJNOW=%2d(%16llx,%16llx) %p %p\n",
- ptr_address, qw_size,
- p_objnow->i_id, p_objnow->ptr_address, p_objnow->qw_size,
- p_objnow, p_objprev );
-*/
-/*
- printf( " INPUT=(%16llx - %16llx) <=> OBJNOW=%2d(%16llx - %16llx) %p %p %16llx\n",
- ptr_address, (ptr_address + qw_size),
- p_objnow->i_id,
- p_objnow->ptr_address, (p_objnow->ptr_address + p_objnow->qw_size),
- p_objnow, p_objover, qw_size );
-*/
-
- if(( p_objnow->ptr_address <= ptr_address )
- && ( (ptr_address + qw_size) <= (p_objnow->ptr_address + p_objnow->qw_size) )) {
- if( p_objnow->qw_size <= p_objover->qw_size ) { p_objover = p_objnow; }
+
+ if(( p_objnow->addr.ptr_addr <= ptr_address )
+ && ( (ptr_address + qw_size) <= (p_objnow->addr.ptr_addr + p_objnow->addr.qw_size) )) {
+ if( p_objnow->addr.qw_size <= p_objover->addr.qw_size ) { p_objover = p_objnow; }
}
- if( ptr_address == p_objnow->ptr_address ) {
- if( qw_size > p_objnow->qw_size ) { break; }
+ if( ptr_address == p_objnow->addr.ptr_addr ) {
+ if( qw_size > p_objnow->addr.qw_size ) { break; }
}
- else if( ptr_address < p_objnow->ptr_address ) { break; }
+ else if( ptr_address < p_objnow->addr.ptr_addr ) { break; }
p_objprev = p_objnow;
p_objnow = ((NO_OBJ != p_objnow->addrlink.i_next_id)
? OBJINFO( p_pginfo, p_parent->grplink.i_child_topid ) : NULL );
p_objprev = NULL;
do {
- if( ptr_address == p_objnow->ptr_address ) {
- if( qw_size > p_objnow->qw_size ) { break; }
+ if( ptr_address == p_objnow->addr.ptr_addr ) {
+ if( qw_size > p_objnow->addr.qw_size ) { break; }
}
- else if( ptr_address < p_objnow->ptr_address ) { break; }
+ else if( ptr_address < p_objnow->addr.ptr_addr ) { break; }
p_objprev = p_objnow;
p_objnow = ((NO_OBJ != p_objnow->grplink.i_next_id)
if( NULL != p_objnow ) { p_objnow->grplink.i_prev_id = p_objinfo->i_id; }
goto_ObjectInfo_InsetObject_set:
- p_objinfo->ptr_address = ptr_address;
- p_objinfo->qw_size = qw_size;
+ p_objinfo->addr.ptr_addr = ptr_address;
+ p_objinfo->addr.qw_size = qw_size;
goto_ObjectInfo_InsetObject_post:
return p_objinfo;
LIBGOBLIN_SECTION_STR_DEBUG_ARANGES,
LIBGOBLIN_SECTION_STR_DEBUG_FRAME,
LIBGOBLIN_SECTION_STR_DEBUG_LOC,
- LIBGOBLIN_SECTION_STR_DEBUG_PUBNAMES
+ LIBGOBLIN_SECTION_STR_DEBUG_PUBNAMES,
+ LIBGOBLIN_SECTION_STR_DEBUG_STR,
+ LIBGOBLIN_SECTION_STR_DEBUG_RANGES,
+ LIBGOBLIN_SECTION_STR_DEBUG_MACINFO,
+ LIBGOBLIN_SECTION_STR_DEBUG_PUBTYPES,
+ LIBGOBLIN_SECTION_STR_NOTE_TAG,
+ LIBGOBLIN_SECTION_STR_GNU_HASH,
+ LIBGOBLIN_SECTION_STR_RELA_DYN,
+ LIBGOBLIN_SECTION_STR_TDATA,
+ LIBGOBLIN_SECTION_STR_TBSS,
+ LIBGOBLIN_SECTION_STR_DATA_REL_RO,
+ LIBGOBLIN_SECTION_STR_INIT_ARRAY,
+ LIBGOBLIN_SECTION_STR_FINI_ARRAY
};
#else
extern char *gstr_section_name[LIBGOBLIN_SECTION_ID_MAX];
#ifndef DRD64_HEADER_LIBGOBLIN_SECTION_DEFS
#define DRD64_HEADER_LIBGOBLIN_SECTION_DEFS
-#define LIBGOBLIN_SECTION_ID_DEFAULT_MAX 0x24
-#define LIBGOBLIN_SECTION_ID_MAX 0x3f
+#define LIBGOBLIN_SECTION_ID_DEFAULT_MAX 0x2f
+#define LIBGOBLIN_SECTION_ID_MAX 0x4f
#define LIBGOBLIN_SECTION_ID_INVALID 0xff
#define LIBGOBLIN_SECTION_ID_NULL 0x00
#define LIBGOBLIN_SECTION_ID_DEBUG_FRAME 0x21
#define LIBGOBLIN_SECTION_ID_DEBUG_LOC 0x22
#define LIBGOBLIN_SECTION_ID_DEBUG_PUBNAMES 0x23
+#define LIBGOBLIN_SECTION_ID_DEBUG_STR 0x24
+#define LIBGOBLIN_SECTION_ID_DEBUG_RANGES 0x25
+#define LIBGOBLIN_SECTION_ID_DEBUG_MACINFO 0x26
+#define LIBGOBLIN_SECTION_ID_DEBUG_PUBTYPES 0x27
+#define LIBGOBLIN_SECTION_ID_NOTE_TAG 0x28
+#define LIBGOBLIN_SECTION_ID_GNU_HASH 0x29
+#define LIBGOBLIN_SECTION_ID_RELA_DYN 0x2a
+#define LIBGOBLIN_SECTION_ID_TDATA 0x2b
+#define LIBGOBLIN_SECTION_ID_TBSS 0x2c
+#define LIBGOBLIN_SECTION_ID_DATA_REL_RO 0x2d
+#define LIBGOBLIN_SECTION_ID_INIT_ARRAY 0x2e
+#define LIBGOBLIN_SECTION_ID_FINI_ARRAY 0x2f
#define LIBGOBLIN_SECTION_STR_NULL ""
#define LIBGOBLIN_SECTION_STR_TEXT ".text"
#define LIBGOBLIN_SECTION_STR_DEBUG_FRAME ".debug_frame"
#define LIBGOBLIN_SECTION_STR_DEBUG_LOC ".debug_loc"
#define LIBGOBLIN_SECTION_STR_DEBUG_PUBNAMES ".debug_pubnames"
+#define LIBGOBLIN_SECTION_STR_DEBUG_STR ".debug_str"
+#define LIBGOBLIN_SECTION_STR_DEBUG_RANGES ".debug_ranges"
+#define LIBGOBLIN_SECTION_STR_DEBUG_MACINFO ".debug_macinfo"
+#define LIBGOBLIN_SECTION_STR_DEBUG_PUBTYPES ".debug_pubtypes"
+#define LIBGOBLIN_SECTION_STR_NOTE_TAG ".note.tag"
+#define LIBGOBLIN_SECTION_STR_GNU_HASH ".gnu.hash"
+#define LIBGOBLIN_SECTION_STR_RELA_DYN ".rela.dyn"
+#define LIBGOBLIN_SECTION_STR_TDATA ".tdata"
+#define LIBGOBLIN_SECTION_STR_TBSS ".tbss"
+#define LIBGOBLIN_SECTION_STR_DATA_REL_RO ".data.rel.ro"
+#define LIBGOBLIN_SECTION_STR_INIT_ARRAY ".init_array"
+#define LIBGOBLIN_SECTION_STR_FINI_ARRAY ".fini_array"
+
#endif /* DRD64_HEADER_LIBGOBLIN_SECTION*/
/*=====================================================================*/
#define LIBGOBLIN_OBJINFO_INVALID 0x00
#define LIBGOBLIN_OBJINFO_VALID 0x01
+
+#define OBJINFO_TYPE_NULL 0x00
+#define OBJINFO_TYPE_PROGHDR 0x01
+#define OBJINFO_TYPE_SECTION 0x02
+
typedef struct {
int i_id;
Byte b_status;
+ Byte b_type;
+
+ // Address & Memory-Range Info ----
+ struct {
+ Ptr ptr_addr; // Object Address
+ QWord qw_size; // Object Size (Address Range)
+ } addr;
// Group(Parent-Child) Order Link ---
struct {
int i_prev_id; // Prev Address ObjectInfo
} addrlink;
- // Address & Memory-Range Info ----
- Ptr ptr_address; // Object Address
- QWord qw_size; // Object Size (Address Range)
+ // File Info ---
+ struct {
+ int i_fid;
+ void *pv_offset;
+ QWord qw_size;
+ } file;
+ // ObjectInfo (DATA) ---
char *pstr_name; // Object Name (Param./Func./etc...)
+ union {
+ struct {
+ QWord qw_align;
+
+ } proghdr;
+
+ } info;
+
+
//DWord dw_srcid; // SourceInfo struct ID
Byte b_elf_flags;
Word w_secid; // SectionInfo ItemIndex belong with this object.