From 57525d5464ccd2ae273e6f1e636ccf38269b720e Mon Sep 17 00:00:00 2001 From: Kelvin Sherlock Date: Sun, 15 Dec 2019 13:05:41 -0500 Subject: [PATCH] EXT support. 8/16+ added EXT as an operand to import an absolute linker value into the local symbol table. --- link.cpp | 12 ++++++++++++ link.h | 4 ++++ 2 files changed, 16 insertions(+) diff --git a/link.cpp b/link.cpp index d050194..d350467 100644 --- a/link.cpp +++ b/link.cpp @@ -932,6 +932,18 @@ void evaluate(label_t label, opcode_t opcode, const char *cursor) { define(label, number_operand(cursor, local_symbol_table), LBL_GEQ); break; + case OP_EXT: { + /* no label is a no-op. */ + if (label.empty()) break; + + /* otherwise, it imports an absolute label into the local symbol table */ + auto e = find_symbol(label, false); + if (!e || !e->absolute) throw std::runtime_error("Bad address"); + define(label, e->value, LBL_EXT); + + break; + } + case OP_SEG: { /* OMF object file linker - set the object file seg name */ std::string name = label_operand(cursor); diff --git a/link.h b/link.h index 298acfa..1e95937 100644 --- a/link.h +++ b/link.h @@ -36,6 +36,8 @@ c = command file POS n y n LEN n y n + EXT n n y << imports from linker to command + */ enum { LBL_EQU = (1 << 0), @@ -45,6 +47,8 @@ enum { LBL_EQ = (1 << 2), LBL_POS = (1 << 1), LBL_LEN = (1 << 1), + + LBL_EXT = (1 << 2) }; void process_script(const char *argv);