Implement M8.1 native .lib linking: System V !<arch> parsing (/ symbol index, // long-name table, /N references, even-byte padding, loud malformed/truncated errors), in-memory member objects labelled lib(member), and extraction in the archive's own symbol-table order driven by currently undefined globals, iterated to a fixpoint without re-extracting a member. Duplicate definitions and unresolved references fail with object/member names. Accept archive paths and -l/-lL in the CLI, preserve layout/map/debug behavior, and let scripts/m4/run.sh pass M4_NATIVE_LIBS/M4_NATIVE_RTS archives to tms-link. Relocation addends are now applied as signed 32-bit values (needed by the termtris rts.lib link). Tests: tms-link archive fixtures and real flib extraction, m7 archive/-l parity, m5 native termtris with tms-link+rts.lib (dis34 match), m6 i64/runtime GSPLNK gates, and scripts/tests/m8/native-lib.sh (FLIB.LIB + RTS.LIB, MAME markers, GSPLNK byte/symbol parity).
17 lines
422 B
NASM
17 lines
422 B
NASM
; lib-entry.asm -- M8 native-library gate entry, linked at bit 018A0000.
|
|
;
|
|
; Calls the compiled driver libcheck_test(), which uses flib.lib doubles and
|
|
; rts.lib _isascii. Marker words live at 018A8000 + n*0x20 and are checked by
|
|
; lib-check.lua.
|
|
.text
|
|
.globl _start
|
|
_start:
|
|
setf 16, 1, 0
|
|
setf 32, 0, 1
|
|
movi _cstack, a14
|
|
move a14, a13
|
|
calla _libcheck_test
|
|
rets
|
|
|
|
.bss _cstack, 32768, 16 ; 32768 bits = 4096 bytes
|