Re[2]: [cc65] Bug Hunting Odysee

Date view Thread view Subject view

From: groepaz (groepaz_at_gmx.net)
Date: 2002-07-17 01:02:29


Hello Ullrich,

Wednesday, July 17, 2002, 12:44:19 AM, you wrote:

UvB> What if two align commands may not be combined because they are contrary to
UvB> each other like this:

UvB> module1.s:
UvB> --------------------
UvB> Label1: .align  2
UvB>         .byte   0
UvB> --------------------

UvB> module2.s:
UvB> --------------------
UvB> Label2: .align  2
UvB>         .byte   0
UvB> --------------------

UvB> If both are bound together by the linker, either Label1 or Label2 is on an odd
UvB> address if the assembler does not insert any alignment bytes. Assuming that
UvB> the program starts at an even address does not help does, and moving the code
UvB> at runtime does not help either.

if starts on even adress:

label1:   .byte 0
          .byte fill
label2:   .byte 0

if starts on odd adress:

          .byte fill
label1:   .byte 0
          .byte fill
label2:   .byte 0

>> Maybe I missed the point of the problem, or left out some thoughts.

UvB> It is not really a problem, I was just hoping that groepaz complaint about
UvB> .align meant that he had a better solution than the current one. It is of
UvB> course possible to use .align if the program itself starts at an address
UvB> aligned to align-value, and the linker will even warn you if this condition is
UvB> not satisfied. However, code on the C64 starts at $801, so the prerequisites
UvB> for using .align are not there.

well sorry, i still dont get it :=P from my understanding, when i
write .align <something> somewhere in my code, the linker should be
able to put the symbol at a properly aligned adress (no matter where
the binary starts, that argument is funny really :=P as if you couldnt
calculate offsets from an odd adress :=)). it is ofcoz another
question how the linker solves that task, but its for sure no real
problem to implement. gcc's linker does it by simply inserting
padding-bytes for eg (and keeps wasted memory low by certain options
for sorting symbols). however in a 6510 environment there wont be to
many cases where you'd use .align in a way like that anyway, so wasted
memory shouldnt be much of an issue. much less than occasional bugs
caused by wrong alignment atleast ;=P

and however, the original cause for my complaint is a _classic_ case
where you'd use the .align feature of an assembler. really, if its not
useable for this (or only under limitations) its not quite useful at
all IMHO.

-- 
Best regards,
 groepaz                            mailto:groepaz_at_gmx.net


----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo_at_musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.


Date view Thread view Subject view

This archive was generated by hypermail 2.1.3 : 2002-07-17 01:02:46 CEST