Let the linker generate a new symbol __NAME_FILEOFFS__ that contains the

offset of a memory area in the output file. Partially based on a contribution
by David M. Lloyd, david.lloyd@redhat.com.


git-svn-id: svn://svn.cc65.org/cc65/trunk@5351 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
uz
2011-12-31 15:21:33 +00:00
parent 45f7cc1403
commit 081308942c
6 changed files with 49 additions and 10 deletions

View File

@@ -134,11 +134,18 @@ static void PrintNumVal (const char* Name, unsigned long V)
static void BinWriteMem (BinDesc* D, MemoryArea* M)
/* Write the segments of one memory area to a file */
{
unsigned I;
/* Get the start address of this memory area */
unsigned long Addr = M->Start;
/* Debugging: Check that the file offset is correct */
if (ftell (D->F) != (long)M->FileOffs) {
Internal ("Invalid file offset for memory area %s: %ld/%lu",
GetString (M->Name), ftell (D->F), M->FileOffs);
}
/* Walk over all segments in this memory area */
unsigned I;
for (I = 0; I < CollCount (&M->SegList); ++I) {
int DoWrite;
@@ -171,7 +178,7 @@ static void BinWriteMem (BinDesc* D, MemoryArea* M)
*/
Warning ("Segment `%s' is not aligned properly. Resulting "
"executable may not be functional.",
GetString (S->Name));
GetString (S->Name));
}
/* If this is the run memory area, we must apply run alignment. If