drd64_libgoblin_elf_gnuver.o \
drd64_libgoblin_elf_hash.o \
drd64_libgoblin_elf_symtab.o \
+ drd64_libgoblin_elf_rela.o \
drd64_libgoblin_elf_proghdr.o \
drd64_libgoblin_elf_section.o \
drd64_libgoblin_elf32.o \
drd64_libgoblin_elf_gnuver.h \
drd64_libgoblin_elf_hash.h \
drd64_libgoblin_elf_symtab.h \
+ drd64_libgoblin_elf_rela.h \
drd64_libgoblin_elf_proghdr.h \
drd64_libgoblin_elf_section.h \
drd64_libgoblin_elf32.h \
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
+drd64_libgoblin_elf_rela.o: drd64_libgoblin_elf_rela.c $(HEADER)
+ $(CC) -c -o drd64_libgoblin_elf_rela.o $(FLAGS_DEBUG) \
+ drd64_libgoblin_elf_rela.c
drd64_libgoblin_elf_proghdr.o: drd64_libgoblin_elf_proghdr.c $(HEADER)
$(CC) -c -o drd64_libgoblin_elf_proghdr.o $(FLAGS_DEBUG) \
drd64_libgoblin_elf_proghdr.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_RELA
+#include"drd64_libgoblin.h"
+
+
+/*----------------------------------------------------------------------
+----------------------------------------------------------------------*/
+/*
+LIBGOBLIN_ELF_RELA_EXTERN
+LibGoblin_ObjectInfo *
+ ELF64_Symtab_RegistSymbol_toObjectInfo(
+ LibGoblin_ProgramInfo *p_pginfo,
+ Elf64_Sym *p_sym,
+ Byte *pb_strtab )
+{
+ LibGoblin_SrcFile *p_srcfile;
+ LibGoblin_ObjectInfo *p_obj = NULL;
+
+ if(( 0x00000000 == p_sym->st_value )
+ && ( STT_NOTYPE == ELF64_ST_TYPE( p_sym->st_info ) ))
+ { goto goto_ELF64_Symtab_RegistSymbol_toObjectInfo_post; }
+
+ 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 );
+ goto goto_ELF64_Symtab_RegistSymbol_toObjectInfo_post;
+ }
+
+ p_obj = ObjectInfo_InsetObject( p_pginfo,
+ (PtrValue)p_sym->st_value, (QWord)p_sym->st_size, NULL, 0x01 );
+
+ p_obj->pstr_name = (char *)(pb_strtab + p_sym->st_name);
+ p_obj->dw_hash = Common_CalcDJBhash( (char *)(pb_strtab + p_sym->st_name) );
+
+ p_obj->info.symbol.b_type = ELF64_ST_TYPE( p_sym->st_info );
+ switch( ELF64_ST_TYPE( p_sym->st_info ) ) {
+ case STT_NOTYPE:
+ p_obj->b_type = OBJINFO_TYPE_NULL; break;
+ case STT_OBJECT:
+ p_obj->b_type = OBJINFO_TYPE_OBJECT; break;
+ case STT_FUNC:
+ p_obj->b_type = OBJINFO_TYPE_FUNCTION; break;
+ case STT_SECTION:
+ p_obj->b_type = OBJINFO_TYPE_SECTION; break;
+ case STT_COMMON:
+ p_obj->b_type = OBJINFO_TYPE_COMMON; break;
+ case STT_TLS:
+ p_obj->b_type = OBJINFO_TYPE_TLS; break;
+ default:
+ p_obj->b_type = OBJINFO_TYPE_NULL; break;
+ }
+
+ p_obj->info.symbol.b_binding = ELF64_ST_BIND( p_sym->st_info );
+ p_obj->info.symbol.b_visibility = p_sym->st_other;
+ p_obj->info.symbol.w_secindex = p_sym->st_shndx;
+ if(( SHN_UNDEF == p_sym->st_shndx ) && ( STT_NOTYPE != ELF64_ST_TYPE( p_sym->st_info ) ))
+ { p_obj->dw_status |= OBJINFO_STATUS_DYNAMIC; }
+
+goto_ELF64_Symtab_RegistSymbol_toObjectInfo_post:
+ return p_obj;
+}
+*/
+
+/*----------------------------------------------------------------------
+----------------------------------------------------------------------*/
+int
+ ELF64_Rela_ReadIndicateSection_Rela(
+ LibGoblin_BinaryInfo *p_binfo,
+ Byte b_secid )
+{
+ Elf64_Rela *p_rela;
+ LibGoblin_SectionInfo *psec_rela;
+
+ psec_rela = Section_GetSectionInfo_fromBinaryInfo( p_binfo, b_secid );
+ if( NULL == psec_rela ) {
+ return 0x00;
+ }
+ if( NULL == psec_rela->pb_data ) {
+ return 0x00;
+ }
+
+
+/*
+ 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_ProgramInfo *p_pginfo;
+
+ assert( NULL != p_binfo );
+
+ 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++ ) {
+ ELF64_Symtab_RegistSymbol_toObjectInfo( p_pginfo, p_sym, pb_strtab );
+ }
+
+ if( 0x00 != i_result ) {
+ return -0x04;
+ }
+*/
+
+ return 0x00;
+}
+
+
+/*----------------------------------------------------------------------
+----------------------------------------------------------------------*/
+LIBGOBLIN_ELF_RELA_EXTERN
+int
+ ELF64_Rela_ReadSection(
+ LibGoblin_BinaryInfo *p_binfo )
+{
+ int i_ret;
+
+ // XXX: Search Rel/Rela Section ---
+
+ i_ret = ELF64_Rela_ReadIndicateSection_Rela( p_binfo, LIBGOBLIN_SECTION_ID_RELA_PLT );
+
+ return i_ret;
+}
+
+
+
+/* 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_RELA
+#define DRD64_HEADER_LIBGOBLIN_ELF_RELA
+
+#include"drd64_libgoblin.h"
+
+#ifdef DRD64_SRC_LIBGOBLIN_ELF_RELA
+ #define LIBGOBLIN_ELF_RELA_EXTERN
+#else
+ #define LIBGOBLIN_ELF_RELA_EXTERN extern
+#endif
+
+LIBGOBLIN_ELF_RELA_EXTERN
+ int ELF64_Rela_ReadSection( LibGoblin_BinaryInfo *p_binfo );
+
+#ifdef DRD64_SRC_LIBGOBLIN_ELF_RELA
+#endif
+
+
+
+#endif /* DRD64_HEADER_LIBGOBLIN_BINFO */
+
+/* EOF of drd64_.h ----------------------------------- */