Hi Fatih, On Tue, Nov 10, 2009 at 4:20 PM, Ullrich von Bassewitz <uz@musoftware.de> wrote: > > On Tue, Nov 10, 2009 at 07:15:53AM -0800, Fatih Aygün wrote: >> I have 8 segments: the usual "code", "rodata", "data" ,"bss" plus "init_code", >> "init_rodata", "init_data", "init_bss". The init_* segments are supposed to do >> some lengthy initialization and then they are not needed anymore. I want them >> overlaid with the "bss" segment to save memory, but I don't know its address, >> because it's where the "code" + "rodata" + "data" ends and I don't know their >> sizes. >> >> Is it currently achievable with ld65? > > Just add "define = yes" to the BSS segment in the linker config, and the > linker will export the symbols __BSS_RUN__, __BSS_LOAD__ and __BSS_SIZE__. > > This is true for every other segment as well. If you need the size of the CODE > segment, add "define = yes", and the linker will export __CODE_SIZE__ plus the > others. Maybe you want to check out the Apple2 startup code: When loaded from disk the INIT segment is located where the BSS segment "should be" - simply because there's one contiguous file that is loaded. The startup code first moves INIT above BSS (making sure that an overlap between original and final INIT region is okay). Then the stuff in INIT is called (incl. clearing the BSS). Later on the INIT segment gets (potentially) overwritten by the stack and/or heap. Best, Oliver ---------------------------------------------------------------------- To unsubscribe from the list send mail to majordomo@musoftware.de with the string "unsubscribe cc65" in the body(!) of the mail.Received on Tue Nov 10 16:33:54 2009
This archive was generated by hypermail 2.1.8 : 2009-11-10 16:33:56 CET