From 5cb1bc60fc6079f5fb8ea6c00299671c2d77daeb Mon Sep 17 00:00:00 2001 From: Christian Groessler Date: Wed, 9 Apr 2025 22:51:11 +0200 Subject: [PATCH] Add 'define=yes' for INIT segment to atari-asm.cfg and atari-asm-xex.cfg linker configs. libsrc/atari/exehdr.s: Add (empty) INIT segment to cover assembler programs which link with exehdr.s. --- cfg/atari-asm-xex.cfg | 1 + cfg/atari-asm.cfg | 1 + libsrc/atari/exehdr.s | 4 ++++ 3 files changed, 6 insertions(+) diff --git a/cfg/atari-asm-xex.cfg b/cfg/atari-asm-xex.cfg index f0a6291db..fddf95dd4 100644 --- a/cfg/atari-asm-xex.cfg +++ b/cfg/atari-asm-xex.cfg @@ -20,5 +20,6 @@ SEGMENTS { CODE: load = MAIN, type = rw, define = yes; RODATA: load = MAIN, type = ro optional = yes; DATA: load = MAIN, type = rw optional = yes; + INIT: load = MAIN, type = bss, optional = yes, define = yes; BSS: load = MAIN, type = bss, optional = yes, define = yes; } diff --git a/cfg/atari-asm.cfg b/cfg/atari-asm.cfg index 6fc1c2caa..f824eb264 100644 --- a/cfg/atari-asm.cfg +++ b/cfg/atari-asm.cfg @@ -25,6 +25,7 @@ SEGMENTS { CODE: load = MAIN, type = rw, define = yes; RODATA: load = MAIN, type = ro optional = yes; DATA: load = MAIN, type = rw optional = yes; + INIT: load = MAIN, type = bss, optional = yes, define = yes; BSS: load = MAIN, type = bss, optional = yes, define = yes; AUTOSTRT: load = TRAILER, type = ro, optional = yes; } diff --git a/libsrc/atari/exehdr.s b/libsrc/atari/exehdr.s index fe17aeafd..1ac9a0fbe 100644 --- a/libsrc/atari/exehdr.s +++ b/libsrc/atari/exehdr.s @@ -9,3 +9,7 @@ .segment "MAINHDR" .word __MAIN_START__ .word __INIT_LOAD__ - 1 + +; Define the INIT segment so that __INIT_LOAD__ from above '.import' is always defined. +; The segment is normally present when linking a C program, but not necessarily when linking an assembler program. +.segment "INIT"