Do not give spurious errors about segment alignment.

This would happen if a later object segment had a more restrictive alignment than previous object segments that contribute to the same load segment, as in the following example:

s1      start
        jsl s2
        rtl
        end

        align   256
s2      start
        rtl
        end

These alignment requirements can be satisfied by just giving the load segment the most restrictive alignment of any object segment (since all alignments are powers of 2) and inserting space as necessary to align the code from each object segment.
This commit is contained in:
Stephen Heumann 2021-03-03 18:41:45 -06:00
parent d62fdba4bb
commit aa9a585d19
2 changed files with 17 additions and 11 deletions

View File

@ -10,8 +10,15 @@ Updated 2021
calculation for BRL wraps around within the program bank, it
can branch forward or backward by up to 64 KB (to any location
in the program bank), and the linker now allows this.
(Stephen Heumann)
2. The linker can now link together multiple object segments with
different alignment requirements into a single load segment,
regardless of the order of the object segments. The alignment
of the load segment will be the most restrictive alignment
of any of the object segments, and the alignment requirements
of each object segment will be obeyed. (Previously, an error
would be produced if an object segment processed later had a
more restrictive alignment requirement than an earlier one.)
2.0.5 1. On case-sensitive filesystems (which are not normally used
natively on the Apple IIGS, but may be used through emulation

17
out.asm
View File

@ -385,10 +385,13 @@ or4 anop
ora loadAlign+2
bne la1
move4 segAlign,loadAlign loadAlign = segAlign
bra la2 else
la1 move4 segAlign,r0 PrepareAlign(segAlign)
bra la3 else
la1 cmpl loadAlign,segAlign if loadAlign < segAlign then
bge la2
move4 segAlign,loadAlign loadAlign = segAlign
la2 move4 segAlign,r0 PrepareAlign(segAlign)
jsr PrepareAlign
la2 anop endif
la3 anop endif
bra sa4
;
; Set the load segment alignment (pass 2)
@ -408,13 +411,9 @@ sa0 lda segAlign skip if alignment is 0
bra sa3 else
sa1 cmpl loadAlign,segAlign if loadAlign < segAlign then
bge sa2
ph4 #0 Error(NULL,22)
ph2 #22
jsr Error
bra sa3 else
sa2 move4 segAlign,r0 DefineAlign(segAlign)
move4 segAlign,loadAlign loadAlign = segAlign
sa2 move4 segAlign,r0 DefineAlign(segAlign)
jsr DefineAlign
! anop endif
sa3 anop endif
jsr CheckAlignOrg check for conflicts between align,org
sa4 anop