mirror of
https://github.com/cc65/cc65.git
synced 2024-12-30 20:29:25 +00:00
Set the "simple" bit in the .o65 mode word only if text, data, and bss
are adjacent.
This commit is contained in:
parent
1e4a7454b6
commit
f7bc6a836d
@ -1320,18 +1320,26 @@ static void O65SetupHeader (O65Desc* D)
|
||||
SegDesc* FirstSeg = D->ZPSeg [0];
|
||||
D->Header.ZPBase = FirstSeg->Seg->PC;
|
||||
}
|
||||
}
|
||||
|
||||
/* If we have byte wise relocation and an alignment of 1, we can set
|
||||
* the "simple addressing" bit in the header.
|
||||
|
||||
|
||||
static void O65UpdateHeader (O65Desc* D)
|
||||
/* Update mode word, currently only the "simple" bit */
|
||||
{
|
||||
/* If we have byte wise relocation and an alignment of 1, and text
|
||||
* and data are adjacent, we can set the "simple addressing" bit
|
||||
* in the header.
|
||||
*/
|
||||
if ((D->Header.Mode & MF_RELOC_MASK) == MF_RELOC_BYTE &&
|
||||
(D->Header.Mode & MF_ALIGN_MASK) == MF_ALIGN_1) {
|
||||
(D->Header.Mode & MF_ALIGN_MASK) == MF_ALIGN_1 &&
|
||||
D->Header.TextBase + D->Header.TextSize == D->Header.DataBase &&
|
||||
D->Header.DataBase + D->Header.DataSize == D->Header.BssBase) {
|
||||
D->Header.Mode = (D->Header.Mode & ~MF_ADDR_MASK) | MF_ADDR_SIMPLE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void O65WriteTarget (O65Desc* D, File* F)
|
||||
/* Write an o65 output file */
|
||||
{
|
||||
@ -1411,6 +1419,9 @@ void O65WriteTarget (O65Desc* D, File* F)
|
||||
/* Write the list of exports */
|
||||
O65WriteExports (D);
|
||||
|
||||
/* Update header flags */
|
||||
O65UpdateHeader (D);
|
||||
|
||||
/* Seek back to the start and write the updated header */
|
||||
fseek (D->F, 0, SEEK_SET);
|
||||
O65WriteHeader (D);
|
||||
|
Loading…
Reference in New Issue
Block a user