+2004-03-08 Danny Smith <dannysmith@users.sourceforge.net>
+
+ * deflex.l: Handle "PRIVATE" string.
+ * defparse.y (%token): Add PRIVATE.
+ (%type): Add opt_PRIVATE.
+ (expline): Pass opt_PRIVATE to def_exports.
+ (opt_PRIVATE): Handle PRIVATE token.
+ * dlltool.h (def_exports): Add 7th param for private flag to
+ declaration.
+ * dlltool.c: Add PRIVATE to comment on EXPORTS syntax.
+ (struct export): Add 'private' field.
+ (def_exports): Set 'private' field of struct exports.
+ (scan_drectve_symbols): Adjust calls to def_exports.
+ (scan_filtered_symbols): Likewise.
+ (dump_def_info): Print 'private' field.
+ (gen_def_file): Likewise.
+ (gen_lib_file): Skip generation of lib object if private.
+ Delete tmp object files in same order as they were generated.
+ Don't delete non-existent private object files.
+
2004-02-27 Andreas Schwab <schwab@suse.de>
* ar.c (main): Support POSIX-compatible argument parsing.
%{/* deflex.l - Lexer for .def files */
-/* Copyright 1995, 1997, 1998, 1999, 2002, 2003 Free Software Foundation, Inc.
+/* Copyright 1995, 1997, 1998, 1999, 2002, 2003, 2004
+ Free Software Foundation, Inc.
-This file is part of GNU Binutils.
+ This file is part of GNU Binutils.
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-/* Contributed by Steve Chamberlain
- sac@cygnus.com
+/* Contributed by Steve Chamberlain: sac@cygnus.com */
-*/
#define DONTDECLARE_MALLOC
#include "libiberty.h"
#include "defparse.h"
"BASE" { return BASE;}
"CONSTANT" { return CONSTANT; }
"NONAME" { return NONAME; }
+"PRIVATE" { return PRIVATE; }
"READ" { return READ;}
"WRITE" { return WRITE;}
"EXECUTE" { return EXECUTE;}
%{ /* defparse.y - parser for .def files */
-/* Copyright 1995, 1997, 1998, 1999 Free Software Foundation, Inc.
+/* Copyright 1995, 1997, 1998, 1999, 2004
+ Free Software Foundation, Inc.
-This file is part of GNU Binutils.
+ This file is part of GNU Binutils.
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "bfd.h"
#include "bucomm.h"
%token NAME, LIBRARY, DESCRIPTION, STACKSIZE, HEAPSIZE, CODE, DATA
%token SECTIONS, EXPORTS, IMPORTS, VERSIONK, BASE, CONSTANT
-%token READ WRITE EXECUTE SHARED NONSHARED NONAME
+%token READ WRITE EXECUTE SHARED NONSHARED NONAME PRIVATE
%token SINGLE MULTIPLE INITINSTANCE INITGLOBAL TERMINSTANCE TERMGLOBAL
%token <id> ID
%token <number> NUMBER
-%type <number> opt_base opt_ordinal opt_NONAME opt_CONSTANT opt_DATA
+%type <number> opt_base opt_ordinal opt_NONAME opt_CONSTANT opt_DATA opt_PRIVATE
%type <number> attr attr_list opt_number
%type <id> opt_name opt_equal_name
;
expline:
- ID opt_equal_name opt_ordinal opt_NONAME opt_CONSTANT opt_DATA
- { def_exports ($1, $2, $3, $4, $5, $6);}
+ ID opt_equal_name opt_ordinal opt_NONAME opt_CONSTANT opt_DATA opt_PRIVATE
+ { def_exports ($1, $2, $3, $4, $5, $6, $7);}
;
implist:
implist impline
| { $$ = 0; }
;
+opt_PRIVATE:
+ PRIVATE { $$ = 1; }
+ | { $$ = 0; }
+ ;
+
opt_name: ID { $$ =$1; }
| ID '.' ID
{
/* dlltool.c -- tool to generate stuff for PE style DLLs
- Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+ Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
Free Software Foundation, Inc.
This file is part of GNU Binutils.
EXPORTS ( ( ( <name1> [ = <name2> ] )
| ( <name1> = <module-name> . <external-name>))
- [ @ <integer> ] [ NONAME ] [CONSTANT] [DATA] ) *
+ [ @ <integer> ] [ NONAME ] [CONSTANT] [DATA] [PRIVATE] ) *
Declares name1 as an exported symbol from the
DLL, with optional ordinal number <integer>.
Or declares name1 as an alias (forward) of the function <external-name>
const char *internal_name;
int ordinal;
int constant;
- int noname;
+ int noname; /* Don't put name in image file. */
+ int private; /* Don't put reference in import lib. */
int data;
int hint;
int forward; /* Number of forward label, 0 means no forward. */
void
def_exports (const char *name, const char *internal_name, int ordinal,
- int noname, int constant, int data)
+ int noname, int constant, int data, int private)
{
struct export *p = (struct export *) xmalloc (sizeof (*p));
p->ordinal = ordinal;
p->constant = constant;
p->noname = noname;
+ p->private = private;
p->data = data;
p->next = d_exports;
d_exports = p;
/* FIXME: The 5th arg is for the `constant' field.
What should it be? Not that it matters since it's not
currently useful. */
- def_exports (c, 0, -1, 0, 0, ! (flags & BSF_FUNCTION));
+ def_exports (c, 0, -1, 0, 0, ! (flags & BSF_FUNCTION), 0);
if (add_stdcall_alias && strchr (c, '@'))
{
char *atsym = strchr (exported_name, '@');
*atsym = '\0';
/* Note: stdcall alias symbols can never be data. */
- def_exports (exported_name, xstrdup (c), -1, 0, 0, 0);
+ def_exports (exported_name, xstrdup (c), -1, 0, 0, 0, 0);
}
}
else
++symbol_name;
def_exports (xstrdup (symbol_name) , 0, -1, 0, 0,
- ! (sym->flags & BSF_FUNCTION));
+ ! (sym->flags & BSF_FUNCTION), 0);
if (add_stdcall_alias && strchr (symbol_name, '@'))
{
char *atsym = strchr (exported_name, '@');
*atsym = '\0';
/* Note: stdcall alias symbols can never be data. */
- def_exports (exported_name, xstrdup (symbol_name), -1, 0, 0, 0);
+ def_exports (exported_name, xstrdup (symbol_name), -1, 0, 0, 0, 0);
}
}
}
fprintf (f, "\n");
for (i = 0, exp = d_exports; exp; i++, exp = exp->next)
{
- fprintf (f, "%s %d = %s %s @ %d %s%s%s\n",
+ fprintf (f, "%s %d = %s %s @ %d %s%s%s%s\n",
ASM_C,
i,
exp->name,
exp->internal_name,
exp->ordinal,
exp->noname ? "NONAME " : "",
+ exp->private ? "PRIVATE " : "",
exp->constant ? "CONSTANT" : "",
exp->data ? "DATA" : "");
}
if (strcmp (exp->name, exp->internal_name) == 0)
{
-
- fprintf (output_def, "\t%s%s%s @ %d%s%s\n",
+ fprintf (output_def, "\t%s%s%s @ %d%s%s%s\n",
quote,
exp->name,
quote,
exp->ordinal,
exp->noname ? " NONAME" : "",
+ exp->private ? "PRIVATE " : "",
exp->data ? " DATA" : "");
}
else
{
- char *quote1 = strchr (exp->internal_name, '.') ? "\"" : "";
+ char * quote1 = strchr (exp->internal_name, '.') ? "\"" : "";
/* char *alias = */
- fprintf (output_def, "\t%s%s%s = %s%s%s @ %d%s%s\n",
+ fprintf (output_def, "\t%s%s%s = %s%s%s @ %d%s%s%s\n",
quote,
exp->name,
quote,
quote1,
exp->ordinal,
exp->noname ? " NONAME" : "",
+ exp->private ? "PRIVATE " : "",
exp->data ? " DATA" : "");
}
}
for (i = 0; (exp = d_exports_lexically[i]); i++)
{
- bfd *n = make_one_lib_file (exp, i);
+ bfd *n;
+ /* Don't add PRIVATE entries to import lib. */
+ if (exp->private)
+ continue;
+ n = make_one_lib_file (exp, i);
n->next = head;
head = n;
}
char *name;
name = (char *) alloca (strlen (TMP_STUB) + 10);
- for (i = 0, exp = d_exports; exp; i++, exp = exp->next)
+ for (i = 0; (exp = d_exports_lexically[i]); i++)
{
+ /* Don't delete non-existent stubs for PRIVATE entries. */
+ if (exp->private)
+ continue;
sprintf (name, "%s%05d.o", TMP_STUB, i);
if (unlink (name) < 0)
/* xgettext:c-format */
inform (_("Created lib file"));
}
-/**********************************************************************/
-
/* Run through the information gathered from the .o files and the
.def file and work out the best stuff. */
+
static int
pfunc (const void *a, const void *b)
{
}
static void
-dtab (export_type **ptr
-#ifndef SACDEBUG
-ATTRIBUTE_UNUSED
-#endif
- )
+dtab (export_type **ptr ATTRIBUTE_UNUSED)
{
#ifdef SACDEBUG
int i;
while (more)
{
-
more = 0;
/* Remove duplicates. */
qsort (d_export_vec, d_nfuncs, sizeof (export_type *), nfunc);
if (strcmp (d_export_vec[i]->name,
d_export_vec[i + 1]->name) == 0)
{
-
export_type *a = d_export_vec[i];
export_type *b = d_export_vec[i + 1];
}
}
-
/* Count the names. */
for (i = 0; i < d_nfuncs; i++)
- {
- if (!d_export_vec[i]->noname)
- d_named_nfuncs++;
- }
+ if (!d_export_vec[i]->noname)
+ d_named_nfuncs++;
}
static void
{
if (d_export_vec[i]->ordinal == -1)
{
- register int j;
+ int j;
/* First try within or after any user supplied range. */
for (j = lowest; j < size; j++)
int i;
int hint = 0;
- export_type **d_export_vec
- = (export_type **) xmalloc (sizeof (export_type *) * d_nfuncs);
+ export_type **d_export_vec = xmalloc (sizeof (export_type *) * d_nfuncs);
inform (_("Processing definitions"));
inform (_("Processed definitions"));
}
-/**********************************************************************/
-
static void
usage (FILE *file, int status)
{
as_flags = optarg;
break;
- /* ignored for compatibility */
+ /* Ignored for compatibility. */
case 'u':
break;
case 'a':
/* dlltool.h -- header file for dlltool
- Copyright 1997, 1998, 2003 Free Software Foundation, Inc.
+ Copyright 1997, 1998, 2003, 2004 Free Software Foundation, Inc.
This file is part of GNU Binutils.
extern void def_code (int);
extern void def_data (int);
extern void def_description (const char *);
-extern void def_exports (const char *, const char *, int, int, int, int);
+extern void def_exports (const char *, const char *, int, int, int, int, int);
extern void def_heapsize (int, int);
extern void def_import
(const char *, const char *, const char *, const char *, int);
extern void def_section (const char *, int);
extern void def_stacksize (int, int);
extern void def_version (int, int);
-extern int yyparse (void);
-extern int yyerror (const char *);
+extern int yyparse (void);
+extern int yyerror (const char *);
+extern int yylex (void);
+
extern int yydebug;
-extern int yylex (void);
extern FILE *yyin;
extern int linenumber;