//
-// RMAC - Reboot's Macro Assembler for the Atari Jaguar Console System
+// RMAC - Reboot's Macro Assembler for all Atari computers
// OBJECT.C - Writing Object Files
-// Copyright (C) 199x Landon Dyer, 2017 Reboot and Friends
+// Copyright (C) 199x Landon Dyer, 2011-2017 Reboot and Friends
// RMAC derived from MADMAC v1.07 Written by Landon Dyer, 1986
// Source utilised with the kind permission of Landon Dyer
//
#include "object.h"
+#include "6502.h"
+#include "direct.h"
#include "error.h"
#include "mark.h"
#include "riscasm.h"
#include "sect.h"
#include "symbol.h"
-
//#define DEBUG_ELF
uint32_t symsize = 0; // Size of BSD/ELF symbol table
//
-// Add entry to symbol table
+// Add entry to symbol table (in ALCYON mode)
// If 'globflag' is 1, make the symbol global
// If in .PRG mode, adjust symbol values for fake link
//
{
elfHdrNum[ES_TEXT] = shstIndex;
shstTab[ES_TEXT] = shstSize;
- shstSize += DepositELFSHSTEntry(&shstPtr, "TEXT");
+ shstSize += DepositELFSHSTEntry(&shstPtr, ".text");
shstIndex++;
numEntries++;
}
{
elfHdrNum[ES_DATA] = shstIndex;
shstTab[ES_DATA] = shstSize;
- shstSize += DepositELFSHSTEntry(&shstPtr, "DATA");
+ shstSize += DepositELFSHSTEntry(&shstPtr, ".data");
shstIndex++;
numEntries++;
}
{
elfHdrNum[ES_BSS] = shstIndex;
shstTab[ES_BSS] = shstSize;
- shstSize += DepositELFSHSTEntry(&shstPtr, "BSS");
+ shstSize += DepositELFSHSTEntry(&shstPtr, ".bss");
shstIndex++;
numEntries++;
}
// Construct TEXT section, if any
if (sect[TEXT].sloc > 0)
{
- headerSize += DepositELFSectionHeader(headers + headerSize, shstTab[ES_TEXT], 1, 6, 0, elfSize, sect[TEXT].sloc, 0, 0, 2, 0);
+ headerSize += DepositELFSectionHeader(headers + headerSize, shstTab[ES_TEXT], 1, 6, 0, elfSize, sect[TEXT].sloc, 0, 0, largestAlign[0], 0);
for(CHUNK * cp=sect[TEXT].sfcode; cp!=NULL; cp=cp->chnext)
{
// Construct DATA section, if any
if (sect[DATA].sloc > 0)
{
- headerSize += DepositELFSectionHeader(headers + headerSize, shstTab[ES_DATA], 1, 3, 0, elfSize, sect[DATA].sloc, 0, 0, 1, 0);
+ headerSize += DepositELFSectionHeader(headers + headerSize, shstTab[ES_DATA], 1, 3, 0, elfSize, sect[DATA].sloc, 0, 0, largestAlign[1], 0);
for(CHUNK * cp=sect[DATA].sfcode; cp!=NULL; cp=cp->chnext)
{
// Construct BSS section, if any
if (sect[BSS].sloc > 0)
{
- headerSize += DepositELFSectionHeader(headers + headerSize, shstTab[ES_BSS], 8, 3, 0, elfSize, sect[BSS].sloc, 0, 0, 2, 0);
+ headerSize += DepositELFSectionHeader(headers + headerSize, shstTab[ES_BSS], 8, 3, 0, elfSize, sect[BSS].sloc, 0, 0, largestAlign[2], 0);
}
int textrelLoc = headerSize;
free(strtable);
}
}
+ else if (obj_format == XEX)
+ {
+ // Just write the object file
+ m6502obj(fd);
+ }
return 0;
}