1
0
mirror of https://github.com/cc65/cc65.git synced 2025-08-08 06:25:17 +00:00

Mark imports with a special type tag instead of relying on the export pointer

being valid, because the export may not be available if the module was
compiled without debug information.


git-svn-id: svn://svn.cc65.org/cc65/trunk@5201 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
uz
2011-08-18 10:04:01 +00:00
parent 50adbf61f1
commit e53f4fa163
2 changed files with 14 additions and 8 deletions

View File

@@ -3605,6 +3605,7 @@ static void ParseSym (InputData* D)
case TOK_TYPE: case TOK_TYPE:
switch (D->Tok) { switch (D->Tok) {
case TOK_EQUATE: Type = CC65_SYM_EQUATE; break; case TOK_EQUATE: Type = CC65_SYM_EQUATE; break;
case TOK_IMPORT: Type = CC65_SYM_IMPORT; break;
case TOK_LABEL: Type = CC65_SYM_LABEL; break; case TOK_LABEL: Type = CC65_SYM_LABEL; break;
default: default:
ParseError (D, CC65_ERROR, ParseError (D, CC65_ERROR,
@@ -5621,8 +5622,8 @@ const cc65_symbolinfo* cc65_symbol_inrange (cc65_dbginfo Handle, cc65_addr Start
break; break;
} }
/* Ignore non-labels and imports */ /* Ignore non-labels (this will also ignore imports) */
if (Item->Type != CC65_SYM_LABEL || Item->Exp.Info != 0) { if (Item->Type != CC65_SYM_LABEL) {
continue; continue;
} }

View File

@@ -400,17 +400,22 @@ void cc65_free_segmentinfo (cc65_dbginfo handle, const cc65_segmentinfo* info);
typedef enum { typedef enum {
CC65_SYM_EQUATE, CC65_SYM_EQUATE,
CC65_SYM_LABEL, /* Some sort of address */ CC65_SYM_LABEL, /* Some sort of address */
CC65_SYM_IMPORT, /* An import */
} cc65_symbol_type; } cc65_symbol_type;
/* Notes: /* Notes:
* - If the symbol is segment relative, the segment id gives segment * - If the symbol is segment relative, the segment id gives segment
* information, otherwise it contains CC65_INV_ID. * information, otherwise it contains CC65_INV_ID.
* - If export_id is valid (not CC65_INV_ID), the symbol is an import and * - If the type is CC65_SYM_IMPORT, export_id may contain the id of the
* export_id allows to retrieve the corresponding export. The fields * export. This is not the case if the module contaiing the export doesn't
* symbol_value and segment_id are taken from the export, since imports * have debug information.
* have no value or segments by itself. symbol_type and symbol_size are * - For an import, the fields symbol_value and segment_id are taken from
* more or less unusable because they don't have a meaning for imports. * the export, if it is available, since imports have no value or segments
* - For normal symbols (not cheap locals) parent_id contains CC65_INV_ID. * by itself.
* - For an import symbol_type and symbol_size are more or less unusable
* because they don't have a meaning for imports.
* - For normal symbols (not cheap locals) parent_id contains CC65_INV_ID,
* for cheap locals it contains the symbol id of the parent symbol.
*/ */
typedef struct cc65_symboldata cc65_symboldata; typedef struct cc65_symboldata cc65_symboldata;
struct cc65_symboldata { struct cc65_symboldata {