unsigned int alignment; /* log-2 alignment. */
} def_file_aligncomm;
+typedef struct def_file_exclude_symbol {
+ struct def_file_exclude_symbol *next; /* Chain pointer. */
+ char *symbol_name; /* Name of excluded symbol. */
+} def_file_exclude_symbol;
+
typedef struct def_file {
/* From the NAME or LIBRARY command. */
char *name;
/* Only expected from .drectve sections, not .DEF files. */
def_file_aligncomm *aligncomms;
+ def_file_exclude_symbol *exclude_symbols;
} def_file;
static void def_version (int, int);
static void def_directive (char *);
static void def_aligncomm (char *str, int align);
+static void def_exclude_symbols (char *str);
static int def_parse (void);
static void def_error (const char *);
static int def_lex (void);
%token NAME LIBRARY DESCRIPTION STACKSIZE_K HEAPSIZE CODE DATAU DATAL
%token SECTIONS EXPORTS IMPORTS VERSIONK BASE CONSTANTU CONSTANTL
-%token PRIVATEU PRIVATEL ALIGNCOMM
+%token PRIVATEU PRIVATEL ALIGNCOMM EXCLUDE_SYMBOLS
%token READ WRITE EXECUTE SHARED_K NONAMEU NONAMEL DIRECTIVE EQUAL
%token <id> ID
%token <digits> DIGITS
%type <number> opt_ordinal
%type <number> attr attr_list opt_number exp_opt_list exp_opt
%type <id> opt_name opt_name2 opt_equal_name anylang_id opt_id
-%type <id> opt_equalequal_name
+%type <id> opt_equalequal_name symbol_list
%type <id_const> keyword_as_name
%%
| VERSIONK NUMBER '.' NUMBER { def_version ($2, $4);}
| DIRECTIVE ID { def_directive ($2);}
| ALIGNCOMM anylang_id ',' NUMBER { def_aligncomm ($2, $4);}
+ | EXCLUDE_SYMBOLS symbol_list
;
}
;
+symbol_list:
+ anylang_id { def_exclude_symbols ($1); }
+ | symbol_list ',' anylang_id { def_exclude_symbols ($3); }
+ ;
+
opt_digits: DIGITS { $$ = $1; }
| { $$ = ""; }
;
free (c);
}
+ while (fdef->exclude_symbols)
+ {
+ def_file_exclude_symbol *e = fdef->exclude_symbols;
+
+ fdef->exclude_symbols = fdef->exclude_symbols->next;
+ free (e->symbol_name);
+ free (e);
+ }
+
free (fdef);
}
{ "-attr", SECTIONS },
{ "-export", EXPORTS },
{ "-aligncomm", ALIGNCOMM },
+ { "-exclude-symbols", EXCLUDE_SYMBOLS },
{ 0, 0 }
};
}
}
+static void
+def_exclude_symbols (char *str)
+{
+ def_file_exclude_symbol *c, *p;
+
+ p = NULL;
+ c = def->exclude_symbols;
+ while (c != NULL)
+ {
+ int e = strcmp (c->symbol_name, str);
+ if (!e)
+ return;
+ c = (p = c)->next;
+ }
+
+ c = xmalloc (sizeof (def_file_exclude_symbol));
+ c->symbol_name = xstrdup (str);
+ if (!p)
+ {
+ c->next = def->exclude_symbols;
+ def->exclude_symbols = c;
+ }
+ else
+ {
+ c->next = p->next;
+ p->next = c;
+ }
+}
+
static void
def_error (const char *err)
{