Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SecondPass* doSecondPass(FirstPass** firstPass)
- {
- SecondPass* secondPass;
- int bapp;
- //init second pass data
- secondPass = (SecondPass*)malloc(sizeof(SecondPass));
- secondPass->textSection.size = 0;
- for(int i = 0; i < __NFILE__; i++)
- {
- secondPass->textSection.size += firstPass[i]->textSection.size;
- }
- secondPass->textSection.buffer = (char*)malloc(sizeof(char) * secondPass->textSection.size);
- memset(secondPass->textSection.buffer, 0x0, secondPass->textSection.size * sizeof(char));
- secondPass->dataSection.size = 0;
- secondPass->dataSection.buffer = NULL;
- // your code should go here
- list<RelTableEntry*>::iterator it;
- for(int i = 0; i < __NFILE__; i++)
- {
- for(it = firstPass[i]->relTable->begin();; it != firstPass[i]->relTable->end(); ++it)
- {
- SymbolTableEntry ste = *findSymbol((*it)->symbolName);
- relMips26((Elf32_Word*)(firstPass[0]->textSection.buffer + (*it)->offset), ste.pap + ste.value);
- }
- int offset = 0;
- memcpy(secondPass->textSection.buffer + offset, firstPass[i]->textSection.buffer, firstPass[i]>textSection.size); offset += firstPass[i]->textSection.size;
- }
- return secondPass;
- }
Add Comment
Please, Sign In to add comment