static void WriteRelocsSections( ElfHdr *hdr ) /********************************************/ { group_entry *group; int currgrp; Elf32_Shdr *sh; void *relocs; char *secname; currgrp = hdr->i.grpbase; sh = hdr->sh + hdr->i.relbase; for( group = Groups; group != NULL; group = group->next_group ) { relocs = group->g.grp_relocs; if( relocs != NULL ) { sh->sh_offset = hdr->curr_off; sh->sh_entsize = sizeof(elf_reloc_item); sh->sh_type = SHT_RELA; sh->sh_flags = SHF_ALLOC; sh->sh_addr = 0; sh->sh_link = hdr->i.symtab; sh->sh_info = currgrp; sh->sh_addralign = 4; sh->sh_size = RelocSize( relocs ); secname = GroupSecName( group ); SetRelocSectName( hdr, sh, secname ); DumpRelocList( relocs ); hdr->curr_off += sh->sh_size; sh++; } currgrp++; } }
static void WriteDOSSectRelocs( section *sect, bool repos ) /*********************************************************/ /* write all relocs associated with sect to the file */ { unsigned long loc; OUTFILELIST *out; if( sect->relocs != 0 ) { loc = sect->u.file_loc + MAKE_PARA( sect->size ); out = sect->outfile; if( out->file_loc > loc ) { SeekLoad( loc ); } else { if( repos ) { SeekLoad( out->file_loc ); } if( out->file_loc < loc ) { PadLoad( loc - out->file_loc ); out->file_loc = loc; } } loc += sect->relocs * sizeof( dos_addr ); DumpRelocList( sect->reloclist ); if( loc > out->file_loc ) { out->file_loc = loc; } } }
static unsigned_32 WriteNovRelocs( fixed_header *header ) /*******************************************************/ // write the relocations. { DumpRelocList( Root->reloclist ); header->numberOfRelocationFixups = Root->relocs; return( (unsigned_32)Root->relocs * sizeof( nov_reloc_item ) ); }
static unsigned_32 WriteDOSRootRelocs( unsigned_32 mz_hdr_size ) /**************************************************************/ /* write all relocs to the file */ { unsigned long header_size; DumpRelocList( Root->reloclist ); NullAlign( 0x10 ); header_size = (unsigned long)Root->relocs * sizeof( dos_addr ) + mz_hdr_size; return( MAKE_PARA( header_size ) ); }
static unsigned long WriteOS2Relocs( group_entry *group ) /*******************************************************/ /* write all relocs associated with group to the file */ { unsigned long relocsize; unsigned long relocnum; relocsize = RelocSize( group->g.grp_relocs ); relocnum = relocsize / sizeof( os2_reloc_item ); if( relocnum == 0 ) return( 0 ); WriteLoad( &relocnum, 2 ); DumpRelocList( group->g.grp_relocs ); return( relocsize ); }