From 26676ede7d3a0013453ca68145c9b17d99fb8b04 Mon Sep 17 00:00:00 2001 From: Kelvin Sherlock Date: Tue, 2 Jun 2020 23:33:34 -0400 Subject: [PATCH] EXD warning support. --- link.cpp | 17 +++++++++++++++++ link.h | 1 + 2 files changed, 18 insertions(+) diff --git a/link.cpp b/link.cpp index fb48a12..784ad50 100644 --- a/link.cpp +++ b/link.cpp @@ -264,6 +264,8 @@ static void process_labels(byte_view &data, cookie &cookie) { switch (flag & ~0x1f) { case SYMBOL_EXTERNAL: /* map the unit symbol # to a global symbol # */ + if (!(value & 0x8000)) e->exd = true; + value &= 0x7fff; if (cookie.remap.size() < value + 1) cookie.remap.resize(value + 1); @@ -690,6 +692,18 @@ static void print_symbols(void) { } +static void check_exd(void) { + + for (const auto &e : symbol_table) { + + if (!e.exd) continue; + if (!e.defined) continue; + if (e.absolute && e.value < 0x0100) continue; + if (!e.absolute && lkv == 0 && (e.value + org) < 0x0100) continue; + + warnx("%s defined as direct page", e.name.c_str()); + } +} void finish(void) { @@ -712,6 +726,9 @@ void finish(void) { errx(EX_OSERR, "%s: %s", path.c_str(), ex.what()); } + check_exd(); + + /* OP_ENT should print symbols */ print_symbols(); segments.clear(); diff --git a/link.h b/link.h index 1e95937..8c31550 100644 --- a/link.h +++ b/link.h @@ -20,6 +20,7 @@ struct symbol { bool absolute = false; bool defined = false; + bool exd = false; }; /*