X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?p=rmac;a=blobdiff_plain;f=object.c;h=522a4d918ce6bacc5d5b0bd0c3805a1867a3dd2c;hp=cbedaab6b0b2cdf5907af53d377a42cb4dc5b8ab;hb=cfd001aea60f54e49d9beae0f941c513f45c202b;hpb=60f204cb9e3905100da0d89f14bb40db764acd9e diff --git a/object.c b/object.c index cbedaab..522a4d9 100644 --- a/object.c +++ b/object.c @@ -1,19 +1,20 @@ // -// 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 @@ -57,7 +58,7 @@ See left. 4 & 5 If these bits are set to 0 (PF_PRIVATE), the processes' // -// 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 // @@ -520,7 +521,7 @@ int WriteObject(int fd) { elfHdrNum[ES_TEXT] = shstIndex; shstTab[ES_TEXT] = shstSize; - shstSize += DepositELFSHSTEntry(&shstPtr, "TEXT"); + shstSize += DepositELFSHSTEntry(&shstPtr, ".text"); shstIndex++; numEntries++; } @@ -529,7 +530,7 @@ int WriteObject(int fd) { elfHdrNum[ES_DATA] = shstIndex; shstTab[ES_DATA] = shstSize; - shstSize += DepositELFSHSTEntry(&shstPtr, "DATA"); + shstSize += DepositELFSHSTEntry(&shstPtr, ".data"); shstIndex++; numEntries++; } @@ -538,7 +539,7 @@ int WriteObject(int fd) { elfHdrNum[ES_BSS] = shstIndex; shstTab[ES_BSS] = shstSize; - shstSize += DepositELFSHSTEntry(&shstPtr, "BSS"); + shstSize += DepositELFSHSTEntry(&shstPtr, ".bss"); shstIndex++; numEntries++; } @@ -619,7 +620,7 @@ for(int j=0; j 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) { @@ -636,7 +637,7 @@ for(int j=0; j 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) { @@ -651,7 +652,7 @@ for(int j=0; j 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; @@ -752,6 +753,11 @@ for(int j=0; j