drd64_libgoblin_section.o \
drd64_libgoblin_elf.o \
drd64_libgoblin_elf_dynamic.o \
+ drd64_libgoblin_elf_dynsym.o \
drd64_libgoblin_elf_symtab.o \
drd64_libgoblin_elf_proghdr.o \
drd64_libgoblin_elf_section.o \
drd64_libgoblin_section.h \
drd64_libgoblin_elf.h \
drd64_libgoblin_elf_dynamic.h \
+ drd64_libgoblin_elf_dynsym.h \
drd64_libgoblin_elf_symtab.h \
drd64_libgoblin_elf_proghdr.h \
drd64_libgoblin_elf_section.h \
drd64_libgoblin_elf_dynamic.o: drd64_libgoblin_elf_dynamic.c $(HEADER)
$(CC) -c -o drd64_libgoblin_elf_dynamic.o $(FLAGS_DEBUG) \
drd64_libgoblin_elf_dynamic.c
+drd64_libgoblin_elf_dynsym.o: drd64_libgoblin_elf_dynsym.c $(HEADER)
+ $(CC) -c -o drd64_libgoblin_elf_dynsym.o $(FLAGS_DEBUG) \
+ drd64_libgoblin_elf_dynsym.c
drd64_libgoblin_elf_symtab.o: drd64_libgoblin_elf_symtab.c $(HEADER)
$(CC) -c -o drd64_libgoblin_elf_symtab.o $(FLAGS_DEBUG) \
drd64_libgoblin_elf_symtab.c
--- /dev/null
+/*DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64
+
+ D r . D e a m o n 6 4
+ for INTEL64(R), AMD64(R)
+
+ Copyright(C) 2007-2009 Koine Yuusuke(koinec). All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY Koine Yuusuke(koinec) ``AS IS'' AND ANY
+EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL Koine Yuusuke(koinec) OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+OF THE POSSIBILITY OF SUCH DAMAGE.
+
+DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64*/
+
+/* File Info -----------------------------------------------------------
+File: drd64_.c
+Function:
+Comment:
+----------------------------------------------------------------------*/
+
+#define DRD64_SRC_LIBGOBLIN_ELF_DYNSYM
+#include"drd64_libgoblin.h"
+
+
+/*----------------------------------------------------------------------
+----------------------------------------------------------------------*/
+LIBGOBLIN_ELF_DYNSYM_EXTERN
+int
+ ELF64_DynSym_ReadSection(
+ LibGoblin_BinaryInfo *p_binfo )
+{
+/*
+ Byte *pb_symtab;
+ Byte *pb_strtab;
+ int i_result = 0x00;
+ DWord dw_symbols;
+ DWord dw_cnt;
+ Elf64_Shdr *p_shdr;
+ Elf64_Sym *p_sym = NULL;
+ LibGoblin_SectionInfo *p_secinfo;
+ LibGoblin_SectionInfo *p_secstr;
+ LibGoblin_SrcFile *p_srcfile;
+ LibGoblin_ObjectInfo *p_obj;
+ LibGoblin_ProgramInfo *p_pginfo;
+
+ assert( NULL != p_binfo );
+
+ // Check BinaryInfo & Get SymbolEntires
+ p_secinfo = LibGoblin_Section_GetSectionInfo_fid(
+ p_binfo, LIBGOBLIN_SECTION_ID_DYNSYM );
+ if( NULL == p_secinfo ) {
+ return 0x00;
+ }
+ pb_symtab = p_secinfo->pb_data;
+
+ p_secstr = LibGoblin_Section_GetSectionInfo_fid(
+ p_binfo, LIBGOBLIN_SECTION_ID_STRTAB );
+ if( NULL == p_secstr ) {
+ return 0x00;
+ }
+ pb_strtab = p_secstr->pb_data;
+
+ p_shdr = (Elf64_Shdr *)(p_secinfo->pb_sechdr);
+ if( 0 == p_shdr->sh_entsize ) {
+ return -0x02;
+ }
+ dw_symbols = (DWord)p_shdr->sh_size / (DWord)p_shdr->sh_entsize;
+
+ p_pginfo = ProgInfo_GetProgInfo( p_binfo->i_pginfo );
+ assert( NULL != p_pginfo );
+
+ p_sym = (Elf64_Sym *)pb_symtab;
+ for( dw_cnt = 0; ((dw_cnt < dw_symbols) && (0x00 == i_result)); dw_cnt++, p_sym++ ) {
+
+ // Source file.
+ if( STT_FILE == ELF64_ST_TYPE( p_sym->st_info ) ) {
+ p_srcfile = SrcFile_DispenseSrcFile( (char *)pb_strtab + p_sym->st_name );
+ assert( NULL != p_srcfile );
+ continue;
+ }
+
+ if(( 0x00000000 == p_sym->st_value )
+ && ( STT_NOTYPE == ELF64_ST_TYPE( p_sym->st_info ) ))
+ { continue; }
+
+ // st_value - Symbol value.
+ // st_size - Size of associated object.
+ p_obj = ObjectInfo_InsetObject( p_pginfo,
+ (PtrValue)p_sym->st_value, (QWord)p_sym->st_size, NULL, 0x01 );
+
+ // st_name - String table index of name.
+ p_obj->pstr_name = (char *)(pb_strtab + p_sym->st_name);
+
+ // st_info - Type and binding information.
+ p_obj->info.symbol.b_type = ELF64_ST_TYPE( p_sym->st_info );
+ switch( ELF64_ST_TYPE( p_sym->st_info ) ) {
+ // Unspecified type.
+ case STT_NOTYPE:
+ p_obj->b_type = OBJINFO_TYPE_NULL; break;
+ // Data object.
+ case STT_OBJECT:
+ p_obj->b_type = OBJINFO_TYPE_OBJECT; break;
+ // Function.
+ case STT_FUNC:
+ p_obj->b_type = OBJINFO_TYPE_FUNCTION; break;
+ // Section.
+ case STT_SECTION:
+ p_obj->b_type = OBJINFO_TYPE_SECTION; break;
+ // Uninitialized common block.
+ case STT_COMMON:
+ p_obj->b_type = OBJINFO_TYPE_COMMON; break;
+ // TLS object.
+ case STT_TLS:
+ p_obj->b_type = OBJINFO_TYPE_TLS; break;
+ default:
+ p_obj->b_type = OBJINFO_TYPE_NULL; break;
+ }
+
+ // st_info - Type and binding information.
+ p_obj->info.symbol.b_binding = ELF64_ST_BIND( p_sym->st_info );
+
+ // st_other - Reserved (not used).
+ p_obj->info.symbol.b_visibility = p_sym->st_other;
+
+ // st_shndx - Section index of symbol.
+ p_obj->info.symbol.w_secindex = p_sym->st_shndx;
+ }
+
+ if( 0x00 != i_result ) {
+ return -0x04;
+ }
+*/
+ return 0x00;
+}
+
+
+
+/* EOF of drd64_.c ----------------------------------- */
+
+
--- /dev/null
+/*DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64
+
+ D r . D e a m o n 6 4
+ for INTEL64(R), AMD64(R)
+
+ Copyright(C) 2007-2009 Koine Yuusuke(koinec). All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY Koine Yuusuke(koinec) ``AS IS'' AND ANY
+EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL Koine Yuusuke(koinec) OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+OF THE POSSIBILITY OF SUCH DAMAGE.
+
+DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64*/
+
+/* File Info -----------------------------------------------------------
+File: drd64_.h
+Function: Header
+Comment:
+----------------------------------------------------------------------*/
+
+#ifndef DRD64_HEADER_LIBGOBLIN_ELF_DYNSYM
+#define DRD64_HEADER_LIBGOBLIN_ELF_DYNSYM
+
+#include"drd64_libgoblin.h"
+
+#ifdef DRD64_SRC_LIBGOBLIN_ELF_DYNSYM
+ #define LIBGOBLIN_ELF_DYNSYM_EXTERN
+#else
+ #define LIBGOBLIN_ELF_DYNSYM_EXTERN extern
+#endif
+
+
+#ifdef DRD64_SRC_LIBGOBLIN_ELF_DYNSYM
+#endif
+
+
+LIBGOBLIN_ELF_DYNSYM_EXTERN
+ int ELF64_DynSym_ReadSection(
+ LibGoblin_BinaryInfo *p_binfo );
+
+
+#endif /* DRD64_HEADER_LIBGOBLIN_BINFO */
+
+/* EOF of drd64_.h ----------------------------------- */