/* Initialize the data */
S->Next = 0;
S->Seg = Seg;
+ S->Obj = 0;
S->FragRoot = 0;
S->FragLast = 0;
S->Size = 0;
/* Allocate the section we will return later */
Sec = NewSection (S, Align, Type);
+ /* Remember the object file this section was from */
+ Sec->Obj = O;
+
/* Set up the minimum segment alignment */
if (Sec->Align > S->Align) {
/* Section needs larger alignment, use this one */
while (Sec) {
Fragment* Frag;
+ /* Output were this section is from */
+ Print (stdout, 2, " Section from \"%s\"\n", GetObjFileName (Sec->Obj));
+
/* If we have fill bytes, write them now */
+ Print (stdout, 2, " Filling 0x%x bytes with 0x%02x\n",
+ Sec->Fill, S->FillVal);
WriteMult (Tgt, S->FillVal, Sec->Fill);
Offs += Sec->Fill;
/* Output fragment data */
- switch (Frag->Type) {
+ switch (Frag->Type) {
- case FRAG_LITERAL:
- WriteData (Tgt, Frag->LitBuf, Frag->Size);
- break;
+ case FRAG_LITERAL:
+ WriteData (Tgt, Frag->LitBuf, Frag->Size);
+ break;
- case FRAG_EXPR:
- case FRAG_SEXPR:
+ case FRAG_EXPR:
+ case FRAG_SEXPR:
Sign = (Frag->Type == FRAG_SEXPR);
/* Call the users function and evaluate the result */
switch (F (Frag->Expr, Sign, Frag->Size, Offs, Data)) {
}
/* Update the offset */
+ Print (stdout, 2, " Fragment with 0x%x bytes\n",
+ Frag->Size);
Offs += Frag->Size;
/* Next fragment */
unsigned char AddrSize; /* Address size of segment */
unsigned char ReadOnly; /* True for readonly segments (config) */
unsigned char Relocatable; /* True if the segment is relocatable */
- unsigned char Placed; /* Did we place this segment already? */
+ unsigned char Placed; /* Did we place this segment already? */
unsigned char Dumped; /* Did we dump this segment? */
};
struct Section {
Section* Next; /* List of sections in a segment */
Segment* Seg; /* Segment that contains the section */
+ struct ObjData* Obj; /* Object file this section comes from */
struct Fragment* FragRoot; /* Fragment list */
struct Fragment* FragLast; /* Pointer to last fragment */
unsigned long Offs; /* Offset into the segment */