+2003-06-28 Alan Modra <amodra@bigpond.net.au>
+
+ * ld.h: Convert to C90, remove unnecessary prototypes and casts.
+ Replace PTR with void *. Formatting.
+ * ldcref.c: Likewise.
+ * ldctor.c: Likewise.
+ * ldctor.h: Likewise.
+ * ldemul.h: Likewise.
+ * ldexp.c: Likewise.
+ * ldexp.h: Likewise.
+ * ldfile.c: Likewise.
+ * ldfile.h: Likewise.
+ * ldlang.c: Likewise.
+ * ldlang.h: Likewise.
+ * ldlex.h: Likewise.
+ * ldlex.l: Likewise.
+ * ldmain.c: Likewise.
+ * ldmain.h: Likewise.
+ * ldmisc.c: Likewise.
+ * ldmisc.h: Likewise.
+ * ldver.h: Likewise.
+ * ldwrite.c: Likewise.
+ * ldwrite.h: Likewise.
+ * lexsup.c: Likewise.
+ * mri.c: Likewise.
+ * mri.h: Likewise.
+ * pe-dll.c: Likewise.
+ * pe-dll.h: Likewise.
+ * deffilep.y: Likewise.
+ * deffile.h: Likewise. Don't include ansidecl.h.
+ * emulparams/elf32mcore.sh: Remove unnecessary cast.
+ * emultempl/m68kcoff.em: Likewise.
+ * emultempl/m68kelf.em: Likewise.
+ * emultempl/ticoff.em: Remove lang_add_output_format declaration.
+ * sysdep.h: Don't include ansidecl.h.
+ * Makefile.am: Run "make dep-am".
+ * Makefile.in: Regenerate.
+
2003-06-27 Nick Clifton <nickc@redhat.com>
* deffilep.y (def_file_add_directive): Cope with NUL seperated
* emultempl/aix.em: Convert to C90, remove unnecessary prototypes
and casts. Replace PTR with void *. Formatting.
- * emultempl/alphaelf.em: Likewise
- * emultempl/armcoff.em: Likewise
- * emultempl/armelf.em: Likewise
- * emultempl/armelf_oabi.em: Likewise
- * emultempl/beos.em: Likewise
- * emultempl/elf32.em: Likewise
- * emultempl/generic.em: Likewise
- * emultempl/gld960.em: Likewise
- * emultempl/gld960c.em: Likewise
- * emultempl/hppaelf.em: Likewise
- * emultempl/linux.em: Likewise
- * emultempl/lnk960.em: Likewise
- * emultempl/m68hc1xelf.em: Likewise
- * emultempl/m68kcoff.em: Likewise
- * emultempl/m68kelf.em: Likewise
- * emultempl/mipsecoff.em: Likewise
- * emultempl/mipself.em: Likewise
- * emultempl/mmix-elfnmmo.em: Likewise
- * emultempl/mmixelf.em: Likewise
- * emultempl/mmo.em: Likewise
- * emultempl/needrelax.em: Likewise
- * emultempl/netbsd.em: Likewise
- * emultempl/pe.em: Likewise
- * emultempl/sh64elf.em: Likewise
- * emultempl/sunos.em: Likewise
- * emultempl/ticoff.em: Likewise
- * emultempl/vanilla.em: Likewise
- * emultempl/xtensaelf.em: Likewise
+ * emultempl/alphaelf.em: Likewise.
+ * emultempl/armcoff.em: Likewise.
+ * emultempl/armelf.em: Likewise.
+ * emultempl/armelf_oabi.em: Likewise.
+ * emultempl/beos.em: Likewise.
+ * emultempl/elf32.em: Likewise.
+ * emultempl/generic.em: Likewise.
+ * emultempl/gld960.em: Likewise.
+ * emultempl/gld960c.em: Likewise.
+ * emultempl/hppaelf.em: Likewise.
+ * emultempl/linux.em: Likewise.
+ * emultempl/lnk960.em: Likewise.
+ * emultempl/m68hc1xelf.em: Likewise.
+ * emultempl/m68kcoff.em: Likewise.
+ * emultempl/m68kelf.em: Likewise.
+ * emultempl/mipsecoff.em: Likewise.
+ * emultempl/mipself.em: Likewise.
+ * emultempl/mmix-elfnmmo.em: Likewise.
+ * emultempl/mmixelf.em: Likewise.
+ * emultempl/mmo.em: Likewise.
+ * emultempl/needrelax.em: Likewise.
+ * emultempl/netbsd.em: Likewise.
+ * emultempl/pe.em: Likewise.
+ * emultempl/sh64elf.em: Likewise.
+ * emultempl/sunos.em: Likewise.
+ * emultempl/ticoff.em: Likewise.
+ * emultempl/vanilla.em: Likewise.
+ * emultempl/xtensaelf.em: Likewise.
* Makefile.am: Correct dependencies.
* Makefile.in: Regenerate.
2003-06-25 Alan Modra <amodra@bigpond.net.au>
* ld.texinfo: Correct spelling of "relocatable".
- * ldctor.c: Likewise
- * ldexp.c: Likewise
- * ldfile.c: Likewise
- * ldint.texinfo: Likewise
- * ldlang.c: Likewise
- * ldmain.c: Likewise
- * ldwrite.c: Likewise
- * lexsup.c: Likewise
- * emultempl/aix.em: Likewise
- * emultempl/alphaelf.em: Likewise
- * emultempl/armcoff.em: Likewise
- * emultempl/armelf_oabi.em: Likewise
- * emultempl/beos.em: Likewise
- * emultempl/elf32.em: Likewise
- * emultempl/generic.em: Likewise
- * emultempl/gld960.em: Likewise
- * emultempl/gld960c.em: Likewise
- * emultempl/hppaelf.em: Likewise
- * emultempl/linux.em: Likewise
- * emultempl/lnk960.em: Likewise
- * emultempl/m68hc1xelf.em: Likewise
- * emultempl/m68kcoff.em: Likewise
- * emultempl/m68kelf.em: Likewise
- * emultempl/mipsecoff.em: Likewise
- * emultempl/mipself.em: Likewise
- * emultempl/mmix-elfnmmo.em: Likewise
- * emultempl/mmo.em: Likewise
- * emultempl/needrelax.em: Likewise
- * emultempl/pe.em: Likewise
- * emultempl/ppc64elf.em: Likewise
- * emultempl/sh64elf.em: Likewise
- * emultempl/sunos.em: Likewise
- * emultempl/ticoff.em: Likewise
- * emultempl/xtensaelf.em: Likewise
+ * ldctor.c: Likewise.
+ * ldexp.c: Likewise.
+ * ldfile.c: Likewise.
+ * ldint.texinfo: Likewise.
+ * ldlang.c: Likewise.
+ * ldmain.c: Likewise.
+ * ldwrite.c: Likewise.
+ * lexsup.c: Likewise.
+ * emultempl/aix.em: Likewise.
+ * emultempl/alphaelf.em: Likewise.
+ * emultempl/armcoff.em: Likewise.
+ * emultempl/armelf_oabi.em: Likewise.
+ * emultempl/beos.em: Likewise.
+ * emultempl/elf32.em: Likewise.
+ * emultempl/generic.em: Likewise.
+ * emultempl/gld960.em: Likewise.
+ * emultempl/gld960c.em: Likewise.
+ * emultempl/hppaelf.em: Likewise.
+ * emultempl/linux.em: Likewise.
+ * emultempl/lnk960.em: Likewise.
+ * emultempl/m68hc1xelf.em: Likewise.
+ * emultempl/m68kcoff.em: Likewise.
+ * emultempl/m68kelf.em: Likewise.
+ * emultempl/mipsecoff.em: Likewise.
+ * emultempl/mipself.em: Likewise.
+ * emultempl/mmix-elfnmmo.em: Likewise.
+ * emultempl/mmo.em: Likewise.
+ * emultempl/needrelax.em: Likewise.
+ * emultempl/pe.em: Likewise.
+ * emultempl/ppc64elf.em: Likewise.
+ * emultempl/sh64elf.em: Likewise.
+ * emultempl/sunos.em: Likewise.
+ * emultempl/ticoff.em: Likewise.
+ * emultempl/xtensaelf.em: Likewise.
2003-06-24 Alan Modra <amodra@bigpond.net.au>
* scripttempl/elfi370.sc (OTHER_READONLY_SECTIONS): Likewise.
(OTHER_READWRITE_SECTIONS): Likewise.
* scripttempl/nw.sc (OTHER_READONLY_SECTIONS): Likewise.
- (OTHER_READWRITE_SECTIONS): Likewise
+ (OTHER_READWRITE_SECTIONS): Likewise.
* emulparams/armelf.sh (OTHER_RELOCATING_SECTIONS): Delete.
(STACK_ADDR): Define.
$(INCDIR)/bfdlink.h ld.h $(INCDIR)/bin-bugs.h ldexp.h \
ldver.h ldlang.h ldfile.h ldemul.h ldmisc.h ldmain.h \
mri.h ldctor.h ldlex.h
-ldlex.o: ldlex.c $(INCDIR)/ansidecl.h ../bfd/bfd.h \
+ldlex.o: ldlex.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
$(INCDIR)/symcat.h sysdep.h config.h $(INCDIR)/fopen-same.h \
$(INCDIR)/safe-ctype.h $(INCDIR)/bfdlink.h ld.h $(INCDIR)/bin-bugs.h \
ldmisc.h ldexp.h ldlang.h ldgram.h ldfile.h ldlex.h \
$(INCDIR)/bfdlink.h ld.h $(INCDIR)/bin-bugs.h ldexp.h \
ldver.h ldlang.h ldfile.h ldemul.h ldmisc.h ldmain.h \
mri.h ldctor.h ldlex.h
-ldlex.o: ldlex.c $(INCDIR)/ansidecl.h ../bfd/bfd.h \
+ldlex.o: ldlex.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
$(INCDIR)/symcat.h sysdep.h config.h $(INCDIR)/fopen-same.h \
$(INCDIR)/safe-ctype.h $(INCDIR)/bfdlink.h ld.h $(INCDIR)/bin-bugs.h \
ldmisc.h ldexp.h ldlang.h ldgram.h ldfile.h ldlex.h \
#ifndef DEFFILE_H
#define DEFFILE_H
-#include "ansidecl.h"
-
/* DEF storage definitions. Note that any ordinal may be zero, and
any pointer may be NULL, if not defined by the DEF file. */
int version_major, version_minor;
} def_file;
-extern def_file *def_file_empty PARAMS ((void));
+extern def_file *def_file_empty (void);
/* The second arg may be NULL. If not, this .def is appended to it. */
-extern def_file * def_file_parse
- PARAMS ((const char *, def_file *));
-extern void def_file_free
- PARAMS ((def_file *));
-extern def_file_export * def_file_add_export
- PARAMS ((def_file *, const char *, const char *, int));
-extern def_file_import * def_file_add_import
- PARAMS ((def_file *, const char *, const char *, int, const char *));
-extern void def_file_add_directive
- PARAMS ((def_file *, const char *, int));
-extern def_file_module *def_get_module
- PARAMS ((def_file *, const char *));
+extern def_file *def_file_parse (const char *, def_file *);
+extern void def_file_free (def_file *);
+extern def_file_export *def_file_add_export (def_file *, const char *,
+ const char *, int);
+extern def_file_import *def_file_add_import (def_file *, const char *,
+ const char *, int, const char *);
+extern void def_file_add_directive (def_file *, const char *, int);
+extern def_file_module *def_get_module (def_file *, const char *);
#ifdef DEF_FILE_PRINT
-extern void def_file_print
- PARAMS ((FILE *, def_file *));
+extern void def_file_print (FILE *, def_file *);
#endif
#endif /* DEFFILE_H */
#define yytable def_yytable
#define yycheck def_yycheck
-static void def_description PARAMS ((const char *));
-static void def_exports PARAMS ((const char *, const char *, int, int));
-static void def_heapsize PARAMS ((int, int));
-static void def_import PARAMS ((const char *, const char *, const char *, const char *, int));
-static void def_library PARAMS ((const char *, int));
-static def_file_module *def_stash_module PARAMS ((def_file *, const char *));
-static void def_name PARAMS ((const char *, int));
-static void def_section PARAMS ((const char *, int));
-static void def_section_alt PARAMS ((const char *, const char *));
-static void def_stacksize PARAMS ((int, int));
-static void def_version PARAMS ((int, int));
-static void def_directive PARAMS ((char *));
-static int def_parse PARAMS ((void));
-static int def_error PARAMS ((const char *));
-static void put_buf PARAMS ((char));
-static int def_getc PARAMS ((void));
-static int def_ungetc PARAMS ((int));
-static int def_lex PARAMS ((void));
+static void def_description (const char *);
+static void def_exports (const char *, const char *, int, int);
+static void def_heapsize (int, int);
+static void def_import (const char *, const char *, const char *, const char *,
+ int);
+static void def_library (const char *, int);
+static void def_name (const char *, int);
+static void def_section (const char *, int);
+static void def_section_alt (const char *, const char *);
+static void def_stacksize (int, int);
+static void def_version (int, int);
+static void def_directive (char *);
+static int def_parse (void);
+static int def_error (const char *);
+static int def_lex (void);
static int lex_forced_token = 0;
static const char *lex_parse_string = 0;
opt_name: ID { $$ = $1; }
| ID '.' ID
{
- char * name = xmalloc (strlen ($1) + 1 + strlen ($3) + 1);
+ char *name = xmalloc (strlen ($1) + 1 + strlen ($3) + 1);
sprintf (name, "%s.%s", $1, $3);
$$ = name;
}
dot_name: ID { $$ = $1; }
| dot_name '.' ID
{
- char * name = xmalloc (strlen ($1) + 1 + strlen ($3) + 1);
+ char *name = xmalloc (strlen ($1) + 1 + strlen ($3) + 1);
sprintf (name, "%s.%s", $1, $3);
$$ = name;
}
static struct directive *directives = 0;
def_file *
-def_file_empty ()
+def_file_empty (void)
{
- def_file *rv = (def_file *) xmalloc (sizeof (def_file));
+ def_file *rv = xmalloc (sizeof (def_file));
memset (rv, 0, sizeof (def_file));
rv->is_dll = -1;
- rv->base_address = (bfd_vma) (-1);
+ rv->base_address = (bfd_vma) -1;
rv->stack_reserve = rv->stack_commit = -1;
rv->heap_reserve = rv->heap_commit = -1;
rv->version_major = rv->version_minor = -1;
}
def_file *
-def_file_parse (filename, add_to)
- const char *filename;
- def_file *add_to;
+def_file_parse (const char *filename, def_file *add_to)
{
struct directive *d;
}
void
-def_file_free (def)
- def_file *def;
+def_file_free (def_file *def)
{
int i;
#ifdef DEF_FILE_PRINT
void
-def_file_print (file, def)
- FILE *file;
- def_file *def;
+def_file_print (FILE *file, def_file *def)
{
int i;
fprintf (file, " name: %s\n", def->name ? def->name : "(unspecified)");
if (def->is_dll != -1)
fprintf (file, " is dll: %s\n", def->is_dll ? "yes" : "no");
- if (def->base_address != (bfd_vma) (-1))
+ if (def->base_address != (bfd_vma) -1)
fprintf (file, " base address: 0x%08x\n", def->base_address);
if (def->description)
fprintf (file, " description: `%s'\n", def->description);
#endif
def_file_export *
-def_file_add_export (def, external_name, internal_name, ordinal)
- def_file *def;
- const char *external_name;
- const char *internal_name;
- int ordinal;
+def_file_add_export (def_file *def,
+ const char *external_name,
+ const char *internal_name,
+ int ordinal)
{
def_file_export *e;
int max_exports = ROUND_UP(def->num_exports, 32);
{
max_exports = ROUND_UP(def->num_exports + 1, 32);
if (def->exports)
- def->exports = (def_file_export *)
- xrealloc (def->exports, max_exports * sizeof (def_file_export));
+ def->exports = xrealloc (def->exports,
+ max_exports * sizeof (def_file_export));
else
- def->exports = (def_file_export *)
- xmalloc (max_exports * sizeof (def_file_export));
+ def->exports = xmalloc (max_exports * sizeof (def_file_export));
}
e = def->exports + def->num_exports;
memset (e, 0, sizeof (def_file_export));
}
def_file_module *
-def_get_module (def, name)
- def_file *def;
- const char *name;
+def_get_module (def_file *def, const char *name)
{
def_file_module *s;
if (strcmp (s->name, name) == 0)
return s;
- return (def_file_module *) 0;
+ return NULL;
}
static def_file_module *
-def_stash_module (def, name)
- def_file *def;
- const char *name;
+def_stash_module (def_file *def, const char *name)
{
def_file_module *s;
- if ((s = def_get_module (def, name)) != (def_file_module *) 0)
+ if ((s = def_get_module (def, name)) != NULL)
return s;
- s = (def_file_module *) xmalloc (sizeof (def_file_module) + strlen (name));
+ s = xmalloc (sizeof (def_file_module) + strlen (name));
s->next = def->modules;
def->modules = s;
s->user_data = 0;
}
def_file_import *
-def_file_add_import (def, name, module, ordinal, internal_name)
- def_file *def;
- const char *name;
- const char *module;
- int ordinal;
- const char *internal_name;
+def_file_add_import (def_file *def,
+ const char *name,
+ const char *module,
+ int ordinal,
+ const char *internal_name)
{
def_file_import *i;
- int max_imports = ROUND_UP(def->num_imports, 16);
+ int max_imports = ROUND_UP (def->num_imports, 16);
if (def->num_imports >= max_imports)
{
- max_imports = ROUND_UP(def->num_imports+1, 16);
+ max_imports = ROUND_UP (def->num_imports+1, 16);
if (def->imports)
- def->imports = (def_file_import *)
- xrealloc (def->imports, max_imports * sizeof (def_file_import));
+ def->imports = xrealloc (def->imports,
+ max_imports * sizeof (def_file_import));
else
- def->imports = (def_file_import *)
- xmalloc (max_imports * sizeof (def_file_import));
+ def->imports = xmalloc (max_imports * sizeof (def_file_import));
}
i = def->imports + def->num_imports;
memset (i, 0, sizeof (def_file_import));
};
void
-def_file_add_directive (my_def, param, len)
- def_file *my_def;
- const char *param;
- int len;
+def_file_add_directive (def_file *my_def, const char *param, int len)
{
def_file *save_def = def;
const char *pend = param + len;
while (param < pend)
{
- while (param < pend && (ISSPACE (*param) || * param == '\n' || * param == 0))
+ while (param < pend
+ && (ISSPACE (*param) || *param == '\n' || *param == 0))
param++;
if (param == pend)
- a newline seperating options
- a NUL seperating options. */
for (tend = (char *) (param + 1);
- tend < pend && !(ISSPACE (tend[-1]) && *tend == '-') && (*tend != '\n') && (*tend != 0);
+ (tend < pend
+ && !(ISSPACE (tend[-1]) && *tend == '-')
+ && *tend != '\n' && *tend != 0);
tend++)
;
/* Parser Callbacks. */
static void
-def_name (name, base)
- const char *name;
- int base;
+def_name (const char *name, int base)
{
if (def->name)
free (def->name);
}
static void
-def_library (name, base)
- const char *name;
- int base;
+def_library (const char *name, int base)
{
if (def->name)
free (def->name);
}
static void
-def_description (text)
- const char *text;
+def_description (const char *text)
{
int len = def->description ? strlen (def->description) : 0;
len += strlen (text) + 1;
if (def->description)
{
- def->description = (char *) xrealloc (def->description, len);
+ def->description = xrealloc (def->description, len);
strcat (def->description, text);
}
else
{
- def->description = (char *) xmalloc (len);
+ def->description = xmalloc (len);
strcpy (def->description, text);
}
}
static void
-def_stacksize (reserve, commit)
- int reserve;
- int commit;
+def_stacksize (int reserve, int commit)
{
def->stack_reserve = reserve;
def->stack_commit = commit;
}
static void
-def_heapsize (reserve, commit)
- int reserve;
- int commit;
+def_heapsize (int reserve, int commit)
{
def->heap_reserve = reserve;
def->heap_commit = commit;
}
static void
-def_section (name, attr)
- const char *name;
- int attr;
+def_section (const char *name, int attr)
{
def_file_section *s;
- int max_sections = ROUND_UP(def->num_section_defs, 4);
+ int max_sections = ROUND_UP (def->num_section_defs, 4);
if (def->num_section_defs >= max_sections)
{
- max_sections = ROUND_UP(def->num_section_defs+1, 4);
+ max_sections = ROUND_UP (def->num_section_defs+1, 4);
if (def->section_defs)
- def->section_defs = (def_file_section *) xrealloc (def->section_defs, max_sections * sizeof (def_file_import));
+ def->section_defs = xrealloc (def->section_defs,
+ max_sections * sizeof (def_file_import));
else
- def->section_defs = (def_file_section *) xmalloc (max_sections * sizeof (def_file_import));
+ def->section_defs = xmalloc (max_sections * sizeof (def_file_import));
}
s = def->section_defs + def->num_section_defs;
memset (s, 0, sizeof (def_file_section));
}
static void
-def_section_alt (name, attr)
- const char *name;
- const char *attr;
+def_section_alt (const char *name, const char *attr)
{
int aval = 0;
}
static void
-def_exports (external_name, internal_name, ordinal, flags)
- const char *external_name;
- const char *internal_name;
- int ordinal;
- int flags;
+def_exports (const char *external_name,
+ const char *internal_name,
+ int ordinal,
+ int flags)
{
def_file_export *dfe;
}
static void
-def_import (internal_name, module, dllext, name, ordinal)
- const char *internal_name;
- const char *module;
- const char *dllext;
- const char *name;
- int ordinal;
+def_import (const char *internal_name,
+ const char *module,
+ const char *dllext,
+ const char *name,
+ int ordinal)
{
char *buf = 0;
const char *ext = dllext ? dllext : "dll";
- buf = (char *) xmalloc (strlen (module) + strlen (ext) + 2);
+ buf = xmalloc (strlen (module) + strlen (ext) + 2);
sprintf (buf, "%s.%s", module, ext);
module = buf;
}
static void
-def_version (major, minor)
- int major;
- int minor;
+def_version (int major, int minor)
{
def->version_major = major;
def->version_minor = minor;
}
static void
-def_directive (str)
- char *str;
+def_directive (char *str)
{
- struct directive *d = (struct directive *) xmalloc (sizeof (struct directive));
+ struct directive *d = xmalloc (sizeof (struct directive));
d->next = directives;
directives = d;
}
static int
-def_error (err)
- const char *err;
+def_error (const char *err)
{
- einfo ("%P: %s:%d: %s\n", def_filename ? def_filename : "<unknown-file>", linenumber, err);
-
+ einfo ("%P: %s:%d: %s\n",
+ def_filename ? def_filename : "<unknown-file>", linenumber, err);
return 0;
}
static int bufptr = 0;
static void
-put_buf (c)
- char c;
+put_buf (char c)
{
if (bufptr == buflen)
{
buflen += 50; /* overly reasonable, eh? */
if (buffer)
- buffer = (char *) xrealloc (buffer, buflen + 1);
+ buffer = xrealloc (buffer, buflen + 1);
else
- buffer = (char *) xmalloc (buflen + 1);
+ buffer = xmalloc (buflen + 1);
}
buffer[bufptr++] = c;
buffer[bufptr] = 0; /* not optimal, but very convenient. */
};
static int
-def_getc ()
+def_getc (void)
{
int rv;
}
static int
-def_ungetc (c)
- int c;
+def_ungetc (int c)
{
if (lex_parse_string)
{
}
static int
-def_lex ()
+def_lex (void)
{
int c, i, q;
PARSE_AND_LIST_ARGS_CASES='
case OPTION_BASE_FILE:
- link_info.base_file = (PTR) fopen (optarg, FOPEN_WB);
+ link_info.base_file = fopen (optarg, FOPEN_WB);
if (link_info.base_file == NULL)
{
/* xgettext:c-format */
/* Double check that all other data sections are empty, as is
required for embedded PIC code. */
- bfd_map_over_sections (abfd, check_sections, (PTR) datasec);
+ bfd_map_over_sections (abfd, check_sections, datasec);
}
}
/* Double check that all other data sections are empty, as is
required for embedded PIC code. */
- bfd_map_over_sections (abfd, check_sections, (PTR) datasec);
+ bfd_map_over_sections (abfd, check_sections, datasec);
}
}
#endif /* SUPPORT_EMBEDDED_RELOCS */
relocs. This is called via bfd_map_over_sections. */
static void
-check_sections (bfd *abfd, asection *sec, PTR datasec)
+check_sections (bfd *abfd, asection *sec, void *datasec)
{
if ((bfd_get_section_flags (abfd, sec) & SEC_DATA)
- && sec != (asection *) datasec
+ && sec != datasec
&& sec->reloc_count != 0)
einfo ("%B%X: section %s has relocs; can not use --embedded-relocs\n",
abfd, bfd_get_section_name (abfd, sec));
if ((*optarg == '0' || *optarg == '1' || *optarg == '2')
&& optarg[1] == '\0')
{
- extern void lang_add_output_format
- PARAMS ((const char *, const char *, const char *, int));
static char buf[] = "coffX-${OUTPUT_FORMAT_TEMPLATE}";
coff_version = *optarg - '0';
buf[4] = *optarg;
/* Non-zero if we are processing a --defsym from the command line. */
extern int parsing_defsym;
-extern int yyparse PARAMS ((void));
-
-extern void add_cref PARAMS ((const char *, bfd *, asection *, bfd_vma));
-extern void output_cref PARAMS ((FILE *));
-extern void check_nocrossrefs PARAMS ((void));
-
-extern void ld_abort PARAMS ((const char *, int, const char *))
- ATTRIBUTE_NORETURN;
+extern int yyparse (void);
+extern void add_cref (const char *, bfd *, asection *, bfd_vma);
+extern void output_cref (FILE *);
+extern void check_nocrossrefs (void);
+extern void ld_abort (const char *, int, const char *) ATTRIBUTE_NORETURN;
/* If gcc >= 2.6, we can give a function name, too. */
#if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 6)
-#define __PRETTY_FUNCTION__ ((char*) NULL)
+#define __PRETTY_FUNCTION__ NULL
#endif
#undef abort
/* ldcref.c -- output a cross reference table
- Copyright 1996, 1997, 1998, 2000, 2002 Free Software Foundation, Inc.
+ Copyright 1996, 1997, 1998, 2000, 2002, 2003
+ Free Software Foundation, Inc.
Written by Ian Lance Taylor <ian@cygnus.com>
This file is part of GLD, the Gnu Linker.
struct bfd_hash_table root;
};
-/* Local functions. */
+/* Forward declarations. */
-static struct bfd_hash_entry *cref_hash_newfunc
- PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
-static bfd_boolean cref_fill_array PARAMS ((struct cref_hash_entry *, PTR));
-static int cref_sort_array PARAMS ((const PTR, const PTR));
-static void output_one_cref PARAMS ((FILE *, struct cref_hash_entry *));
-static bfd_boolean check_nocrossref PARAMS ((struct cref_hash_entry *, PTR));
-static void check_section_sym_xref PARAMS ((lang_input_statement_type *));
-static void check_refs
- PARAMS ((const char *, asection *, bfd *, struct lang_nocrossrefs *));
-static void check_reloc_refs PARAMS ((bfd *, asection *, PTR));
+static void output_one_cref (FILE *, struct cref_hash_entry *);
+static void check_section_sym_xref (lang_input_statement_type *);
+static bfd_boolean check_nocrossref (struct cref_hash_entry *, void *);
+static void check_refs (const char *, asection *, bfd *,
+ struct lang_nocrossrefs *);
+static void check_reloc_refs (bfd *, asection *, void *);
/* Look up an entry in the cref hash table. */
#define cref_hash_traverse(table, func, info) \
(bfd_hash_traverse \
(&(table)->root, \
- (bfd_boolean (*) PARAMS ((struct bfd_hash_entry *, PTR))) (func), \
+ (bfd_boolean (*) (struct bfd_hash_entry *, void *)) (func), \
(info)))
/* The cref hash table. */
/* Create an entry in a cref hash table. */
static struct bfd_hash_entry *
-cref_hash_newfunc (entry, table, string)
- struct bfd_hash_entry *entry;
- struct bfd_hash_table *table;
- const char *string;
+cref_hash_newfunc (struct bfd_hash_entry *entry,
+ struct bfd_hash_table *table,
+ const char *string)
{
struct cref_hash_entry *ret = (struct cref_hash_entry *) entry;
ret = ((struct cref_hash_entry *)
bfd_hash_allocate (table, sizeof (struct cref_hash_entry)));
if (ret == NULL)
- return (struct bfd_hash_entry *) ret;
+ return NULL;
/* Call the allocation method of the superclass. */
ret = ((struct cref_hash_entry *)
ret->refs = NULL;
/* Keep a count of the number of entries created in the hash
- table. */
+ table. */
++cref_symcount;
}
- return (struct bfd_hash_entry *) ret;
+ return &ret->root;
}
/* Add a symbol to the cref hash table. This is called for every
symbol that is seen during the link. */
void
-add_cref (name, abfd, section, value)
- const char *name;
- bfd *abfd;
- asection *section;
- bfd_vma value ATTRIBUTE_UNUSED;
+add_cref (const char *name,
+ bfd *abfd,
+ asection *section,
+ bfd_vma value ATTRIBUTE_UNUSED)
{
struct cref_hash_entry *h;
struct cref_ref *r;
if (r == NULL)
{
- r = (struct cref_ref *) xmalloc (sizeof *r);
+ r = xmalloc (sizeof *r);
r->next = h->refs;
h->refs = r;
r->abfd = abfd;
name. */
static bfd_boolean
-cref_fill_array (h, data)
- struct cref_hash_entry *h;
- PTR data;
+cref_fill_array (struct cref_hash_entry *h, void *data)
{
- struct cref_hash_entry ***pph = (struct cref_hash_entry ***) data;
+ struct cref_hash_entry ***pph = data;
ASSERT (h->demangled == NULL);
h->demangled = demangle (h->root.string);
/* Sort an array of cref hash table entries by name. */
static int
-cref_sort_array (a1, a2)
- const PTR a1;
- const PTR a2;
+cref_sort_array (const void *a1, const void *a2)
{
- const struct cref_hash_entry **p1 = (const struct cref_hash_entry **) a1;
- const struct cref_hash_entry **p2 = (const struct cref_hash_entry **) a2;
+ const struct cref_hash_entry * const *p1 = a1;
+ const struct cref_hash_entry * const *p2 = a2;
return strcmp ((*p1)->demangled, (*p2)->demangled);
}
#define FILECOL (50)
void
-output_cref (fp)
- FILE *fp;
+output_cref (FILE *fp)
{
int len;
struct cref_hash_entry **csyms, **csym_fill, **csym, **csym_end;
return;
}
- csyms = ((struct cref_hash_entry **)
- xmalloc (cref_symcount * sizeof (*csyms)));
+ csyms = xmalloc (cref_symcount * sizeof (*csyms));
csym_fill = csyms;
cref_hash_traverse (&cref_table, cref_fill_array, &csym_fill);
/* Output one entry in the cross reference table. */
static void
-output_one_cref (fp, h)
- FILE *fp;
- struct cref_hash_entry *h;
+output_one_cref (FILE *fp, struct cref_hash_entry *h)
{
int len;
struct bfd_link_hash_entry *hl;
/* Check for prohibited cross references. */
void
-check_nocrossrefs ()
+check_nocrossrefs (void)
{
if (! cref_initialized)
return;
- cref_hash_traverse (&cref_table, check_nocrossref, (PTR) NULL);
+ cref_hash_traverse (&cref_table, check_nocrossref, NULL);
lang_for_each_file (check_section_sym_xref);
}
/* Checks for prohibited cross references to section symbols. */
static void
-check_section_sym_xref (statement)
- lang_input_statement_type *statement;
+check_section_sym_xref (lang_input_statement_type *statement)
{
bfd *abfd;
asection *sec;
/* Check one symbol to see if it is a prohibited cross reference. */
static bfd_boolean
-check_nocrossref (h, ignore)
- struct cref_hash_entry *h;
- PTR ignore ATTRIBUTE_UNUSED;
+check_nocrossref (struct cref_hash_entry *h, void *ignore ATTRIBUTE_UNUSED)
{
struct bfd_link_hash_entry *hl;
asection *defsec;
prohibited sections. */
static void
-check_refs (name, sec, abfd, ncrs)
- const char *name;
- asection *sec;
- bfd *abfd;
- struct lang_nocrossrefs *ncrs;
+check_refs (const char *name,
+ asection *sec,
+ bfd *abfd,
+ struct lang_nocrossrefs *ncrs)
{
lang_input_statement_type *li;
asymbol **asymbols;
the BFD in which the symbol is defined, since even a single
BFD might contain a prohibited cross reference. */
- li = (lang_input_statement_type *) abfd->usrdata;
+ li = abfd->usrdata;
if (li != NULL && li->asymbols != NULL)
asymbols = li->asymbols;
else
symsize = bfd_get_symtab_upper_bound (abfd);
if (symsize < 0)
einfo (_("%B%F: could not read symbols; %E\n"), abfd);
- asymbols = (asymbol **) xmalloc (symsize);
+ asymbols = xmalloc (symsize);
symbol_count = bfd_canonicalize_symtab (abfd, asymbols);
if (symbol_count < 0)
einfo (_("%B%F: could not read symbols: %E\n"), abfd);
info.defsec = sec;
info.ncrs = ncrs;
info.asymbols = asymbols;
- bfd_map_over_sections (abfd, check_reloc_refs, (PTR) &info);
+ bfd_map_over_sections (abfd, check_reloc_refs, &info);
if (li == NULL)
free (asymbols);
INFO->SYM_NAME, then we report a prohibited cross reference error. */
static void
-check_reloc_refs (abfd, sec, iarg)
- bfd *abfd;
- asection *sec;
- PTR iarg;
+check_reloc_refs (bfd *abfd, asection *sec, void *iarg)
{
- struct check_refs_info *info = (struct check_refs_info *) iarg;
+ struct check_refs_info *info = iarg;
asection *outsec;
const char *outsecname;
asection *outdefsec;
if (relsize == 0)
return;
- relpp = (arelent **) xmalloc (relsize);
+ relpp = xmalloc (relsize);
relcount = bfd_canonicalize_reloc (abfd, sec, relpp, info->asymbols);
if (relcount < 0)
einfo (_("%B%F: could not read relocs: %E\n"), abfd);
&& bfd_get_section (*q->sym_ptr_ptr) == info->defsec)))
{
/* We found a reloc for the symbol. The symbol is defined
- in OUTSECNAME. This reloc is from a section which is
- mapped into a section from which references to OUTSECNAME
- are prohibited. We must report an error. */
+ in OUTSECNAME. This reloc is from a section which is
+ mapped into a section from which references to OUTSECNAME
+ are prohibited. We must report an error. */
einfo (_("%X%C: prohibited cross reference from %s to `%T' in %s\n"),
abfd, sec, q->address, outsecname,
bfd_asymbol_name (*q->sym_ptr_ptr), outdefsecname);
#include "ldmain.h"
#include "ldctor.h"
-static int ctor_prio PARAMS ((const char *));
-static int ctor_cmp PARAMS ((const PTR, const PTR));
-
/* The list of statements needed to handle constructors. These are
invoked by the command CONSTRUCTORS in the linker script. */
lang_statement_list_type constructor_list;
function will construct the sets. */
void
-ldctor_add_set_entry (h, reloc, name, section, value)
- struct bfd_link_hash_entry *h;
- bfd_reloc_code_real_type reloc;
- const char *name;
- asection *section;
- bfd_vma value;
+ldctor_add_set_entry (struct bfd_link_hash_entry *h,
+ bfd_reloc_code_real_type reloc,
+ const char *name,
+ asection *section,
+ bfd_vma value)
{
struct set_info *p;
struct set_element *e;
struct set_element **epp;
- for (p = sets; p != (struct set_info *) NULL; p = p->next)
+ for (p = sets; p != NULL; p = p->next)
if (p->h == h)
break;
- if (p == (struct set_info *) NULL)
+ if (p == NULL)
{
- p = (struct set_info *) xmalloc (sizeof (struct set_info));
+ p = xmalloc (sizeof (struct set_info));
p->next = sets;
sets = p;
p->h = h;
}
}
- e = (struct set_element *) xmalloc (sizeof (struct set_element));
+ e = xmalloc (sizeof (struct set_element));
e->next = NULL;
e->name = name;
e->section = section;
symbol name. */
static int
-ctor_prio (name)
- const char *name;
+ctor_prio (const char *name)
{
/* The name will look something like _GLOBAL_$I$65535$test02__Fv.
There might be extra leading underscores, and the $ characters
is called via qsort. */
static int
-ctor_cmp (p1, p2)
- const PTR p1;
- const PTR p2;
+ctor_cmp (const void *p1, const void *p2)
{
- const struct set_element **pe1 = (const struct set_element **) p1;
- const struct set_element **pe2 = (const struct set_element **) p2;
+ const struct set_element * const *pe1 = p1;
+ const struct set_element * const *pe2 = p2;
const char *n1;
const char *n2;
int prio1;
themselves into constructor_list. */
void
-ldctor_build_sets ()
+ldctor_build_sets (void)
{
static bfd_boolean called;
lang_statement_list_type *old;
for (e = p->elements; e != NULL; e = e->next)
++c;
- array = (struct set_element **) xmalloc (c * sizeof *array);
+ array = xmalloc (c * sizeof *array);
i = 0;
for (e = p->elements; e != NULL; e = e->next)
lang_list_init (stat_ptr);
header_printed = FALSE;
- for (p = sets; p != (struct set_info *) NULL; p = p->next)
+ for (p = sets; p != NULL; p = p->next)
{
struct set_element *e;
reloc_howto_type *howto;
generating relocatable output, we generate relocs instead of
addresses. */
howto = bfd_reloc_type_lookup (output_bfd, p->reloc);
- if (howto == (reloc_howto_type *) NULL)
+ if (howto == NULL)
{
if (link_info.relocatable)
{
exp_intop (reloc_size))));
lang_add_assignment (exp_assop ('=', p->h->root.string,
exp_nameop (NAME, ".")));
- lang_add_data (size, exp_intop ((bfd_vma) p->count));
+ lang_add_data (size, exp_intop (p->count));
- for (e = p->elements; e != (struct set_element *) NULL; e = e->next)
+ for (e = p->elements; e != NULL; e = e->next)
{
if (config.map_file != NULL)
{
/* ldctor.h - linker constructor support
- Copyright 1991, 1992, 1993, 1994, 1995, 1998, 2000, 2002
+ Copyright 1991, 1992, 1993, 1994, 1995, 1998, 2000, 2002, 2003
Free Software Foundation, Inc.
This file is part of GLD, the Gnu Linker.
extern struct set_info *sets;
extern void ldctor_add_set_entry
- PARAMS ((struct bfd_link_hash_entry *, bfd_reloc_code_real_type,
- const char *, asection *, bfd_vma));
+ (struct bfd_link_hash_entry *, bfd_reloc_code_real_type, const char *,
+ asection *, bfd_vma);
extern void ldctor_build_sets
- PARAMS ((void));
+ (void);
#endif
/* ld-emul.h - Linker emulation header file
- Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2000, 2002
+ Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2000, 2002, 2003
Free Software Foundation, Inc.
This file is part of GLD, the Gnu Linker.
#define LDEMUL_H
extern void ldemul_hll
- PARAMS ((char *));
+ (char *);
extern void ldemul_syslib
- PARAMS ((char *));
+ (char *);
extern void ldemul_after_parse
- PARAMS ((void));
+ (void);
extern void ldemul_before_parse
- PARAMS ((void));
+ (void);
extern void ldemul_after_open
- PARAMS ((void));
+ (void);
extern void ldemul_after_allocation
- PARAMS ((void));
+ (void);
extern void ldemul_before_allocation
- PARAMS ((void));
+ (void);
extern void ldemul_set_output_arch
- PARAMS ((void));
+ (void);
extern char *ldemul_choose_target
- PARAMS ((int, char**));
+ (int, char**);
extern void ldemul_choose_mode
- PARAMS ((char *));
+ (char *);
extern void ldemul_list_emulations
- PARAMS ((FILE *));
+ (FILE *);
extern void ldemul_list_emulation_options
- PARAMS ((FILE *));
+ (FILE *);
extern char *ldemul_get_script
- PARAMS ((int *isfile));
+ (int *isfile);
extern void ldemul_finish
- PARAMS ((void));
+ (void);
extern void ldemul_set_symbols
- PARAMS ((void));
+ (void);
extern void ldemul_create_output_section_statements
- PARAMS ((void));
+ (void);
extern bfd_boolean ldemul_place_orphan
- PARAMS ((struct lang_input_statement_struct *, asection *));
+ (struct lang_input_statement_struct *, asection *);
extern bfd_boolean ldemul_parse_args
- PARAMS ((int, char **));
+ (int, char **);
extern void ldemul_add_options
- PARAMS ((int, char **, int, struct option **, int, struct option **));
+ (int, char **, int, struct option **, int, struct option **);
extern bfd_boolean ldemul_handle_option
- PARAMS ((int));
+ (int);
extern bfd_boolean ldemul_unrecognized_file
- PARAMS ((struct lang_input_statement_struct *));
+ (struct lang_input_statement_struct *);
extern bfd_boolean ldemul_recognized_file
- PARAMS ((struct lang_input_statement_struct *));
+ (struct lang_input_statement_struct *);
extern bfd_boolean ldemul_open_dynamic_archive
- PARAMS ((const char *, struct search_dirs *,
- struct lang_input_statement_struct *));
+ (const char *, struct search_dirs *, struct lang_input_statement_struct *);
extern char *ldemul_default_target
- PARAMS ((int, char**));
+ (int, char**);
extern void after_parse_default
- PARAMS ((void));
+ (void);
extern void after_open_default
- PARAMS ((void));
+ (void);
extern void after_allocation_default
- PARAMS ((void));
+ (void);
extern void before_allocation_default
- PARAMS ((void));
+ (void);
extern void set_output_arch_default
- PARAMS ((void));
+ (void);
extern void syslib_default
- PARAMS ((char*));
+ (char*);
extern void hll_default
- PARAMS ((char*));
+ (char*);
extern int ldemul_find_potential_libraries
- PARAMS ((char *, struct lang_input_statement_struct *));
+ (char *, struct lang_input_statement_struct *);
extern struct bfd_elf_version_expr *ldemul_new_vers_pattern
- PARAMS ((struct bfd_elf_version_expr *));
+ (struct bfd_elf_version_expr *);
typedef struct ld_emulation_xfer_struct {
/* Run before parsing the command line and script file.
Set the architecture, maybe other things. */
- void (*before_parse) PARAMS ((void));
+ void (*before_parse) (void);
/* Handle the SYSLIB (low level library) script command. */
- void (*syslib) PARAMS ((char *));
+ void (*syslib) (char *);
/* Handle the HLL (high level library) script command. */
- void (*hll) PARAMS ((char *));
+ void (*hll) (char *);
/* Run after parsing the command line and script file. */
- void (*after_parse) PARAMS ((void));
+ void (*after_parse) (void);
/* Run after opening all input files, and loading the symbols. */
- void (*after_open) PARAMS ((void));
+ void (*after_open) (void);
/* Run after allocating output sections. */
- void (*after_allocation) PARAMS ( (void));
+ void (*after_allocation) (void);
/* Set the output architecture and machine if possible. */
- void (*set_output_arch) PARAMS ((void));
+ void (*set_output_arch) (void);
/* Decide which target name to use. */
- char * (*choose_target) PARAMS ((int, char**));
+ char * (*choose_target) (int, char**);
/* Run before allocating output sections. */
- void (*before_allocation) PARAMS ((void));
+ void (*before_allocation) (void);
/* Return the appropriate linker script. */
- char * (*get_script) PARAMS ((int *isfile));
+ char * (*get_script) (int *isfile);
/* The name of this emulation. */
char *emulation_name;
char *target_name;
/* Run after assigning values from the script. */
- void (*finish) PARAMS ((void));
+ void (*finish) (void);
/* Create any output sections needed by the target. */
- void (*create_output_section_statements) PARAMS ((void));
+ void (*create_output_section_statements) (void);
/* Try to open a dynamic library. ARCH is an architecture name, and
is normally the empty string. ENTRY is the lang_input_statement
that should be opened. */
bfd_boolean (*open_dynamic_archive)
- PARAMS ((const char *arch, struct search_dirs *,
- struct lang_input_statement_struct *entry));
+ (const char *arch, struct search_dirs *,
+ struct lang_input_statement_struct *entry);
/* Place an orphan section. Return TRUE if it was placed, FALSE if
the default action should be taken. This field may be NULL, in
which case the default action will always be taken. */
bfd_boolean (*place_orphan)
- PARAMS ((struct lang_input_statement_struct *, asection *));
+ (struct lang_input_statement_struct *, asection *);
/* Run after assigning parsing with the args, but before
reading the script. Used to initialize symbols used in the script. */
- void (*set_symbols) PARAMS ((void));
+ void (*set_symbols) (void);
/* Parse args which the base linker doesn't understand.
Return TRUE if the arg needs no further processing. */
- bfd_boolean (*parse_args) PARAMS ((int, char **));
+ bfd_boolean (*parse_args) (int, char **);
/* Hook to add options to parameters passed by the base linker to
getopt_long and getopt_long_only calls. */
void (*add_options)
- PARAMS ((int, char **, int, struct option **, int, struct option **));
+ (int, char **, int, struct option **, int, struct option **);
/* Companion to the above to handle an option. Returns TRUE if it is
one of our options. */
- bfd_boolean (*handle_option) PARAMS ((int));
+ bfd_boolean (*handle_option) (int);
/* Run to handle files which are not recognized as object files or
archives. Return TRUE if the file was handled. */
bfd_boolean (*unrecognized_file)
- PARAMS ((struct lang_input_statement_struct *));
+ (struct lang_input_statement_struct *);
/* Run to list the command line options which parse_args handles. */
- void (* list_options) PARAMS ((FILE *));
+ void (* list_options) (FILE *);
/* Run to specially handle files which *are* recognized as object
files or archives. Return TRUE if the file was handled. */
bfd_boolean (*recognized_file)
- PARAMS ((struct lang_input_statement_struct *));
+ (struct lang_input_statement_struct *);
/* Called when looking for libraries in a directory specified
via a linker command line option or linker script option.
Files that match the pattern "lib*.a" have already been scanned.
(For VMS files matching ":lib*.a" have also been scanned). */
int (* find_potential_libraries)
- PARAMS ((char *, struct lang_input_statement_struct *));
+ (char *, struct lang_input_statement_struct *);
/* Called when adding a new version pattern. PowerPC64-ELF uses
this hook to add a pattern matching ".foo" for every "foo". */
struct bfd_elf_version_expr * (*new_vers_pattern)
- PARAMS ((struct bfd_elf_version_expr *));
+ (struct bfd_elf_version_expr *);
} ld_emulation_xfer_type;
#include "libiberty.h"
#include "safe-ctype.h"
-static void exp_print_token
- PARAMS ((token_code_type code, int infix_p));
-static void make_abs
- PARAMS ((etree_value_type *ptr));
-static etree_value_type new_abs
- PARAMS ((bfd_vma value));
-static void check
- PARAMS ((lang_output_section_statement_type *os, const char *name,
- const char *op));
-static etree_value_type new_rel
- PARAMS ((bfd_vma, char *, lang_output_section_statement_type *section));
-static etree_value_type new_rel_from_section
- PARAMS ((bfd_vma value, lang_output_section_statement_type *section));
-static etree_value_type fold_unary
- PARAMS ((etree_type *tree,
- lang_output_section_statement_type *current_section,
- lang_phase_type allocation_done,
- bfd_vma dot, bfd_vma *dotp));
-static etree_value_type fold_binary
- PARAMS ((etree_type *tree,
- lang_output_section_statement_type *current_section,
- lang_phase_type allocation_done,
- bfd_vma dot, bfd_vma *dotp));
-static etree_value_type fold_trinary
- PARAMS ((etree_type *tree,
- lang_output_section_statement_type *current_section,
- lang_phase_type allocation_done,
- bfd_vma dot, bfd_vma *dotp));
-static etree_value_type fold_name
- PARAMS ((etree_type *tree,
- lang_output_section_statement_type *current_section,
- lang_phase_type allocation_done,
- bfd_vma dot));
static etree_value_type exp_fold_tree_no_dot
- PARAMS ((etree_type *tree,
- lang_output_section_statement_type *current_section,
- lang_phase_type allocation_done));
+ (etree_type *, lang_output_section_statement_type *, lang_phase_type);
struct exp_data_seg exp_data_seg;
with spaces if INFIX_P is TRUE. */
static void
-exp_print_token (code, infix_p)
- token_code_type code;
- int infix_p;
+exp_print_token (token_code_type code, int infix_p)
{
static const struct
{
}
static void
-make_abs (ptr)
- etree_value_type *ptr;
+make_abs (etree_value_type *ptr)
{
asection *s = ptr->section->bfd_section;
ptr->value += s->vma;
}
static etree_value_type
-new_abs (value)
- bfd_vma value;
+new_abs (bfd_vma value)
{
etree_value_type new;
new.valid_p = TRUE;
}
static void
-check (os, name, op)
- lang_output_section_statement_type *os;
- const char *name;
- const char *op;
+check (lang_output_section_statement_type *os,
+ const char *name,
+ const char *op)
{
if (os == NULL)
einfo (_("%F%P: %s uses undefined section %s\n"), op, name);
}
etree_type *
-exp_intop (value)
- bfd_vma value;
+exp_intop (bfd_vma value)
{
- etree_type *new = (etree_type *) stat_alloc (sizeof (new->value));
+ etree_type *new = stat_alloc (sizeof (new->value));
new->type.node_code = INT;
new->value.value = value;
new->value.str = NULL;
}
etree_type *
-exp_bigintop (value, str)
- bfd_vma value;
- char *str;
+exp_bigintop (bfd_vma value, char *str)
{
- etree_type *new = (etree_type *) stat_alloc (sizeof (new->value));
+ etree_type *new = stat_alloc (sizeof (new->value));
new->type.node_code = INT;
new->value.value = value;
new->value.str = str;
/* Build an expression representing an unnamed relocatable value. */
etree_type *
-exp_relop (section, value)
- asection *section;
- bfd_vma value;
+exp_relop (asection *section, bfd_vma value)
{
- etree_type *new = (etree_type *) stat_alloc (sizeof (new->rel));
+ etree_type *new = stat_alloc (sizeof (new->rel));
new->type.node_code = REL;
new->type.node_class = etree_rel;
new->rel.section = section;
}
static etree_value_type
-new_rel (value, str, section)
- bfd_vma value;
- char *str;
- lang_output_section_statement_type *section;
+new_rel (bfd_vma value,
+ char *str,
+ lang_output_section_statement_type *section)
{
etree_value_type new;
new.valid_p = TRUE;
}
static etree_value_type
-new_rel_from_section (value, section)
- bfd_vma value;
- lang_output_section_statement_type *section;
+new_rel_from_section (bfd_vma value,
+ lang_output_section_statement_type *section)
{
etree_value_type new;
new.valid_p = TRUE;
}
static etree_value_type
-fold_unary (tree, current_section, allocation_done, dot, dotp)
- etree_type *tree;
- lang_output_section_statement_type *current_section;
- lang_phase_type allocation_done;
- bfd_vma dot;
- bfd_vma *dotp;
+fold_unary (etree_type *tree,
+ lang_output_section_statement_type *current_section,
+ lang_phase_type allocation_done,
+ bfd_vma dot,
+ bfd_vma *dotp)
{
etree_value_type result;
}
static etree_value_type
-fold_binary (tree, current_section, allocation_done, dot, dotp)
- etree_type *tree;
- lang_output_section_statement_type *current_section;
- lang_phase_type allocation_done;
- bfd_vma dot;
- bfd_vma *dotp;
+fold_binary (etree_type *tree,
+ lang_output_section_statement_type *current_section,
+ lang_phase_type allocation_done,
+ bfd_vma dot,
+ bfd_vma *dotp)
{
etree_value_type result;
}
static etree_value_type
-fold_trinary (tree, current_section, allocation_done, dot, dotp)
- etree_type *tree;
- lang_output_section_statement_type *current_section;
- lang_phase_type allocation_done;
- bfd_vma dot;
- bfd_vma *dotp;
+fold_trinary (etree_type *tree,
+ lang_output_section_statement_type *current_section,
+ lang_phase_type allocation_done,
+ bfd_vma dot,
+ bfd_vma *dotp)
{
etree_value_type result;
}
etree_value_type
-invalid ()
+invalid (void)
{
etree_value_type new;
new.valid_p = FALSE;
}
static etree_value_type
-fold_name (tree, current_section, allocation_done, dot)
- etree_type *tree;
- lang_output_section_statement_type *current_section;
- lang_phase_type allocation_done;
- bfd_vma dot;
+fold_name (etree_type *tree,
+ lang_output_section_statement_type *current_section,
+ lang_phase_type allocation_done,
+ bfd_vma dot)
{
etree_value_type result;
case SIZEOF_HEADERS:
if (allocation_done != lang_first_phase_enum)
{
- result = new_abs ((bfd_vma)
- bfd_sizeof_headers (output_bfd,
+ result = new_abs (bfd_sizeof_headers (output_bfd,
link_info.relocatable));
}
else
h = bfd_wrapped_link_hash_lookup (output_bfd, &link_info,
tree->name.name,
FALSE, FALSE, TRUE);
- result.value = (h != (struct bfd_link_hash_entry *) NULL
+ result.value = (h != NULL
&& (h->type == bfd_link_hash_defined
|| h->type == bfd_link_hash_defweak
|| h->type == bfd_link_hash_common));
}
etree_value_type
-exp_fold_tree (tree, current_section, allocation_done, dot, dotp)
- etree_type *tree;
- lang_output_section_statement_type *current_section;
- lang_phase_type allocation_done;
- bfd_vma dot;
- bfd_vma *dotp;
+exp_fold_tree (etree_type *tree,
+ lang_output_section_statement_type *current_section,
+ lang_phase_type allocation_done,
+ bfd_vma dot,
+ bfd_vma *dotp)
{
etree_value_type result;
create = FALSE;
h = bfd_link_hash_lookup (link_info.hash, tree->assign.dst,
create, FALSE, FALSE);
- if (h == (struct bfd_link_hash_entry *) NULL)
+ if (h == NULL)
{
if (tree->type.node_class == etree_assign)
einfo (_("%P%F:%s: hash creation failed\n"),
}
static etree_value_type
-exp_fold_tree_no_dot (tree, current_section, allocation_done)
- etree_type *tree;
- lang_output_section_statement_type *current_section;
- lang_phase_type allocation_done;
+exp_fold_tree_no_dot (etree_type *tree,
+ lang_output_section_statement_type *current_section,
+ lang_phase_type allocation_done)
{
- return exp_fold_tree (tree, current_section, allocation_done,
- (bfd_vma) 0, (bfd_vma *) NULL);
+ return exp_fold_tree (tree, current_section, allocation_done, 0, NULL);
}
etree_type *
-exp_binop (code, lhs, rhs)
- int code;
- etree_type *lhs;
- etree_type *rhs;
+exp_binop (int code, etree_type *lhs, etree_type *rhs)
{
etree_type value, *new;
etree_value_type r;
{
return exp_intop (r.value);
}
- new = (etree_type *) stat_alloc (sizeof (new->binary));
- memcpy ((char *) new, (char *) &value, sizeof (new->binary));
+ new = stat_alloc (sizeof (new->binary));
+ memcpy (new, &value, sizeof (new->binary));
return new;
}
etree_type *
-exp_trinop (code, cond, lhs, rhs)
- int code;
- etree_type *cond;
- etree_type *lhs;
- etree_type *rhs;
+exp_trinop (int code, etree_type *cond, etree_type *lhs, etree_type *rhs)
{
etree_type value, *new;
etree_value_type r;
value.trinary.cond = cond;
value.trinary.rhs = rhs;
value.type.node_class = etree_trinary;
- r = exp_fold_tree_no_dot (&value,
- (lang_output_section_statement_type *) NULL,
- lang_first_phase_enum);
+ r = exp_fold_tree_no_dot (&value, NULL, lang_first_phase_enum);
if (r.valid_p)
return exp_intop (r.value);
- new = (etree_type *) stat_alloc (sizeof (new->trinary));
- memcpy ((char *) new, (char *) &value, sizeof (new->trinary));
+ new = stat_alloc (sizeof (new->trinary));
+ memcpy (new, &value, sizeof (new->trinary));
return new;
}
etree_type *
-exp_unop (code, child)
- int code;
- etree_type *child;
+exp_unop (int code, etree_type *child)
{
etree_type value, *new;
if (r.valid_p)
return exp_intop (r.value);
- new = (etree_type *) stat_alloc (sizeof (new->unary));
- memcpy ((char *) new, (char *) &value, sizeof (new->unary));
+ new = stat_alloc (sizeof (new->unary));
+ memcpy (new, &value, sizeof (new->unary));
return new;
}
etree_type *
-exp_nameop (code, name)
- int code;
- const char *name;
+exp_nameop (int code, const char *name)
{
etree_type value, *new;
etree_value_type r;
value.name.name = name;
value.name.type.node_class = etree_name;
- r = exp_fold_tree_no_dot (&value,
- (lang_output_section_statement_type *) NULL,
- lang_first_phase_enum);
+ r = exp_fold_tree_no_dot (&value, NULL, lang_first_phase_enum);
if (r.valid_p)
return exp_intop (r.value);
- new = (etree_type *) stat_alloc (sizeof (new->name));
- memcpy ((char *) new, (char *) &value, sizeof (new->name));
+ new = stat_alloc (sizeof (new->name));
+ memcpy (new, &value, sizeof (new->name));
return new;
}
etree_type *
-exp_assop (code, dst, src)
- int code;
- const char *dst;
- etree_type *src;
+exp_assop (int code, const char *dst, etree_type *src)
{
etree_type value, *new;
if (exp_fold_tree_no_dot (&value, &result))
return exp_intop (result);
#endif
- new = (etree_type *) stat_alloc (sizeof (new->assign));
- memcpy ((char *) new, (char *) &value, sizeof (new->assign));
+ new = stat_alloc (sizeof (new->assign));
+ memcpy (new, &value, sizeof (new->assign));
return new;
}
/* Handle PROVIDE. */
etree_type *
-exp_provide (dst, src)
- const char *dst;
- etree_type *src;
+exp_provide (const char *dst, etree_type *src)
{
etree_type *n;
- n = (etree_type *) stat_alloc (sizeof (n->assign));
+ n = stat_alloc (sizeof (n->assign));
n->assign.type.node_code = '=';
n->assign.type.node_class = etree_provide;
n->assign.src = src;
/* Handle ASSERT. */
etree_type *
-exp_assert (exp, message)
- etree_type *exp;
- const char *message;
+exp_assert (etree_type *exp, const char *message)
{
etree_type *n;
- n = (etree_type *) stat_alloc (sizeof (n->assert_s));
+ n = stat_alloc (sizeof (n->assert_s));
n->assert_s.type.node_code = '!';
n->assert_s.type.node_class = etree_assert;
n->assert_s.child = exp;
}
void
-exp_print_tree (tree)
- etree_type *tree;
+exp_print_tree (etree_type *tree)
{
if (config.map_file == NULL)
config.map_file = stderr;
return;
case etree_assign:
#if 0
- if (tree->assign.dst->sdefs != (asymbol *) NULL)
+ if (tree->assign.dst->sdefs != NULL)
fprintf (config.map_file, "%s (%x) ", tree->assign.dst->name,
tree->assign.dst->sdefs->value);
else
}
bfd_vma
-exp_get_vma (tree, def, name, allocation_done)
- etree_type *tree;
- bfd_vma def;
- char *name;
- lang_phase_type allocation_done;
+exp_get_vma (etree_type *tree,
+ bfd_vma def,
+ char *name,
+ lang_phase_type allocation_done)
{
etree_value_type r;
}
int
-exp_get_value_int (tree, def, name, allocation_done)
- etree_type *tree;
- int def;
- char *name;
- lang_phase_type allocation_done;
+exp_get_value_int (etree_type *tree,
+ int def,
+ char *name,
+ lang_phase_type allocation_done)
{
- return (int) exp_get_vma (tree, (bfd_vma) def, name, allocation_done);
+ return exp_get_vma (tree, def, name, allocation_done);
}
fill_type *
-exp_get_fill (tree, def, name, allocation_done)
- etree_type *tree;
- fill_type *def;
- char *name;
- lang_phase_type allocation_done;
+exp_get_fill (etree_type *tree,
+ fill_type *def,
+ char *name,
+ lang_phase_type allocation_done)
{
fill_type *fill;
etree_value_type r;
{
unsigned char *dst;
unsigned char *s;
- fill = (fill_type *) xmalloc ((len + 1) / 2 + sizeof (*fill) - 1);
+ fill = xmalloc ((len + 1) / 2 + sizeof (*fill) - 1);
fill->size = (len + 1) / 2;
dst = fill->data;
s = r.str;
}
else
{
- fill = (fill_type *) xmalloc (4 + sizeof (*fill) - 1);
+ fill = xmalloc (4 + sizeof (*fill) - 1);
val = r.value;
fill->data[0] = (val >> 24) & 0xff;
fill->data[1] = (val >> 16) & 0xff;
}
bfd_vma
-exp_get_abs_int (tree, def, name, allocation_done)
- etree_type *tree;
- int def ATTRIBUTE_UNUSED;
- char *name;
- lang_phase_type allocation_done;
+exp_get_abs_int (etree_type *tree,
+ int def ATTRIBUTE_UNUSED,
+ char *name,
+ lang_phase_type allocation_done)
{
etree_value_type res;
res = exp_fold_tree_no_dot (tree, abs_output_section, allocation_done);
return res.value;
}
-bfd_vma align_n (value, align)
- bfd_vma value;
- bfd_vma align;
+bfd_vma align_n (bfd_vma value, bfd_vma align)
{
if (align <= 1)
return value;
/* ldexp.h -
- Copyright 1991, 1992, 1993, 1994, 1995, 1998, 1999, 2000, 2001, 2002
+ Copyright 1991, 1992, 1993, 1994, 1995, 1998, 1999, 2000, 2001, 2002, 2003
Free Software Foundation, Inc.
This file is part of GLD, the Gnu Linker.
typedef struct _fill_type fill_type;
etree_type *exp_intop
- PARAMS ((bfd_vma));
+ (bfd_vma);
etree_type *exp_bigintop
- PARAMS ((bfd_vma, char *));
+ (bfd_vma, char *);
etree_type *exp_relop
- PARAMS ((asection *, bfd_vma));
+ (asection *, bfd_vma);
etree_value_type invalid
- PARAMS ((void));
+ (void);
etree_value_type exp_fold_tree
- PARAMS ((etree_type *, struct lang_output_section_statement_struct *,
- lang_phase_type, bfd_vma, bfd_vma *));
+ (etree_type *, struct lang_output_section_statement_struct *,
+ lang_phase_type, bfd_vma, bfd_vma *);
etree_type *exp_binop
- PARAMS ((int, etree_type *, etree_type *));
+ (int, etree_type *, etree_type *);
etree_type *exp_trinop
- PARAMS ((int,etree_type *, etree_type *, etree_type *));
+ (int,etree_type *, etree_type *, etree_type *);
etree_type *exp_unop
- PARAMS ((int, etree_type *));
+ (int, etree_type *);
etree_type *exp_nameop
- PARAMS ((int, const char *));
+ (int, const char *);
etree_type *exp_assop
- PARAMS ((int, const char *, etree_type *));
+ (int, const char *, etree_type *);
etree_type *exp_provide
- PARAMS ((const char *, etree_type *));
+ (const char *, etree_type *);
etree_type *exp_assert
- PARAMS ((etree_type *, const char *));
+ (etree_type *, const char *);
void exp_print_tree
- PARAMS ((etree_type *));
+ (etree_type *);
bfd_vma exp_get_vma
- PARAMS ((etree_type *, bfd_vma, char *, lang_phase_type));
+ (etree_type *, bfd_vma, char *, lang_phase_type);
int exp_get_value_int
- PARAMS ((etree_type *, int, char *, lang_phase_type));
+ (etree_type *, int, char *, lang_phase_type);
fill_type *exp_get_fill
- PARAMS ((etree_type *, fill_type *, char *, lang_phase_type));
+ (etree_type *, fill_type *, char *, lang_phase_type);
bfd_vma exp_get_abs_int
- PARAMS ((etree_type *, int, char *, lang_phase_type));
+ (etree_type *, int, char *, lang_phase_type);
bfd_vma align_n
- PARAMS ((bfd_vma, bfd_vma));
+ (bfd_vma, bfd_vma);
#endif
static search_arch_type *search_arch_head;
static search_arch_type **search_arch_tail_ptr = &search_arch_head;
-static FILE *try_open
- PARAMS ((const char *, const char *));
-static bfd_boolean is_sysrooted_pathname
- PARAMS ((const char *, bfd_boolean));
-
/* Test whether a pathname, after canonicalization, is the same or a
sub-directory of the sysroot directory. */
static bfd_boolean
-is_sysrooted_pathname (name, notsame)
- const char *name;
- bfd_boolean notsame;
+is_sysrooted_pathname (const char *name, bfd_boolean notsame)
{
char * realname = ld_canon_sysroot ? lrealpath (name) : NULL;
int len;
Makes a copy of NAME using xmalloc(). */
void
-ldfile_add_library_path (name, cmdline)
- const char *name;
- bfd_boolean cmdline;
+ldfile_add_library_path (const char *name, bfd_boolean cmdline)
{
search_dirs_type *new;
if (!cmdline && config.only_cmd_line_lib_dirs)
return;
- new = (search_dirs_type *) xmalloc (sizeof (search_dirs_type));
+ new = xmalloc (sizeof (search_dirs_type));
new->next = NULL;
new->cmdline = cmdline;
*search_tail_ptr = new;
/* Try to open a BFD for a lang_input_statement. */
bfd_boolean
-ldfile_try_open_bfd (attempt, entry)
- const char *attempt;
- lang_input_statement_type *entry;
+ldfile_try_open_bfd (const char *attempt,
+ lang_input_statement_type *entry)
{
entry->the_bfd = bfd_openr (attempt, entry->target);
archive, use ARCH, LIB and SUFFIX to modify the file name. */
bfd_boolean
-ldfile_open_file_search (arch, entry, lib, suffix)
- const char *arch;
- lang_input_statement_type *entry;
- const char *lib;
- const char *suffix;
+ldfile_open_file_search (const char *arch,
+ lang_input_statement_type *entry,
+ const char *lib,
+ const char *suffix)
{
search_dirs_type *search;
return FALSE;
}
- for (search = search_head;
- search != (search_dirs_type *) NULL;
- search = search->next)
+ for (search = search_head; search != NULL; search = search->next)
{
char *string;
}
}
- string = (char *) xmalloc (strlen (search->name)
- + strlen (slash)
- + strlen (lib)
- + strlen (entry->filename)
- + strlen (arch)
- + strlen (suffix)
- + 1);
+ string = xmalloc (strlen (search->name)
+ + strlen (slash)
+ + strlen (lib)
+ + strlen (entry->filename)
+ + strlen (arch)
+ + strlen (suffix)
+ + 1);
if (entry->is_archive)
sprintf (string, "%s%s%s%s%s%s", search->name, slash,
/* Open the input file specified by ENTRY. */
void
-ldfile_open_file (entry)
- lang_input_statement_type *entry;
+ldfile_open_file (lang_input_statement_type *entry)
{
if (entry->the_bfd != NULL)
return;
bfd_boolean found = FALSE;
/* Try to open <filename><suffix> or lib<filename><suffix>.a */
- for (arch = search_arch_head;
- arch != (search_arch_type *) NULL;
- arch = arch->next)
+ for (arch = search_arch_head; arch != NULL; arch = arch->next)
{
found = ldfile_open_file_search (arch->name, entry, "lib", ".a");
if (found)
/* Try to open NAME; if that fails, try NAME with EXTEN appended to it. */
static FILE *
-try_open (name, exten)
- const char *name;
- const char *exten;
+try_open (const char *name, const char *exten)
{
FILE *result;
char buff[1000];
specified with -L, without and with EXTEND appended. */
FILE *
-ldfile_find_command_file (name, extend)
- const char *name;
- const char *extend;
+ldfile_find_command_file (const char *name, const char *extend)
{
search_dirs_type *search;
FILE *result;
/* First try raw name. */
result = try_open (name, "");
- if (result == (FILE *) NULL)
+ if (result == NULL)
{
/* Try now prefixes. */
- for (search = search_head;
- search != (search_dirs_type *) NULL;
- search = search->next)
+ for (search = search_head; search != NULL; search = search->next)
{
sprintf (buffer, "%s%s%s", search->name, slash, name);
}
void
-ldfile_open_command_file (name)
- const char *name;
+ldfile_open_command_file (const char *name)
{
FILE *ldlex_input_stack;
ldlex_input_stack = ldfile_find_command_file (name, "");
- if (ldlex_input_stack == (FILE *) NULL)
+ if (ldlex_input_stack == NULL)
{
bfd_set_error (bfd_error_system_call);
einfo (_("%P%F: cannot open linker script file %s: %E\n"), name);
#ifdef GNU960
static char *
-gnu960_map_archname (name)
- char *name;
+gnu960_map_archname (char *name)
{
struct tabentry { char *cmd_switch; char *arch; };
static struct tabentry arch_tab[] =
}
void
-ldfile_add_arch (name)
- char *name;
+ldfile_add_arch (char *name)
{
- search_arch_type *new =
- (search_arch_type *) xmalloc ((bfd_size_type) (sizeof (search_arch_type)));
+ search_arch_type *new = xmalloc (sizeof (search_arch_type));
if (*name != '\0')
{
ldfile_output_machine_name = name;
}
- new->next = (search_arch_type *) NULL;
+ new->next = NULL;
new->name = gnu960_map_archname (name);
*search_arch_tail_ptr = new;
search_arch_tail_ptr = &new->next;
#else /* not GNU960 */
void
-ldfile_add_arch (in_name)
- const char *in_name;
+ldfile_add_arch (const char *in_name)
{
char *name = xstrdup (in_name);
- search_arch_type *new =
- (search_arch_type *) xmalloc (sizeof (search_arch_type));
+ search_arch_type *new = xmalloc (sizeof (search_arch_type));
ldfile_output_machine_name = in_name;
new->name = name;
- new->next = (search_arch_type *) NULL;
+ new->next = NULL;
while (*name)
{
*name = TOLOWER (*name);
/* Set the output architecture. */
void
-ldfile_set_output_arch (string)
- const char *string;
+ldfile_set_output_arch (const char *string)
{
const bfd_arch_info_type *arch = bfd_scan_arch (string);
You should have received a copy of the GNU General Public License
along with GLD; see the file COPYING. If not, write to
- the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+ the Free Software Foundation, 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
#ifndef LDFILE_H
#define LDFILE_H
extern search_dirs_type *search_head;
extern void ldfile_add_arch
- PARAMS ((const char *));
+ (const char *);
extern void ldfile_add_library_path
- PARAMS ((const char *, bfd_boolean cmdline));
+ (const char *, bfd_boolean cmdline);
extern void ldfile_open_command_file
- PARAMS ((const char *name));
+ (const char *name);
extern void ldfile_open_file
- PARAMS ((struct lang_input_statement_struct *));
+ (struct lang_input_statement_struct *);
extern bfd_boolean ldfile_try_open_bfd
- PARAMS ((const char *, struct lang_input_statement_struct *));
+ (const char *, struct lang_input_statement_struct *);
extern FILE *ldfile_find_command_file
- PARAMS ((const char *name, const char *extend));
+ (const char *name, const char *extend);
extern void ldfile_set_output_arch
- PARAMS ((const char *));
+ (const char *);
extern bfd_boolean ldfile_open_file_search
- PARAMS ((const char *arch, struct lang_input_statement_struct *,
- const char *lib, const char *suffix));
+ (const char *arch, struct lang_input_statement_struct *,
+ const char *lib, const char *suffix);
#endif
static struct lang_phdr *lang_phdr_list;
/* Forward declarations. */
-static lang_statement_union_type *new_statement
- PARAMS ((enum statement_enum, size_t, lang_statement_list_type *));
-static void lang_for_each_statement_worker
- PARAMS ((void (*) (lang_statement_union_type *),
- lang_statement_union_type *));
-static lang_input_statement_type *new_afile
- PARAMS ((const char *, lang_input_file_enum_type, const char *,
- bfd_boolean));
-static lang_memory_region_type *lang_memory_default
- PARAMS ((asection *));
-static void lang_map_flags
- PARAMS ((flagword));
-static void init_os
- PARAMS ((lang_output_section_statement_type *));
-static void exp_init_os
- PARAMS ((etree_type *));
-static void section_already_linked
- PARAMS ((bfd *, asection *, PTR));
-static struct bfd_hash_entry *already_linked_newfunc
- PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
-static void already_linked_table_init
- PARAMS ((void));
-static void already_linked_table_free
- PARAMS ((void));
-static bfd_boolean wildcardp
- PARAMS ((const char *));
-static lang_statement_union_type *wild_sort
- PARAMS ((lang_wild_statement_type *, struct wildcard_list *,
- lang_input_statement_type *, asection *));
-static void output_section_callback
- PARAMS ((lang_wild_statement_type *, struct wildcard_list *, asection *,
- lang_input_statement_type *, PTR));
-static lang_input_statement_type *lookup_name
- PARAMS ((const char *));
-static bfd_boolean load_symbols
- PARAMS ((lang_input_statement_type *, lang_statement_list_type *));
-static void wild
- PARAMS ((lang_wild_statement_type *,
- const char *, lang_output_section_statement_type *));
-static bfd *open_output
- PARAMS ((const char *));
-static void ldlang_open_output
- PARAMS ((lang_statement_union_type *));
-static void open_input_bfds
- PARAMS ((lang_statement_union_type *, bfd_boolean));
-static void lang_reasonable_defaults
- PARAMS ((void));
-static void insert_undefined
- PARAMS ((const char *));
-static void lang_place_undefineds
- PARAMS ((void));
-static void map_input_to_output_sections
- PARAMS ((lang_statement_union_type *, const char *,
- lang_output_section_statement_type *));
-static void strip_excluded_output_sections
- PARAMS ((void));
-static void print_output_section_statement
- PARAMS ((lang_output_section_statement_type *));
-static void print_assignment
- PARAMS ((lang_assignment_statement_type *,
- lang_output_section_statement_type *));
-static void print_input_statement
- PARAMS ((lang_input_statement_type *));
-static bfd_boolean print_one_symbol
- PARAMS ((struct bfd_link_hash_entry *, PTR));
-static void print_input_section
- PARAMS ((lang_input_section_type *));
-static void print_fill_statement
- PARAMS ((lang_fill_statement_type *));
-static void print_data_statement
- PARAMS ((lang_data_statement_type *));
-static void print_address_statement
- PARAMS ((lang_address_statement_type *));
-static void print_reloc_statement
- PARAMS ((lang_reloc_statement_type *));
-static void print_padding_statement
- PARAMS ((lang_padding_statement_type *));
-static void print_wild_statement
- PARAMS ((lang_wild_statement_type *, lang_output_section_statement_type *));
-static void print_group
- PARAMS ((lang_group_statement_type *, lang_output_section_statement_type *));
-static void print_statement
- PARAMS ((lang_statement_union_type *, lang_output_section_statement_type *));
-static void print_statement_list
- PARAMS ((lang_statement_union_type *, lang_output_section_statement_type *));
-static void print_statements
- PARAMS ((void));
-static void insert_pad
- PARAMS ((lang_statement_union_type **, fill_type *,
- unsigned int, asection *, bfd_vma));
-static bfd_vma size_input_section
- PARAMS ((lang_statement_union_type **, lang_output_section_statement_type *,
- fill_type *, bfd_vma));
-static void lang_finish
- PARAMS ((void));
-static void ignore_bfd_errors
- PARAMS ((const char *, ...));
-static void lang_check
- PARAMS ((void));
-static void lang_common
- PARAMS ((void));
-static bfd_boolean lang_one_common
- PARAMS ((struct bfd_link_hash_entry *, PTR));
-static void lang_place_orphans
- PARAMS ((void));
-static int topower
- PARAMS ((int));
-static void lang_set_startof
- PARAMS ((void));
-static void gc_section_callback
- PARAMS ((lang_wild_statement_type *, struct wildcard_list *, asection *,
- lang_input_statement_type *, PTR));
-static void lang_get_regions
- PARAMS ((struct memory_region_struct **, struct memory_region_struct **,
- const char *, const char *, int));
-static void lang_record_phdrs
- PARAMS ((void));
-static void lang_gc_wild
- PARAMS ((lang_wild_statement_type *));
-static void lang_gc_sections_1
- PARAMS ((lang_statement_union_type *));
-static void lang_gc_sections
- PARAMS ((void));
-static int lang_vers_match_lang_c
- PARAMS ((struct bfd_elf_version_expr *, const char *));
-static int lang_vers_match_lang_cplusplus
- PARAMS ((struct bfd_elf_version_expr *, const char *));
-static int lang_vers_match_lang_java
- PARAMS ((struct bfd_elf_version_expr *, const char *));
-static void lang_do_version_exports_section
- PARAMS ((void));
-static void lang_check_section_addresses
- PARAMS ((void));
-static void os_region_check
- PARAMS ((lang_output_section_statement_type *,
- struct memory_region_struct *, etree_type *, bfd_vma));
-static bfd_vma lang_size_sections_1
- PARAMS ((lang_statement_union_type *, lang_output_section_statement_type *,
- lang_statement_union_type **, fill_type *, bfd_vma, bfd_boolean *,
- bfd_boolean));
-typedef void (*callback_t)
- PARAMS ((lang_wild_statement_type *, struct wildcard_list *, asection *,
- lang_input_statement_type *, PTR));
-static void walk_wild
- PARAMS ((lang_wild_statement_type *, callback_t, PTR));
-static void walk_wild_section
- PARAMS ((lang_wild_statement_type *, lang_input_statement_type *,
- callback_t, PTR));
-static void walk_wild_file
- PARAMS ((lang_wild_statement_type *, lang_input_statement_type *,
- callback_t, PTR));
-static int get_target
- PARAMS ((const bfd_target *, PTR));
-static void stricpy
- PARAMS ((char *, char *));
-static void strcut
- PARAMS ((char *, char *));
-static int name_compare
- PARAMS ((char *, char *));
-static int closest_target_match
- PARAMS ((const bfd_target *, PTR));
-static char * get_first_input_target
- PARAMS ((void));
+static void exp_init_os (etree_type *);
+static bfd_boolean wildcardp (const char *);
+static lang_input_statement_type *lookup_name (const char *);
+static bfd_boolean load_symbols (lang_input_statement_type *,
+ lang_statement_list_type *);
+static void insert_undefined (const char *);
+static void print_statement (lang_statement_union_type *,
+ lang_output_section_statement_type *);
+static void print_statement_list (lang_statement_union_type *,
+ lang_output_section_statement_type *);
+static void print_statements (void);
+static bfd_boolean lang_one_common (struct bfd_link_hash_entry *, void *);
+static void lang_record_phdrs (void);
+static void lang_do_version_exports_section (void);
+
+typedef void (*callback_t) (lang_wild_statement_type *, struct wildcard_list *,
+ asection *, lang_input_statement_type *, void *);
/* Exported variables. */
lang_output_section_statement_type *abs_output_section;
etree_type *base; /* Relocation base - or null */
-#if defined (__STDC__) || defined (ALMOST_STDC)
-#define cat(a,b) a##b
-#else
-#define cat(a,b) a/**/b
-#endif
-
-/* Don't beautify the line below with "innocent" whitespace, it breaks
- the K&R C preprocessor! */
#define new_stat(x, y) \
- (cat (x,_type)*) new_statement (cat (x,_enum), sizeof (cat (x,_type)), y)
+ (x##_type *) new_statement (x##_enum, sizeof (x##_type), y)
#define outside_section_address(q) \
((q)->output_offset + (q)->output_section->vma)
#define SECTION_NAME_MAP_LENGTH (16)
-PTR
-stat_alloc (size)
- size_t size;
+void *
+stat_alloc (size_t size)
{
return obstack_alloc (&stat_obstack, size);
}
bfd_boolean
-unique_section_p (secnam)
- const char *secnam;
+unique_section_p (const char *secnam)
{
struct unique_sections *unam;
/* Generic traversal routines for finding matching sections. */
static void
-walk_wild_section (ptr, file, callback, data)
- lang_wild_statement_type *ptr;
- lang_input_statement_type *file;
- callback_t callback;
- PTR data;
+walk_wild_section (lang_wild_statement_type *ptr,
+ lang_input_statement_type *file,
+ callback_t callback,
+ void *data)
{
asection *s;
/* Handle a wild statement for a single file F. */
static void
-walk_wild_file (s, f, callback, data)
- lang_wild_statement_type *s;
- lang_input_statement_type *f;
- callback_t callback;
- PTR data;
+walk_wild_file (lang_wild_statement_type *s,
+ lang_input_statement_type *f,
+ callback_t callback,
+ void *data)
{
if (f->the_bfd == NULL
|| ! bfd_check_format (f->the_bfd, bfd_archive))
/* This is an archive file. We must map each member of the
archive separately. */
- member = bfd_openr_next_archived_file (f->the_bfd, (bfd *) NULL);
+ member = bfd_openr_next_archived_file (f->the_bfd, NULL);
while (member != NULL)
{
/* When lookup_name is called, it will call the add_symbols
lang_input_statement. */
if (member->usrdata != NULL)
{
- walk_wild_section (s,
- (lang_input_statement_type *) member->usrdata,
- callback, data);
+ walk_wild_section (s, member->usrdata, callback, data);
}
member = bfd_openr_next_archived_file (f->the_bfd, member);
}
static void
-walk_wild (s, callback, data)
- lang_wild_statement_type *s;
- callback_t callback;
- PTR data;
+walk_wild (lang_wild_statement_type *s, callback_t callback, void *data)
{
const char *file_spec = s->filename;
function for each node. */
static void
-lang_for_each_statement_worker (func, s)
- void (*func) PARAMS ((lang_statement_union_type *));
- lang_statement_union_type *s;
+lang_for_each_statement_worker (void (*func) (lang_statement_union_type *),
+ lang_statement_union_type *s)
{
- for (; s != (lang_statement_union_type *) NULL; s = s->header.next)
+ for (; s != NULL; s = s->header.next)
{
func (s);
}
void
-lang_for_each_statement (func)
- void (*func) PARAMS ((lang_statement_union_type *));
+lang_for_each_statement (void (*func) (lang_statement_union_type *))
{
lang_for_each_statement_worker (func, statement_list.head);
}
/*----------------------------------------------------------------------*/
void
-lang_list_init (list)
- lang_statement_list_type *list;
+lang_list_init (lang_statement_list_type *list)
{
- list->head = (lang_statement_union_type *) NULL;
+ list->head = NULL;
list->tail = &list->head;
}
/* Build a new statement node for the parse tree. */
static lang_statement_union_type *
-new_statement (type, size, list)
- enum statement_enum type;
- size_t size;
- lang_statement_list_type *list;
+new_statement (enum statement_enum type,
+ size_t size,
+ lang_statement_list_type *list)
{
- lang_statement_union_type *new = (lang_statement_union_type *)
- stat_alloc (size);
+ lang_statement_union_type *new;
+ new = stat_alloc (size);
new->header.type = type;
- new->header.next = (lang_statement_union_type *) NULL;
+ new->header.next = NULL;
lang_statement_append (list, new, &new->header.next);
return new;
}
got it already so we don't duplicate the bfd. */
static lang_input_statement_type *
-new_afile (name, file_type, target, add_to_list)
- const char *name;
- lang_input_file_enum_type file_type;
- const char *target;
- bfd_boolean add_to_list;
+new_afile (const char *name,
+ lang_input_file_enum_type file_type,
+ const char *target,
+ bfd_boolean add_to_list)
{
lang_input_statement_type *p;
p = new_stat (lang_input_statement, stat_ptr);
else
{
- p = ((lang_input_statement_type *)
- stat_alloc (sizeof (lang_input_statement_type)));
+ p = stat_alloc (sizeof (lang_input_statement_type));
p->header.next = NULL;
}
p->is_archive = TRUE;
p->filename = name;
p->real = TRUE;
- p->local_sym_name = concat ("-l", name, (const char *) NULL);
+ p->local_sym_name = concat ("-l", name, NULL);
p->just_syms_flag = FALSE;
p->search_dirs_flag = TRUE;
break;
default:
FAIL ();
}
- p->the_bfd = (bfd *) NULL;
- p->asymbols = (asymbol **) NULL;
- p->next_real_file = (lang_statement_union_type *) NULL;
- p->next = (lang_statement_union_type *) NULL;
+ p->the_bfd = NULL;
+ p->asymbols = NULL;
+ p->next_real_file = NULL;
+ p->next = NULL;
p->symbol_count = 0;
p->dynamic = config.dynamic_link;
p->whole_archive = whole_archive;
}
lang_input_statement_type *
-lang_add_input_file (name, file_type, target)
- const char *name;
- lang_input_file_enum_type file_type;
- const char *target;
+lang_add_input_file (const char *name,
+ lang_input_file_enum_type file_type,
+ const char *target)
{
lang_has_input_file = TRUE;
return new_afile (name, file_type, target, TRUE);
/* Build enough state so that the parser can build its tree. */
void
-lang_init ()
+lang_init (void)
{
obstack_begin (&stat_obstack, 1000);
lang_list_init (&input_file_chain);
lang_list_init (&lang_output_section_statement);
lang_list_init (&file_chain);
- first_file = lang_add_input_file ((char *) NULL,
- lang_input_file_is_marker_enum,
- (char *) NULL);
+ first_file = lang_add_input_file (NULL, lang_input_file_is_marker_enum,
+ NULL);
abs_output_section =
lang_output_section_statement_lookup (BFD_ABS_SECTION_NAME);
abs_output_section->bfd_section = bfd_abs_section_ptr;
-
}
/*----------------------------------------------------------------------
static lang_memory_region_type **lang_memory_region_list_tail = &lang_memory_region_list;
lang_memory_region_type *
-lang_memory_region_lookup (name)
- const char *const name;
+lang_memory_region_lookup (const char *const name)
{
lang_memory_region_type *p;
+ lang_memory_region_type *new;
/* NAME is NULL for LMA memspecs if no region was specified. */
if (name == NULL)
return NULL;
- for (p = lang_memory_region_list;
- p != (lang_memory_region_type *) NULL;
- p = p->next)
+ for (p = lang_memory_region_list; p != NULL; p = p->next)
{
if (strcmp (p->name, name) == 0)
- {
- return p;
- }
+ return p;
}
#if 0
a region. */
if (strcmp (name, "*default*") == 0)
{
- if (lang_memory_region_list != (lang_memory_region_type *) NULL)
- {
- return lang_memory_region_list;
- }
+ if (lang_memory_region_list != NULL)
+ return lang_memory_region_list;
}
#endif
- {
- lang_memory_region_type *new =
- (lang_memory_region_type *) stat_alloc (sizeof (lang_memory_region_type));
+ new = stat_alloc (sizeof (lang_memory_region_type));
- new->name = xstrdup (name);
- new->next = (lang_memory_region_type *) NULL;
+ new->name = xstrdup (name);
+ new->next = NULL;
- *lang_memory_region_list_tail = new;
- lang_memory_region_list_tail = &new->next;
- new->origin = 0;
- new->flags = 0;
- new->not_flags = 0;
- new->length = ~(bfd_size_type) 0;
- new->current = 0;
- new->had_full_message = FALSE;
+ *lang_memory_region_list_tail = new;
+ lang_memory_region_list_tail = &new->next;
+ new->origin = 0;
+ new->flags = 0;
+ new->not_flags = 0;
+ new->length = ~(bfd_size_type) 0;
+ new->current = 0;
+ new->had_full_message = FALSE;
- return new;
- }
+ return new;
}
static lang_memory_region_type *
-lang_memory_default (section)
- asection *section;
+lang_memory_default (asection *section)
{
lang_memory_region_type *p;
if ((sec_flags & (SEC_ALLOC | SEC_READONLY | SEC_CODE)) == SEC_ALLOC)
sec_flags |= SEC_DATA;
- for (p = lang_memory_region_list;
- p != (lang_memory_region_type *) NULL;
- p = p->next)
+ for (p = lang_memory_region_list; p != NULL; p = p->next)
{
if ((p->flags & sec_flags) != 0
&& (p->not_flags & sec_flags) == 0)
}
lang_output_section_statement_type *
-lang_output_section_find (name)
- const char *const name;
+lang_output_section_find (const char *const name)
{
lang_statement_union_type *u;
lang_output_section_statement_type *lookup;
- for (u = lang_output_section_statement.head;
- u != (lang_statement_union_type *) NULL;
- u = lookup->next)
+ for (u = lang_output_section_statement.head; u != NULL; u = lookup->next)
{
lookup = &u->output_section_statement;
if (strcmp (name, lookup->name) == 0)
- {
- return lookup;
- }
+ return lookup;
}
- return (lang_output_section_statement_type *) NULL;
+ return NULL;
}
lang_output_section_statement_type *
-lang_output_section_statement_lookup (name)
- const char *const name;
+lang_output_section_statement_lookup (const char *const name)
{
lang_output_section_statement_type *lookup;
lookup = lang_output_section_find (name);
- if (lookup == (lang_output_section_statement_type *) NULL)
+ if (lookup == NULL)
{
-
- lookup = (lang_output_section_statement_type *)
- new_stat (lang_output_section_statement, stat_ptr);
- lookup->region = (lang_memory_region_type *) NULL;
- lookup->lma_region = (lang_memory_region_type *) NULL;
- lookup->fill = (fill_type *) 0;
+ lookup = new_stat (lang_output_section_statement, stat_ptr);
+ lookup->region = NULL;
+ lookup->lma_region = NULL;
+ lookup->fill = 0;
lookup->block_value = 1;
lookup->name = name;
- lookup->next = (lang_statement_union_type *) NULL;
- lookup->bfd_section = (asection *) NULL;
+ lookup->next = NULL;
+ lookup->bfd_section = NULL;
lookup->processed = FALSE;
lookup->sectype = normal_section;
- lookup->addr_tree = (etree_type *) NULL;
+ lookup->addr_tree = NULL;
lang_list_init (&lookup->children);
- lookup->memspec = (const char *) NULL;
+ lookup->memspec = NULL;
lookup->flags = 0;
lookup->subsection_alignment = -1;
lookup->section_alignment = -1;
- lookup->load_base = (union etree_union *) NULL;
+ lookup->load_base = NULL;
lookup->update_dot_tree = NULL;
lookup->phdrs = NULL;
}
static void
-lang_map_flags (flag)
- flagword flag;
+lang_map_flags (flagword flag)
{
if (flag & SEC_ALLOC)
minfo ("a");
}
void
-lang_map ()
+lang_map (void)
{
lang_memory_region_type *m;
fprintf (config.map_file, "%-16s %-18s %-18s %s\n",
_("Name"), _("Origin"), _("Length"), _("Attributes"));
- for (m = lang_memory_region_list;
- m != (lang_memory_region_type *) NULL;
- m = m->next)
+ for (m = lang_memory_region_list; m != NULL; m = m->next)
{
char buf[100];
int len;
/* Initialize an output section. */
static void
-init_os (s)
- lang_output_section_statement_type *s;
+init_os (lang_output_section_statement_type *s)
{
section_userdata_type *new;
if (strcmp (s->name, DISCARD_SECTION_NAME) == 0)
einfo (_("%P%F: Illegal use of `%s' section\n"), DISCARD_SECTION_NAME);
- new = ((section_userdata_type *)
- stat_alloc (sizeof (section_userdata_type)));
+ new = stat_alloc (sizeof (section_userdata_type));
s->bfd_section = bfd_get_section_by_name (output_bfd, s->name);
- if (s->bfd_section == (asection *) NULL)
+ if (s->bfd_section == NULL)
s->bfd_section = bfd_make_section (output_bfd, s->name);
- if (s->bfd_section == (asection *) NULL)
+ if (s->bfd_section == NULL)
{
einfo (_("%P%F: output format %s cannot represent section called %s\n"),
output_bfd->xvec->name, s->name);
/* We initialize an output sections output offset to minus its own
vma to allow us to output a section through itself. */
s->bfd_section->output_offset = 0;
- get_userdata (s->bfd_section) = (PTR) new;
+ get_userdata (s->bfd_section) = new;
/* If there is a base address, make sure that any sections it might
mention are initialized. */
initialized. */
static void
-exp_init_os (exp)
- etree_type *exp;
+exp_init_os (etree_type *exp)
{
switch (exp->type.node_class)
{
static struct bfd_hash_table already_linked_table;
static void
-section_already_linked (abfd, sec, data)
- bfd *abfd;
- asection *sec;
- PTR data;
+section_already_linked (bfd *abfd, asection *sec, void *data)
{
- lang_input_statement_type *entry = (lang_input_statement_type *) data;
+ lang_input_statement_type *entry = data;
flagword flags;
const char *name;
struct already_linked *l;
/* This is the first section with this name. Record it. Allocate
the memory from the same obstack as the hash table is kept in. */
- l = ((struct already_linked *)
- bfd_hash_allocate (&already_linked_table, sizeof *l));
+ l = bfd_hash_allocate (&already_linked_table, sizeof *l);
l->sec = sec;
l->next = already_linked_list->entry;
initialize the table, fill in an entry and remove the table. */
static struct bfd_hash_entry *
-already_linked_newfunc (entry, table, string)
- struct bfd_hash_entry *entry ATTRIBUTE_UNUSED;
- struct bfd_hash_table *table;
- const char *string ATTRIBUTE_UNUSED;
+already_linked_newfunc (struct bfd_hash_entry *entry ATTRIBUTE_UNUSED,
+ struct bfd_hash_table *table,
+ const char *string ATTRIBUTE_UNUSED)
{
struct already_linked_hash_entry *ret =
bfd_hash_allocate (table, sizeof (struct already_linked_hash_entry));
ret->entry = NULL;
- return (struct bfd_hash_entry *) ret;
+ return &ret->root;
}
static void
-already_linked_table_init ()
+already_linked_table_init (void)
{
if (! bfd_hash_table_init_n (&already_linked_table,
already_linked_newfunc,
}
static void
-already_linked_table_free ()
+already_linked_table_free (void)
{
bfd_hash_table_free (&already_linked_table);
}
That lets us handle DOS filenames more naturally. */
static bfd_boolean
-wildcardp (pattern)
- const char *pattern;
+wildcardp (const char *pattern)
{
const char *s;
input file which holds SECTION. */
void
-lang_add_section (ptr, section, output, file)
- lang_statement_list_type *ptr;
- asection *section;
- lang_output_section_statement_type *output;
- lang_input_statement_type *file;
+lang_add_section (lang_statement_list_type *ptr,
+ asection *section,
+ lang_output_section_statement_type *output,
+ lang_input_statement_type *file)
{
flagword flags;
bfd_boolean discard;
new section should just go at the end of the current list. */
static lang_statement_union_type *
-wild_sort (wild, sec, file, section)
- lang_wild_statement_type *wild;
- struct wildcard_list *sec;
- lang_input_statement_type *file;
- asection *section;
+wild_sort (lang_wild_statement_type *wild,
+ struct wildcard_list *sec,
+ lang_input_statement_type *file,
+ asection *section)
{
const char *section_name;
lang_statement_union_type *l;
NULL, in which case it is a wild card. */
static void
-output_section_callback (ptr, sec, section, file, output)
- lang_wild_statement_type *ptr;
- struct wildcard_list *sec;
- asection *section;
- lang_input_statement_type *file;
- PTR output;
+output_section_callback (lang_wild_statement_type *ptr,
+ struct wildcard_list *sec,
+ asection *section,
+ lang_input_statement_type *file,
+ void *output)
{
lang_statement_union_type *before;
already and had its symbols read. If not then we'll read it. */
static lang_input_statement_type *
-lookup_name (name)
- const char *name;
+lookup_name (const char *name)
{
lang_input_statement_type *search;
for (search = (lang_input_statement_type *) input_file_chain.head;
- search != (lang_input_statement_type *) NULL;
+ search != NULL;
search = (lang_input_statement_type *) search->next_real_file)
{
- if (search->filename == (char *) NULL && name == (char *) NULL)
+ if (search->filename == NULL && name == NULL)
return search;
- if (search->filename != (char *) NULL
- && name != (char *) NULL
+ if (search->filename != NULL
+ && name != NULL
&& strcmp (search->filename, name) == 0)
break;
}
- if (search == (lang_input_statement_type *) NULL)
+ if (search == NULL)
search = new_afile (name, lang_input_file_is_file_enum, default_target,
FALSE);
(FIXME: can that ever actually happen?) don't add this file. */
if (search->loaded
|| ! search->real
- || search->filename == (const char *) NULL)
+ || search->filename == NULL)
return search;
- if (! load_symbols (search, (lang_statement_list_type *) NULL))
+ if (! load_symbols (search, NULL))
return NULL;
return search;
/* Get the symbols for an input file. */
static bfd_boolean
-load_symbols (entry, place)
- lang_input_statement_type *entry;
- lang_statement_list_type *place;
+load_symbols (lang_input_statement_type *entry,
+ lang_statement_list_type *place)
{
char **matching;
the output section. */
static void
-wild (s, target, output)
- lang_wild_statement_type *s;
- const char *target ATTRIBUTE_UNUSED;
- lang_output_section_statement_type *output;
+wild (lang_wild_statement_type *s,
+ const char *target ATTRIBUTE_UNUSED,
+ lang_output_section_statement_type *output)
{
struct wildcard_list *sec;
- walk_wild (s, output_section_callback, (PTR) output);
+ walk_wild (s, output_section_callback, output);
for (sec = s->section_list; sec != NULL; sec = sec->next)
{
/* Return TRUE iff target is the sought target. */
static int
-get_target (target, data)
- const bfd_target *target;
- PTR data;
+get_target (const bfd_target *target, void *data)
{
- const char *sought = (const char *) data;
+ const char *sought = data;
return strcmp (target->name, sought) == 0;
}
/* Like strcpy() but convert to lower case as well. */
static void
-stricpy (dest, src)
- char *dest;
- char *src;
+stricpy (char *dest, char *src)
{
char c;
from haystack. */
static void
-strcut (haystack, needle)
- char *haystack;
- char *needle;
+strcut (char *haystack, char *needle)
{
haystack = strstr (haystack, needle);
Return a value indicating how "similar" they are. */
static int
-name_compare (first, second)
- char *first;
- char *second;
+name_compare (char *first, char *second)
{
char *copy1;
char *copy2;
stricpy (copy1, first);
stricpy (copy2, second);
- /* Remove and endian strings from the name. */
+ /* Remove size and endian strings from the name. */
strcut (copy1, "big");
strcut (copy1, "little");
strcut (copy2, "big");
match to the original output target. */
static int
-closest_target_match (target, data)
- const bfd_target *target;
- PTR data;
+closest_target_match (const bfd_target *target, void *data)
{
- const bfd_target *original = (const bfd_target *) data;
+ const bfd_target *original = data;
if (command_line.endian == ENDIAN_BIG
&& target->byteorder != BFD_ENDIAN_BIG)
/* Return the BFD target format of the first input file. */
static char *
-get_first_input_target ()
+get_first_input_target (void)
{
char *target = NULL;
}
const char *
-lang_get_output_target ()
+lang_get_output_target (void)
{
const char *target;
/* Has the user told us which output format to use? */
- if (output_target != (char *) NULL)
+ if (output_target != NULL)
return output_target;
/* No - has the current target been set to something other than
/* Open the output file. */
static bfd *
-open_output (name)
- const char *name;
+open_output (const char *name)
{
bfd *output;
enum bfd_endian desired_endian;
/* Get the chosen target. */
- target = bfd_search_for_target (get_target, (PTR) output_target);
+ target = bfd_search_for_target (get_target, (void *) output_target);
/* If the target is not supported, we cannot do anything. */
if (target != NULL)
/* Try to find a target as similar as possible to
the default target, but which has the desired
endian characteristic. */
- (void) bfd_search_for_target (closest_target_match,
- (PTR) target);
+ bfd_search_for_target (closest_target_match,
+ (void *) target);
/* Oh dear - we could not find any targets that
satisfy our requirements. */
output = bfd_openw (name, output_target);
- if (output == (bfd *) NULL)
+ if (output == NULL)
{
if (bfd_get_error () == bfd_error_invalid_target)
einfo (_("%P%F: target %s not found\n"), output_target);
einfo (_("%P%F:%s: can not set architecture: %E\n"), name);
link_info.hash = bfd_link_hash_table_create (output);
- if (link_info.hash == (struct bfd_link_hash_table *) NULL)
+ if (link_info.hash == NULL)
einfo (_("%P%F: can not create link hash table: %E\n"));
bfd_set_gp_size (output, g_switch_value);
}
static void
-ldlang_open_output (statement)
- lang_statement_union_type *statement;
+ldlang_open_output (lang_statement_union_type *statement)
{
switch (statement->header.type)
{
case lang_output_statement_enum:
- ASSERT (output_bfd == (bfd *) NULL);
+ ASSERT (output_bfd == NULL);
output_bfd = open_output (statement->output_statement.name);
ldemul_set_output_arch ();
if (config.magic_demand_paged && !link_info.relocatable)
/* Open all the input files. */
static void
-open_input_bfds (s, force)
- lang_statement_union_type *s;
- bfd_boolean force;
+open_input_bfds (lang_statement_union_type *s, bfd_boolean force)
{
- for (; s != (lang_statement_union_type *) NULL; s = s->header.next)
+ for (; s != NULL; s = s->header.next)
{
switch (s->header.type)
{
section. */
static void
-lang_reasonable_defaults ()
+lang_reasonable_defaults (void)
{
#if 0
lang_output_section_statement_lookup (".text");
&default_common_section->children);
new->section_name = "COMMON";
- new->filename = (char *) NULL;
+ new->filename = NULL;
lang_list_init (&new->children);
}
#endif
#define ldlang_undef_chain_list_head entry_symbol.next
void
-ldlang_add_undef (name)
- const char *const name;
+ldlang_add_undef (const char *const name)
{
ldlang_undef_chain_list_type *new =
- ((ldlang_undef_chain_list_type *)
- stat_alloc (sizeof (ldlang_undef_chain_list_type)));
+ stat_alloc (sizeof (ldlang_undef_chain_list_type));
new->next = ldlang_undef_chain_list_head;
ldlang_undef_chain_list_head = new;
/* Insert NAME as undefined in the symbol table. */
static void
-insert_undefined (name)
- const char *name;
+insert_undefined (const char *name)
{
struct bfd_link_hash_entry *h;
h = bfd_link_hash_lookup (link_info.hash, name, TRUE, FALSE, TRUE);
- if (h == (struct bfd_link_hash_entry *) NULL)
+ if (h == NULL)
einfo (_("%P%F: bfd_link_hash_lookup failed: %E\n"));
if (h->type == bfd_link_hash_new)
{
script file. */
static void
-lang_place_undefineds ()
+lang_place_undefineds (void)
{
ldlang_undef_chain_list_type *ptr;
- for (ptr = ldlang_undef_chain_list_head;
- ptr != (ldlang_undef_chain_list_type *) NULL;
- ptr = ptr->next)
- {
- insert_undefined (ptr->name);
- }
+ for (ptr = ldlang_undef_chain_list_head; ptr != NULL; ptr = ptr->next)
+ insert_undefined (ptr->name);
}
/* Open input files and attach to output sections. */
static void
-map_input_to_output_sections (s, target, output_section_statement)
- lang_statement_union_type *s;
- const char *target;
- lang_output_section_statement_type *output_section_statement;
+map_input_to_output_sections
+ (lang_statement_union_type *s, const char *target,
+ lang_output_section_statement_type *output_section_statement)
{
- for (; s != (lang_statement_union_type *) NULL; s = s->header.next)
+ for (; s != NULL; s = s->header.next)
{
switch (s->header.type)
{
sections if they turn out to be not needed. Clean them up here. */
static void
-strip_excluded_output_sections ()
+strip_excluded_output_sections (void)
{
lang_statement_union_type *u;
}
static void
-print_output_section_statement (output_section_statement)
- lang_output_section_statement_type *output_section_statement;
+print_output_section_statement
+ (lang_output_section_statement_type *output_section_statement)
{
asection *section = output_section_statement->bfd_section;
int len;
}
static void
-print_assignment (assignment, output_section)
- lang_assignment_statement_type *assignment;
- lang_output_section_statement_type *output_section;
+print_assignment (lang_assignment_statement_type *assignment,
+ lang_output_section_statement_type *output_section)
{
int i;
etree_value_type result;
}
static void
-print_input_statement (statm)
- lang_input_statement_type *statm;
+print_input_statement (lang_input_statement_type *statm)
{
- if (statm->filename != (char *) NULL)
+ if (statm->filename != NULL)
{
fprintf (config.map_file, "LOAD %s\n", statm->filename);
}
via bfd_link_hash_traverse. */
static bfd_boolean
-print_one_symbol (hash_entry, ptr)
- struct bfd_link_hash_entry *hash_entry;
- PTR ptr;
+print_one_symbol (struct bfd_link_hash_entry *hash_entry, void *ptr)
{
- asection *sec = (asection *) ptr;
+ asection *sec = ptr;
if ((hash_entry->type == bfd_link_hash_defined
|| hash_entry->type == bfd_link_hash_defweak)
/* Print information about an input section to the map file. */
static void
-print_input_section (in)
- lang_input_section_type *in;
+print_input_section (lang_input_section_type *in)
{
asection *i = in->section;
bfd_size_type size = i->_cooked_size != 0 ? i->_cooked_size : i->_raw_size;
minfo (_("%W (size before relaxing)\n"), i->_raw_size);
}
- bfd_link_hash_traverse (link_info.hash, print_one_symbol, (PTR) i);
+ bfd_link_hash_traverse (link_info.hash, print_one_symbol, i);
print_dot = i->output_section->vma + i->output_offset + size / opb;
}
}
static void
-print_fill_statement (fill)
- lang_fill_statement_type *fill;
+print_fill_statement (lang_fill_statement_type *fill)
{
size_t size;
unsigned char *p;
}
static void
-print_data_statement (data)
- lang_data_statement_type *data;
+print_data_statement (lang_data_statement_type *data)
{
int i;
bfd_vma addr;
-Ttext. */
static void
-print_address_statement (address)
- lang_address_statement_type *address;
+print_address_statement (lang_address_statement_type *address)
{
minfo (_("Address of section %s set to "), address->section_name);
exp_print_tree (address->address);
/* Print a reloc statement. */
static void
-print_reloc_statement (reloc)
- lang_reloc_statement_type *reloc;
+print_reloc_statement (lang_reloc_statement_type *reloc)
{
int i;
bfd_vma addr;
}
static void
-print_padding_statement (s)
- lang_padding_statement_type *s;
+print_padding_statement (lang_padding_statement_type *s)
{
int len;
bfd_vma addr;
}
static void
-print_wild_statement (w, os)
- lang_wild_statement_type *w;
- lang_output_section_statement_type *os;
+print_wild_statement (lang_wild_statement_type *w,
+ lang_output_section_statement_type *os)
{
struct wildcard_list *sec;
/* Print a group statement. */
static void
-print_group (s, os)
- lang_group_statement_type *s;
- lang_output_section_statement_type *os;
+print_group (lang_group_statement_type *s,
+ lang_output_section_statement_type *os)
{
fprintf (config.map_file, "START GROUP\n");
print_statement_list (s->children.head, os);
This can be called for any statement type. */
static void
-print_statement_list (s, os)
- lang_statement_union_type *s;
- lang_output_section_statement_type *os;
+print_statement_list (lang_statement_union_type *s,
+ lang_output_section_statement_type *os)
{
while (s != NULL)
{
This can be called for any statement type. */
static void
-print_statement (s, os)
- lang_statement_union_type *s;
- lang_output_section_statement_type *os;
+print_statement (lang_statement_union_type *s,
+ lang_output_section_statement_type *os)
{
switch (s->header.type)
{
}
static void
-print_statements ()
+print_statements (void)
{
print_statement_list (statement_list.head, abs_output_section);
}
Intended to be called from GDB. */
void
-dprint_statement (s, n)
- lang_statement_union_type *s;
- int n;
+dprint_statement (lang_statement_union_type *s, int n)
{
FILE *map_save = config.map_file;
}
static void
-insert_pad (ptr, fill, alignment_needed, output_section, dot)
- lang_statement_union_type **ptr;
- fill_type *fill;
- unsigned int alignment_needed;
- asection *output_section;
- bfd_vma dot;
+insert_pad (lang_statement_union_type **ptr,
+ fill_type *fill,
+ unsigned int alignment_needed,
+ asection *output_section,
+ bfd_vma dot)
{
static fill_type zero_fill = { 1, { 0 } };
lang_statement_union_type *pad;
else
{
/* Make a new padding statement, linked into existing chain. */
- pad = ((lang_statement_union_type *)
- stat_alloc (sizeof (lang_padding_statement_type)));
+ pad = stat_alloc (sizeof (lang_padding_statement_type));
pad->header.next = *ptr;
*ptr = pad;
pad->header.type = lang_padding_statement_enum;
pad->padding_statement.output_section = output_section;
- if (fill == (fill_type *) 0)
+ if (fill == NULL)
fill = &zero_fill;
pad->padding_statement.fill = fill;
}
/* Work out how much this section will move the dot point. */
static bfd_vma
-size_input_section (this_ptr, output_section_statement, fill, dot)
- lang_statement_union_type **this_ptr;
- lang_output_section_statement_type *output_section_statement;
- fill_type *fill;
- bfd_vma dot;
+size_input_section (lang_statement_union_type **this_ptr,
+ lang_output_section_statement_type *output_section_statement,
+ fill_type *fill,
+ bfd_vma dot)
{
lang_input_section_type *is = &((*this_ptr)->input_section);
asection *i = is->section;
the output section addresses of the two sections. */
static void
-lang_check_section_addresses ()
+lang_check_section_addresses (void)
{
asection *s;
unsigned opb = bfd_octets_per_byte (output_bfd);
calculation wraps around. */
static void
-os_region_check (os, region, tree, base)
- lang_output_section_statement_type *os;
- struct memory_region_struct *region;
- etree_type *tree;
- bfd_vma base;
+os_region_check (lang_output_section_statement_type *os,
+ struct memory_region_struct *region,
+ etree_type *tree,
+ bfd_vma base)
{
if ((region->current < region->origin
|| (region->current - region->origin > region->length))
&& ((region->current != region->origin + region->length)
|| base == 0))
{
- if (tree != (etree_type *) NULL)
+ if (tree != NULL)
{
einfo (_("%X%P: address 0x%v of %B section %s is not within region %s\n"),
region->current,
/* Set the sizes for all the output sections. */
static bfd_vma
-lang_size_sections_1 (s, output_section_statement, prev, fill, dot, relax,
- check_regions)
- lang_statement_union_type *s;
- lang_output_section_statement_type *output_section_statement;
- lang_statement_union_type **prev;
- fill_type *fill;
- bfd_vma dot;
- bfd_boolean *relax;
- bfd_boolean check_regions;
+lang_size_sections_1
+ (lang_statement_union_type *s,
+ lang_output_section_statement_type *output_section_statement,
+ lang_statement_union_type **prev,
+ fill_type *fill,
+ bfd_vma dot,
+ bfd_boolean *relax,
+ bfd_boolean check_regions)
{
unsigned opb = bfd_arch_mach_octets_per_byte (ldfile_output_architecture,
ldfile_output_machine);
/* Size up the sections from their constituent parts. */
- for (; s != (lang_statement_union_type *) NULL; s = s->header.next)
+ for (; s != NULL; s = s->header.next)
{
switch (s->header.type)
{
}
else
{
- if (os->addr_tree == (etree_type *) NULL)
+ if (os->addr_tree == NULL)
{
/* No address specified for this section, get one
from the region specification. */
- if (os->region == (lang_memory_region_type *) NULL
+ if (os->region == NULL
|| (((bfd_get_section_flags (output_bfd, os->bfd_section)
& (SEC_ALLOC | SEC_LOAD)) != 0)
&& os->region->name[0] == '*'
default memory region we can end up creating an
excessivly large binary, or even seg faulting when
attmepting to perform a negative seek. See
- http://sources.redhat.com/ml/binutils/2003-04/msg00423.html
+ http://sources.redhat.com/ml/binutils/2003-04/msg00423.html
for an example of this. This behaviour can be
overridden by the using the --no-check-sections
switch. */
If the SEC_NEVER_LOAD bit is not set, it will affect the
addresses of sections after it. We have to update
dot. */
- if (os->region != (lang_memory_region_type *) NULL
+ if (os->region != NULL
&& ((bfd_get_section_flags (output_bfd, os->bfd_section)
& SEC_NEVER_LOAD) == 0
|| (bfd_get_section_flags (output_bfd, os->bfd_section)
}
bfd_vma
-lang_size_sections (s, output_section_statement, prev, fill, dot, relax,
- check_regions)
- lang_statement_union_type *s;
- lang_output_section_statement_type *output_section_statement;
- lang_statement_union_type **prev;
- fill_type *fill;
- bfd_vma dot;
- bfd_boolean *relax;
- bfd_boolean check_regions;
+lang_size_sections
+ (lang_statement_union_type *s,
+ lang_output_section_statement_type *output_section_statement,
+ lang_statement_union_type **prev,
+ fill_type *fill,
+ bfd_vma dot,
+ bfd_boolean *relax,
+ bfd_boolean check_regions)
{
bfd_vma result;
}
bfd_vma
-lang_do_assignments (s, output_section_statement, fill, dot)
- lang_statement_union_type *s;
- lang_output_section_statement_type *output_section_statement;
- fill_type *fill;
- bfd_vma dot;
+lang_do_assignments
+ (lang_statement_union_type *s,
+ lang_output_section_statement_type *output_section_statement,
+ fill_type *fill,
+ bfd_vma dot)
{
unsigned opb = bfd_arch_mach_octets_per_byte (ldfile_output_architecture,
ldfile_output_machine);
- for (; s != (lang_statement_union_type *) NULL; s = s->header.next)
+ for (; s != NULL; s = s->header.next)
{
switch (s->header.type)
{
such symbols, and set them to the correct value. */
static void
-lang_set_startof ()
+lang_set_startof (void)
{
asection *s;
}
static void
-lang_finish ()
+lang_finish (void)
{
struct bfd_link_hash_entry *h;
bfd_boolean warn;
else
warn = TRUE;
- if (entry_symbol.name == (const char *) NULL)
+ if (entry_symbol.name == NULL)
{
/* No entry has been specified. Look for start, but don't warn
if we don't find it. */
h = bfd_link_hash_lookup (link_info.hash, entry_symbol.name,
FALSE, FALSE, TRUE);
- if (h != (struct bfd_link_hash_entry *) NULL
+ if (h != NULL
&& (h->type == bfd_link_hash_defined
|| h->type == bfd_link_hash_defweak)
&& h->u.def.section->output_section != NULL)
/* Can't find the entry symbol, and it's not a number. Use
the first address in the text section. */
ts = bfd_get_section_by_name (output_bfd, entry_section);
- if (ts != (asection *) NULL)
+ if (ts != NULL)
{
if (warn)
einfo (_("%P: warning: cannot find entry symbol %s; defaulting to %V\n"),
BFD. */
static void
-#ifdef ANSI_PROTOTYPES
ignore_bfd_errors (const char *s ATTRIBUTE_UNUSED, ...)
-#else
-ignore_bfd_errors (s)
- const char *s ATTRIBUTE_UNUSED;
-#endif
{
/* Don't do anything. */
}
other checking that is needed. */
static void
-lang_check ()
+lang_check (void)
{
lang_statement_union_type *file;
bfd *input_bfd;
const bfd_arch_info_type *compatible;
- for (file = file_chain.head;
- file != (lang_statement_union_type *) NULL;
- file = file->input_statement.next)
+ for (file = file_chain.head; file != NULL; file = file->input_statement.next)
{
input_bfd = file->input_statement.the_bfd;
compatible = bfd_arch_get_compatible (input_bfd, output_bfd,
to roughly sort the entries by size. */
static void
-lang_common ()
+lang_common (void)
{
if (command_line.inhibit_common_definition)
return;
return;
if (! config.sort_common)
- bfd_link_hash_traverse (link_info.hash, lang_one_common, (PTR) NULL);
+ bfd_link_hash_traverse (link_info.hash, lang_one_common, NULL);
else
{
int power;
for (power = 4; power >= 0; power--)
- bfd_link_hash_traverse (link_info.hash, lang_one_common,
- (PTR) &power);
+ bfd_link_hash_traverse (link_info.hash, lang_one_common, &power);
}
}
/* Place one common symbol in the correct section. */
static bfd_boolean
-lang_one_common (h, info)
- struct bfd_link_hash_entry *h;
- PTR info;
+lang_one_common (struct bfd_link_hash_entry *h, void *info)
{
unsigned int power_of_two;
bfd_vma size;
an input request and place it into the statement tree. */
static void
-lang_place_orphans ()
+lang_place_orphans (void)
{
LANG_FOR_EACH_INPUT_STATEMENT (file)
{
asection *s;
- for (s = file->the_bfd->sections;
- s != (asection *) NULL;
- s = s->next)
+ for (s = file->the_bfd->sections; s != NULL; s = s->next)
{
- if (s->output_section == (asection *) NULL)
+ if (s->output_section == NULL)
{
/* This section of the file is not attached, root
around for a sensible place for it to go. */
}
void
-lang_set_flags (ptr, flags, invert)
- lang_memory_region_type *ptr;
- const char *flags;
- int invert;
+lang_set_flags (lang_memory_region_type *ptr, const char *flags, int invert)
{
flagword *ptr_flags;
on an archive, but not on the elements. */
void
-lang_for_each_input_file (func)
- void (*func) PARAMS ((lang_input_statement_type *));
+lang_for_each_input_file (void (*func) (lang_input_statement_type *))
{
lang_input_statement_type *f;
not be called on the archive file itself. */
void
-lang_for_each_file (func)
- void (*func) PARAMS ((lang_input_statement_type *));
+lang_for_each_file (void (*func) (lang_input_statement_type *))
{
LANG_FOR_EACH_INPUT_STATEMENT (f)
{
/* Not used. */
void
-lang_for_each_input_section (func)
- void (*func) PARAMS ((bfd *ab, asection *as));
+lang_for_each_input_section (void (*func) (bfd *ab, asection *as))
{
LANG_FOR_EACH_INPUT_STATEMENT (f)
{
asection *s;
- for (s = f->the_bfd->sections;
- s != (asection *) NULL;
- s = s->next)
- {
- func (f->the_bfd, s);
- }
+ for (s = f->the_bfd->sections; s != NULL; s = s->next)
+ func (f->the_bfd, s);
}
}
#endif
void
-ldlang_add_file (entry)
- lang_input_statement_type *entry;
+ldlang_add_file (lang_input_statement_type *entry)
{
bfd **pp;
/* The BFD linker needs to have a list of all input BFDs involved in
a link. */
- ASSERT (entry->the_bfd->link_next == (bfd *) NULL);
+ ASSERT (entry->the_bfd->link_next == NULL);
ASSERT (entry->the_bfd != output_bfd);
- for (pp = &link_info.input_bfds;
- *pp != (bfd *) NULL;
- pp = &(*pp)->link_next)
+ for (pp = &link_info.input_bfds; *pp != NULL; pp = &(*pp)->link_next)
;
*pp = entry->the_bfd;
- entry->the_bfd->usrdata = (PTR) entry;
+ entry->the_bfd->usrdata = entry;
bfd_set_gp_size (entry->the_bfd, g_switch_value);
/* Look through the sections and check for any which should not be
each backend which might set the SEC_LINK_ONCE flag. If we do
this, we should probably handle SEC_EXCLUDE in the same way. */
- bfd_map_over_sections (entry->the_bfd, section_already_linked, (PTR) entry);
+ bfd_map_over_sections (entry->the_bfd, section_already_linked, entry);
}
void
-lang_add_output (name, from_script)
- const char *name;
- int from_script;
+lang_add_output (const char *name, int from_script)
{
/* Make -o on command line override OUTPUT in script. */
if (!had_output_filename || !from_script)
static lang_output_section_statement_type *current_section;
static int
-topower (x)
- int x;
+topower (int x)
{
unsigned int i = 1;
int l;
}
lang_output_section_statement_type *
-lang_enter_output_section_statement (output_section_statement_name,
- address_exp, sectype, block_value,
- align, subalign, ebase)
- const char *output_section_statement_name;
- etree_type *address_exp;
- enum section_type sectype;
- bfd_vma block_value;
- etree_type *align;
- etree_type *subalign;
- etree_type *ebase;
+lang_enter_output_section_statement (const char *output_section_statement_name,
+ etree_type *address_exp,
+ enum section_type sectype,
+ bfd_vma block_value,
+ etree_type *align,
+ etree_type *subalign,
+ etree_type *ebase)
{
lang_output_section_statement_type *os;
#endif
/* Make next things chain into subchain of this. */
- if (os->addr_tree == (etree_type *) NULL)
+ if (os->addr_tree == NULL)
{
os->addr_tree = address_exp;
}
}
void
-lang_final ()
+lang_final (void)
{
lang_output_statement_type *new =
new_stat (lang_output_statement, stat_ptr);
/* Reset the current counters in the regions. */
void
-lang_reset_memory_regions ()
+lang_reset_memory_regions (void)
{
lang_memory_region_type *p = lang_memory_region_list;
asection *o;
- for (p = lang_memory_region_list;
- p != (lang_memory_region_type *) NULL;
- p = p->next)
+ for (p = lang_memory_region_list; p != NULL; p = p->next)
{
p->old_length = (bfd_size_type) (p->current - p->origin);
p->current = p->origin;
should be as well. */
static void
-gc_section_callback (ptr, sec, section, file, data)
- lang_wild_statement_type *ptr;
- struct wildcard_list *sec ATTRIBUTE_UNUSED;
- asection *section;
- lang_input_statement_type *file ATTRIBUTE_UNUSED;
- PTR data ATTRIBUTE_UNUSED;
+gc_section_callback (lang_wild_statement_type *ptr,
+ struct wildcard_list *sec ATTRIBUTE_UNUSED,
+ asection *section,
+ lang_input_statement_type *file ATTRIBUTE_UNUSED,
+ void *data ATTRIBUTE_UNUSED)
{
if (ptr->keep_sections)
section->flags |= SEC_KEEP;
/* Handle a wild statement, marking it against GC. */
static void
-lang_gc_wild (s)
- lang_wild_statement_type *s;
+lang_gc_wild (lang_wild_statement_type *s)
{
walk_wild (s, gc_section_callback, NULL);
}
/* Iterate over sections marking them against GC. */
static void
-lang_gc_sections_1 (s)
- lang_statement_union_type *s;
+lang_gc_sections_1 (lang_statement_union_type *s)
{
- for (; s != (lang_statement_union_type *) NULL; s = s->header.next)
+ for (; s != NULL; s = s->header.next)
{
switch (s->header.type)
{
}
static void
-lang_gc_sections ()
+lang_gc_sections (void)
{
struct bfd_link_hash_entry *h;
ldlang_undef_chain_list_type *ulist;
h = bfd_link_hash_lookup (link_info.hash, ulist->name,
FALSE, FALSE, FALSE);
- if (h != (struct bfd_link_hash_entry *) NULL
+ if (h != NULL
&& (h->type == bfd_link_hash_defined
|| h->type == bfd_link_hash_defweak)
&& ! bfd_is_abs_section (h->u.def.section))
}
void
-lang_process ()
+lang_process (void)
{
lang_reasonable_defaults ();
current_target = default_target;
/* Run through the contours of the script and attach input sections
to the correct output sections. */
- map_input_to_output_sections (statement_list.head, (char *) NULL,
- (lang_output_section_statement_type *) NULL);
+ map_input_to_output_sections (statement_list.head, NULL, NULL);
/* Find any sections not attached explicitly and handle them. */
lang_place_orphans ();
/* Look for a text section and set the readonly attribute in it. */
asection *found = bfd_get_section_by_name (output_bfd, ".text");
- if (found != (asection *) NULL)
+ if (found != NULL)
{
if (config.text_read_only)
found->flags |= SEC_READONLY;
lang_record_phdrs ();
/* Size up the sections. */
- lang_size_sections (statement_list.head,
- abs_output_section,
- &statement_list.head, 0, (bfd_vma) 0, NULL,
+ lang_size_sections (statement_list.head, abs_output_section,
+ &statement_list.head, 0, 0, NULL,
command_line.relax ? FALSE : TRUE);
/* Now run around and relax if we can. */
/* Do all the assignments with our current guesses as to
section sizes. */
- lang_do_assignments (statement_list.head,
- abs_output_section,
- (fill_type *) 0, (bfd_vma) 0);
+ lang_do_assignments (statement_list.head, abs_output_section,
+ NULL, 0);
/* Perform another relax pass - this time we know where the
globals are, so can make a better guess. */
- lang_size_sections (statement_list.head,
- abs_output_section,
- &statement_list.head, 0, (bfd_vma) 0,
- &relax_again, FALSE);
+ lang_size_sections (statement_list.head, abs_output_section,
+ &statement_list.head, 0, 0, &relax_again, FALSE);
/* If the normal relax is done and the relax finalize pass
is not performed yet, we perform another relax pass. */
/* Final extra sizing to report errors. */
lang_reset_memory_regions ();
- lang_do_assignments (statement_list.head,
- abs_output_section,
- (fill_type *) 0, (bfd_vma) 0);
- lang_size_sections (statement_list.head,
- abs_output_section,
- & statement_list.head, 0, (bfd_vma) 0,
- NULL, TRUE);
+ lang_do_assignments (statement_list.head, abs_output_section, NULL, 0);
+ lang_size_sections (statement_list.head, abs_output_section,
+ &statement_list.head, 0, 0, NULL, TRUE);
}
/* See if anything special should be done now we know how big
/* Do all the assignments, now that we know the final resting places
of all the symbols. */
- lang_do_assignments (statement_list.head,
- abs_output_section,
- (fill_type *) 0, (bfd_vma) 0);
+ lang_do_assignments (statement_list.head, abs_output_section, NULL, 0);
/* Make sure that the section addresses make sense. */
if (! link_info.relocatable
/* EXPORTED TO YACC */
void
-lang_add_wild (filespec, section_list, keep_sections)
- struct wildcard_spec *filespec;
- struct wildcard_list *section_list;
- bfd_boolean keep_sections;
+lang_add_wild (struct wildcard_spec *filespec,
+ struct wildcard_list *section_list,
+ bfd_boolean keep_sections)
{
struct wildcard_list *curr, *next;
lang_wild_statement_type *new;
}
void
-lang_section_start (name, address)
- const char *name;
- etree_type *address;
+lang_section_start (const char *name, etree_type *address)
{
lang_address_statement_type *ad;
precedence. */
void
-lang_add_entry (name, cmdline)
- const char *name;
- bfd_boolean cmdline;
+lang_add_entry (const char *name, bfd_boolean cmdline)
{
if (entry_symbol.name == NULL
|| cmdline
}
void
-lang_add_target (name)
- const char *name;
+lang_add_target (const char *name)
{
lang_target_statement_type *new = new_stat (lang_target_statement,
stat_ptr);
}
void
-lang_add_map (name)
- const char *name;
+lang_add_map (const char *name)
{
while (*name)
{
}
void
-lang_add_fill (fill)
- fill_type *fill;
+lang_add_fill (fill_type *fill)
{
lang_fill_statement_type *new = new_stat (lang_fill_statement,
stat_ptr);
}
void
-lang_add_data (type, exp)
- int type;
- union etree_union *exp;
+lang_add_data (int type, union etree_union *exp)
{
lang_data_statement_type *new = new_stat (lang_data_statement,
NAME must be NULL. ADDEND is an expression for the addend. */
void
-lang_add_reloc (reloc, howto, section, name, addend)
- bfd_reloc_code_real_type reloc;
- reloc_howto_type *howto;
- asection *section;
- const char *name;
- union etree_union *addend;
+lang_add_reloc (bfd_reloc_code_real_type reloc,
+ reloc_howto_type *howto,
+ asection *section,
+ const char *name,
+ union etree_union *addend)
{
lang_reloc_statement_type *p = new_stat (lang_reloc_statement, stat_ptr);
}
lang_assignment_statement_type *
-lang_add_assignment (exp)
- etree_type *exp;
+lang_add_assignment (etree_type *exp)
{
lang_assignment_statement_type *new = new_stat (lang_assignment_statement,
stat_ptr);
}
void
-lang_add_attribute (attribute)
- enum statement_enum attribute;
+lang_add_attribute (enum statement_enum attribute)
{
new_statement (attribute, sizeof (lang_statement_union_type), stat_ptr);
}
void
-lang_startup (name)
- const char *name;
+lang_startup (const char *name)
{
- if (startup_file != (char *) NULL)
+ if (startup_file != NULL)
{
einfo (_("%P%Fmultiple STARTUP files\n"));
}
}
void
-lang_float (maybe)
- bfd_boolean maybe;
+lang_float (bfd_boolean maybe)
{
lang_float_flag = maybe;
}
It is an error to specify both a load region and a load address. */
static void
-lang_get_regions (region, lma_region, memspec, lma_memspec, have_lma_p)
- struct memory_region_struct **region, **lma_region;
- const char *memspec, *lma_memspec;
- int have_lma_p;
+lang_get_regions (struct memory_region_struct **region,
+ struct memory_region_struct **lma_region,
+ const char *memspec,
+ const char *lma_memspec,
+ int have_lma_p)
{
*lma_region = lang_memory_region_lookup (lma_memspec);
}
void
-lang_leave_output_section_statement (fill, memspec, phdrs, lma_memspec)
- fill_type *fill;
- const char *memspec;
- struct lang_output_section_phdr_list *phdrs;
- const char *lma_memspec;
+lang_leave_output_section_statement
+ (fill_type *fill, const char *memspec,
+ struct lang_output_section_phdr_list *phdrs, const char *lma_memspec)
{
lang_get_regions (¤t_section->region,
¤t_section->lma_region,
If the symbol already exists, then do nothing. */
void
-lang_abs_symbol_at_beginning_of (secname, name)
- const char *secname;
- const char *name;
+lang_abs_symbol_at_beginning_of (const char *secname, const char *name)
{
struct bfd_link_hash_entry *h;
h = bfd_link_hash_lookup (link_info.hash, name, TRUE, TRUE, TRUE);
- if (h == (struct bfd_link_hash_entry *) NULL)
+ if (h == NULL)
einfo (_("%P%F: bfd_link_hash_lookup failed: %E\n"));
if (h->type == bfd_link_hash_new
h->type = bfd_link_hash_defined;
sec = bfd_get_section_by_name (output_bfd, secname);
- if (sec == (asection *) NULL)
+ if (sec == NULL)
h->u.def.value = 0;
else
h->u.def.value = bfd_get_section_vma (output_bfd, sec);
If the symbol already exists, then do nothing. */
void
-lang_abs_symbol_at_end_of (secname, name)
- const char *secname;
- const char *name;
+lang_abs_symbol_at_end_of (const char *secname, const char *name)
{
struct bfd_link_hash_entry *h;
h = bfd_link_hash_lookup (link_info.hash, name, TRUE, TRUE, TRUE);
- if (h == (struct bfd_link_hash_entry *) NULL)
+ if (h == NULL)
einfo (_("%P%F: bfd_link_hash_lookup failed: %E\n"));
if (h->type == bfd_link_hash_new
h->type = bfd_link_hash_defined;
sec = bfd_get_section_by_name (output_bfd, secname);
- if (sec == (asection *) NULL)
+ if (sec == NULL)
h->u.def.value = 0;
else
h->u.def.value = (bfd_get_section_vma (output_bfd, sec)
}
void
-lang_statement_append (list, element, field)
- lang_statement_list_type *list;
- lang_statement_union_type *element;
- lang_statement_union_type **field;
+lang_statement_append (lang_statement_list_type *list,
+ lang_statement_union_type *element,
+ lang_statement_union_type **field)
{
*(list->tail) = element;
list->tail = field;
/* Set the output format type. -oformat overrides scripts. */
void
-lang_add_output_format (format, big, little, from_script)
- const char *format;
- const char *big;
- const char *little;
- int from_script;
+lang_add_output_format (const char *format,
+ const char *big,
+ const char *little,
+ int from_script)
{
if (output_target == NULL || !from_script)
{
stat_ptr to build new statements within the group. */
void
-lang_enter_group ()
+lang_enter_group (void)
{
lang_group_statement_type *g;
but currently they can't. */
void
-lang_leave_group ()
+lang_leave_group (void)
{
stat_ptr = &statement_list;
}
command in a linker script. */
void
-lang_new_phdr (name, type, filehdr, phdrs, at, flags)
- const char *name;
- etree_type *type;
- bfd_boolean filehdr;
- bfd_boolean phdrs;
- etree_type *at;
- etree_type *flags;
+lang_new_phdr (const char *name,
+ etree_type *type,
+ bfd_boolean filehdr,
+ bfd_boolean phdrs,
+ etree_type *at,
+ etree_type *flags)
{
struct lang_phdr *n, **pp;
- n = (struct lang_phdr *) stat_alloc (sizeof (struct lang_phdr));
+ n = stat_alloc (sizeof (struct lang_phdr));
n->next = NULL;
n->name = name;
n->type = exp_get_value_int (type, 0, "program header type",
should not be calling an ELF specific function here. */
static void
-lang_record_phdrs ()
+lang_record_phdrs (void)
{
unsigned int alc;
asection **secs;
lang_statement_union_type *u;
alc = 10;
- secs = (asection **) xmalloc (alc * sizeof (asection *));
+ secs = xmalloc (alc * sizeof (asection *));
last = NULL;
for (l = lang_phdr_list; l != NULL; l = l->next)
{
if (c >= alc)
{
alc *= 2;
- secs = ((asection **)
- xrealloc (secs, alc * sizeof (asection *)));
+ secs = xrealloc (secs, alc * sizeof (asection *));
}
secs[c] = os->bfd_section;
++c;
/* Record a list of sections which may not be cross referenced. */
void
-lang_add_nocrossref (l)
- struct lang_nocrossref *l;
+lang_add_nocrossref (struct lang_nocrossref *l)
{
struct lang_nocrossrefs *n;
- n = (struct lang_nocrossrefs *) xmalloc (sizeof *n);
+ n = xmalloc (sizeof *n);
n->next = nocrossref_list;
n->list = l;
nocrossref_list = n;
/* Start handling an overlay. */
void
-lang_enter_overlay (vma_expr)
- etree_type *vma_expr;
+lang_enter_overlay (etree_type *vma_expr)
{
/* The grammar should prevent nested overlays from occurring. */
ASSERT (overlay_vma == NULL && overlay_max == NULL);
lang_leave_overlay sets up the LMA and memory regions. */
void
-lang_enter_overlay_section (name)
- const char *name;
+lang_enter_overlay_section (const char *name)
{
struct overlay_list *n;
etree_type *size;
overlay_vma = exp_nameop (ADDR, name);
/* Remember the section. */
- n = (struct overlay_list *) xmalloc (sizeof *n);
+ n = xmalloc (sizeof *n);
n->os = current_section;
n->next = overlay_list;
overlay_list = n;
here. */
void
-lang_leave_overlay_section (fill, phdrs)
- fill_type *fill;
- struct lang_output_section_phdr_list *phdrs;
+lang_leave_overlay_section (fill_type *fill,
+ struct lang_output_section_phdr_list *phdrs)
{
const char *name;
char *clean, *s2;
looks through all the sections in the overlay and sets them. */
void
-lang_leave_overlay (lma_expr, nocrossrefs, fill, memspec, phdrs, lma_memspec)
- etree_type *lma_expr;
- int nocrossrefs;
- fill_type *fill;
- const char *memspec;
- struct lang_output_section_phdr_list *phdrs;
- const char *lma_memspec;
+lang_leave_overlay (etree_type *lma_expr,
+ int nocrossrefs,
+ fill_type *fill,
+ const char *memspec,
+ struct lang_output_section_phdr_list *phdrs,
+ const char *lma_memspec)
{
lang_memory_region_type *region;
lang_memory_region_type *lma_region;
{
struct overlay_list *next;
- if (fill != (fill_type *) 0 && l->os->fill == (fill_type *) 0)
+ if (fill != NULL && l->os->fill == NULL)
l->os->fill = fill;
l->os->region = region;
{
struct lang_nocrossref *nc;
- nc = (struct lang_nocrossref *) xmalloc (sizeof *nc);
+ nc = xmalloc (sizeof *nc);
nc->name = l->os->name;
nc->next = nocrossref;
nocrossref = nc;
struct bfd_elf_version_tree *lang_elf_version_info;
static int
-lang_vers_match_lang_c (expr, sym)
- struct bfd_elf_version_expr *expr;
- const char *sym;
+lang_vers_match_lang_c (struct bfd_elf_version_expr *expr,
+ const char *sym)
{
if (expr->pattern[0] == '*' && expr->pattern[1] == '\0')
return 1;
}
static int
-lang_vers_match_lang_cplusplus (expr, sym)
- struct bfd_elf_version_expr *expr;
- const char *sym;
+lang_vers_match_lang_cplusplus (struct bfd_elf_version_expr *expr,
+ const char *sym)
{
char *alt_sym;
int result;
}
static int
-lang_vers_match_lang_java (expr, sym)
- struct bfd_elf_version_expr *expr;
- const char *sym;
+lang_vers_match_lang_java (struct bfd_elf_version_expr *expr,
+ const char *sym)
{
char *alt_sym;
int result;
/* This is called for each variable name or match expression. */
struct bfd_elf_version_expr *
-lang_new_vers_pattern (orig, new, lang)
- struct bfd_elf_version_expr *orig;
- const char *new;
- const char *lang;
+lang_new_vers_pattern (struct bfd_elf_version_expr *orig,
+ const char *new,
+ const char *lang)
{
struct bfd_elf_version_expr *ret;
- ret = (struct bfd_elf_version_expr *) xmalloc (sizeof *ret);
+ ret = xmalloc (sizeof *ret);
ret->next = orig;
ret->pattern = new;
ret->symver = 0;
expressions. */
struct bfd_elf_version_tree *
-lang_new_vers_node (globals, locals)
- struct bfd_elf_version_expr *globals;
- struct bfd_elf_version_expr *locals;
+lang_new_vers_node (struct bfd_elf_version_expr *globals,
+ struct bfd_elf_version_expr *locals)
{
struct bfd_elf_version_tree *ret;
- ret = (struct bfd_elf_version_tree *) xmalloc (sizeof *ret);
+ ret = xmalloc (sizeof *ret);
ret->next = NULL;
ret->name = NULL;
ret->vernum = 0;
version. */
void
-lang_register_vers_node (name, version, deps)
- const char *name;
- struct bfd_elf_version_tree *version;
- struct bfd_elf_version_deps *deps;
+lang_register_vers_node (const char *name,
+ struct bfd_elf_version_tree *version,
+ struct bfd_elf_version_deps *deps)
{
struct bfd_elf_version_tree *t, **pp;
struct bfd_elf_version_expr *e1;
/* This is called when we see a version dependency. */
struct bfd_elf_version_deps *
-lang_add_vers_depend (list, name)
- struct bfd_elf_version_deps *list;
- const char *name;
+lang_add_vers_depend (struct bfd_elf_version_deps *list, const char *name)
{
struct bfd_elf_version_deps *ret;
struct bfd_elf_version_tree *t;
- ret = (struct bfd_elf_version_deps *) xmalloc (sizeof *ret);
+ ret = xmalloc (sizeof *ret);
ret->next = list;
for (t = lang_elf_version_info; t != NULL; t = t->next)
}
static void
-lang_do_version_exports_section ()
+lang_do_version_exports_section (void)
{
struct bfd_elf_version_expr *greg = NULL, *lreg;
}
void
-lang_add_unique (name)
- const char *name;
+lang_add_unique (const char *name)
{
struct unique_sections *ent;
if (strcmp (ent->name, name) == 0)
return;
- ent = (struct unique_sections *) xmalloc (sizeof *ent);
+ ent = xmalloc (sizeof *ent);
ent->name = xstrdup (name);
ent->next = unique_section_list;
unique_section_list = ent;
extern lang_statement_list_type file_chain;
extern void lang_init
- PARAMS ((void));
+ (void);
extern struct memory_region_struct *lang_memory_region_lookup
- PARAMS ((const char *const));
+ (const char *const);
extern struct memory_region_struct *lang_memory_region_default
- PARAMS ((asection *));
+ (asection *);
extern void lang_map
- PARAMS ((void));
+ (void);
extern void lang_set_flags
- PARAMS ((lang_memory_region_type *, const char *, int));
+ (lang_memory_region_type *, const char *, int);
extern void lang_add_output
- PARAMS ((const char *, int from_script));
+ (const char *, int from_script);
extern lang_output_section_statement_type *lang_enter_output_section_statement
- PARAMS ((const char *output_section_statement_name,
- etree_type *address_exp,
- enum section_type sectype,
- bfd_vma block_value,
- etree_type *align,
- etree_type *subalign,
- etree_type *));
+ (const char *output_section_statement_name,
+ etree_type *address_exp,
+ enum section_type sectype,
+ bfd_vma block_value,
+ etree_type *align,
+ etree_type *subalign,
+ etree_type *);
extern void lang_final
- PARAMS ((void));
+ (void);
extern void lang_process
- PARAMS ((void));
+ (void);
extern void lang_section_start
- PARAMS ((const char *, union etree_union *));
+ (const char *, union etree_union *);
extern void lang_add_entry
- PARAMS ((const char *, bfd_boolean));
+ (const char *, bfd_boolean);
extern void lang_add_target
- PARAMS ((const char *));
+ (const char *);
extern void lang_add_wild
- PARAMS ((struct wildcard_spec *, struct wildcard_list *, bfd_boolean));
+ (struct wildcard_spec *, struct wildcard_list *, bfd_boolean);
extern void lang_add_map
- PARAMS ((const char *));
+ (const char *);
extern void lang_add_fill
- PARAMS ((fill_type *));
-extern lang_assignment_statement_type * lang_add_assignment
- PARAMS ((union etree_union *));
+ (fill_type *);
+extern lang_assignment_statement_type *lang_add_assignment
+ (union etree_union *);
extern void lang_add_attribute
- PARAMS ((enum statement_enum));
+ (enum statement_enum);
extern void lang_startup
- PARAMS ((const char *));
+ (const char *);
extern void lang_float
- PARAMS ((bfd_boolean));
+ (bfd_boolean);
extern void lang_leave_output_section_statement
- PARAMS ((fill_type *, const char *, struct lang_output_section_phdr_list *,
- const char *));
+ (fill_type *, const char *, struct lang_output_section_phdr_list *,
+ const char *);
extern void lang_abs_symbol_at_end_of
- PARAMS ((const char *, const char *));
+ (const char *, const char *);
extern void lang_abs_symbol_at_beginning_of
- PARAMS ((const char *, const char *));
+ (const char *, const char *);
extern void lang_statement_append
- PARAMS ((struct statement_list *, union lang_statement_union *,
- union lang_statement_union **));
+ (struct statement_list *, union lang_statement_union *,
+ union lang_statement_union **);
extern void lang_for_each_input_file
- PARAMS ((void (*dothis) (lang_input_statement_type *)));
+ (void (*dothis) (lang_input_statement_type *));
extern void lang_for_each_file
- PARAMS ((void (*dothis) (lang_input_statement_type *)));
+ (void (*dothis) (lang_input_statement_type *));
extern void lang_reset_memory_regions
- PARAMS ((void));
+ (void);
extern bfd_vma lang_do_assignments
- PARAMS ((lang_statement_union_type * s,
- lang_output_section_statement_type *output_section_statement,
- fill_type *fill,
- bfd_vma dot));
+ (lang_statement_union_type *, lang_output_section_statement_type *,
+ fill_type *, bfd_vma);
#define LANG_FOR_EACH_INPUT_STATEMENT(statement) \
lang_input_statement_type *statement; \
statement = (lang_input_statement_type *) statement->next) \
extern void lang_process
- PARAMS ((void));
+ (void);
extern void ldlang_add_file
- PARAMS ((lang_input_statement_type *));
+ (lang_input_statement_type *);
extern lang_output_section_statement_type *lang_output_section_find
- PARAMS ((const char * const));
+ (const char * const);
extern lang_input_statement_type *lang_add_input_file
- PARAMS ((const char *name, lang_input_file_enum_type file_type,
- const char *target));
+ (const char *, lang_input_file_enum_type, const char *);
extern void lang_add_keepsyms_file
- PARAMS ((const char *filename));
+ (const char *);
extern lang_output_section_statement_type *
lang_output_section_statement_lookup
- PARAMS ((const char * const name));
+ (const char *const);
extern void ldlang_add_undef
- PARAMS ((const char *const name));
+ (const char *const);
extern void lang_add_output_format
- PARAMS ((const char *, const char *, const char *, int from_script));
+ (const char *, const char *, const char *, int);
extern void lang_list_init
- PARAMS ((lang_statement_list_type*));
+ (lang_statement_list_type *);
extern void lang_add_data
- PARAMS ((int type, union etree_union *));
+ (int type, union etree_union *);
extern void lang_add_reloc
- PARAMS ((bfd_reloc_code_real_type reloc, reloc_howto_type *howto,
- asection *section, const char *name, union etree_union *addend));
+ (bfd_reloc_code_real_type, reloc_howto_type *, asection *, const char *,
+ union etree_union *);
extern void lang_for_each_statement
- PARAMS ((void (*func) (lang_statement_union_type *)));
-extern PTR stat_alloc
- PARAMS ((size_t size));
+ (void (*) (lang_statement_union_type *));
+extern void *stat_alloc
+ (size_t);
extern void dprint_statement
- PARAMS ((lang_statement_union_type *, int));
+ (lang_statement_union_type *, int);
extern bfd_vma lang_size_sections
- PARAMS ((lang_statement_union_type *s,
- lang_output_section_statement_type *output_section_statement,
- lang_statement_union_type **prev, fill_type *fill,
- bfd_vma dot, bfd_boolean *relax, bfd_boolean check_regions));
+ (lang_statement_union_type *, lang_output_section_statement_type *,
+ lang_statement_union_type **, fill_type *, bfd_vma, bfd_boolean *,
+ bfd_boolean);
extern void lang_enter_group
- PARAMS ((void));
+ (void);
extern void lang_leave_group
- PARAMS ((void));
+ (void);
extern void lang_add_section
- PARAMS ((lang_statement_list_type *ptr, asection *section,
- lang_output_section_statement_type *output,
- lang_input_statement_type *file));
+ (lang_statement_list_type *, asection *,
+ lang_output_section_statement_type *, lang_input_statement_type *);
extern void lang_new_phdr
- PARAMS ((const char *, etree_type *, bfd_boolean, bfd_boolean, etree_type *,
- etree_type *));
+ (const char *, etree_type *, bfd_boolean, bfd_boolean, etree_type *,
+ etree_type *);
extern void lang_add_nocrossref
- PARAMS ((struct lang_nocrossref *));
+ (struct lang_nocrossref *);
extern void lang_enter_overlay
- PARAMS ((etree_type *));
+ (etree_type *);
extern void lang_enter_overlay_section
- PARAMS ((const char *));
+ (const char *);
extern void lang_leave_overlay_section
- PARAMS ((fill_type *, struct lang_output_section_phdr_list *));
+ (fill_type *, struct lang_output_section_phdr_list *);
extern void lang_leave_overlay
- PARAMS ((etree_type *, int, fill_type *, const char *,
- struct lang_output_section_phdr_list *, const char *));
+ (etree_type *, int, fill_type *, const char *,
+ struct lang_output_section_phdr_list *, const char *);
extern struct bfd_elf_version_tree *lang_elf_version_info;
extern struct bfd_elf_version_expr *lang_new_vers_pattern
- PARAMS ((struct bfd_elf_version_expr *, const char *, const char *));
+ (struct bfd_elf_version_expr *, const char *, const char *);
extern struct bfd_elf_version_tree *lang_new_vers_node
- PARAMS ((struct bfd_elf_version_expr *, struct bfd_elf_version_expr *));
+ (struct bfd_elf_version_expr *, struct bfd_elf_version_expr *);
extern struct bfd_elf_version_deps *lang_add_vers_depend
- PARAMS ((struct bfd_elf_version_deps *, const char *));
+ (struct bfd_elf_version_deps *, const char *);
extern void lang_register_vers_node
- PARAMS ((const char *, struct bfd_elf_version_tree *,
- struct bfd_elf_version_deps *));
+ (const char *, struct bfd_elf_version_tree *, struct bfd_elf_version_deps *);
bfd_boolean unique_section_p
- PARAMS ((const char *));
+ (const char *);
extern void lang_add_unique
- PARAMS ((const char *));
+ (const char *);
extern const char *lang_get_output_target
- PARAMS ((void));
+ (void);
#endif
/* ldlex.h -
- Copyright 1991, 1992, 1993, 1994, 1995, 1997, 2000
+ Copyright 1991, 1992, 1993, 1994, 1995, 1997, 2000, 2003
Free Software Foundation, Inc.
This file is part of GLD, the Gnu Linker.
extern const char *lex_string;
/* In ldlex.l. */
-extern int yylex PARAMS ((void));
-extern void lex_push_file PARAMS ((FILE *, const char *));
-extern void lex_redirect PARAMS ((const char *));
-extern void ldlex_script PARAMS ((void));
-extern void ldlex_mri_script PARAMS ((void));
-extern void ldlex_version_script PARAMS ((void));
-extern void ldlex_version_file PARAMS ((void));
-extern void ldlex_defsym PARAMS ((void));
-extern void ldlex_expression PARAMS ((void));
-extern void ldlex_both PARAMS ((void));
-extern void ldlex_command PARAMS ((void));
-extern void ldlex_popstate PARAMS ((void));
+extern int yylex (void);
+extern void lex_push_file (FILE *, const char *);
+extern void lex_redirect (const char *);
+extern void ldlex_script (void);
+extern void ldlex_mri_script (void);
+extern void ldlex_version_script (void);
+extern void ldlex_version_file (void);
+extern void ldlex_defsym (void);
+extern void ldlex_expression (void);
+extern void ldlex_both (void);
+extern void ldlex_command (void);
+extern void ldlex_popstate (void);
/* In lexsup.c. */
-extern int lex_input PARAMS ((void));
-extern void lex_unput PARAMS ((int));
+extern int lex_input (void);
+extern void lex_unput (int);
#ifndef yywrap
-extern int yywrap PARAMS ((void));
+extern int yywrap (void);
#endif
-extern void parse_args PARAMS ((unsigned, char **));
+extern void parse_args (unsigned, char **);
#endif
%{
/* Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002 Free Software Foundation, Inc.
+ 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
This file is part of GLD, the Gnu Linker.
*/
-#include "ansidecl.h"
#include <stdio.h>
#ifdef MPW
Otherwise, stack elements 0 through `include_stack_ptr - 1' are valid. */
#undef YY_INPUT
-#define YY_INPUT(buf,result,max_size) yy_input(buf, &result, max_size)
+#define YY_INPUT(buf,result,max_size) yy_input (buf, &result, max_size)
#define MAX_INCLUDE_DEPTH 10
static YY_BUFFER_STATE include_stack[MAX_INCLUDE_DEPTH];
static unsigned int include_stack_ptr = 0;
static int vers_node_nesting = 0;
-static YY_BUFFER_STATE yy_create_string_buffer PARAMS ((const char *string,
- size_t size));
-static void yy_input PARAMS ((char *, int *result, int max_size));
+static void yy_input (char *, int *, int);
+static void comment (void);
+static void lex_warn_invalid (char *where, char *what);
-static void comment PARAMS ((void));
-static void lex_warn_invalid PARAMS ((char *where, char *what));
-
-/* STATES
+/* STATES
EXPRESSION definitely in an expression
SCRIPT definitely in a script
BOTH either EXPRESSION or SCRIPT
/* Some versions of flex want this. */
#ifndef yywrap
-int yywrap () { return 1; }
+int yywrap (void) { return 1; }
#endif
%}
SYMBOLCHARN [_a-zA-Z\/\.\\\$\_\~0-9]
FILENAMECHAR [_a-zA-Z0-9\/\.\-\_\+\=\$\:\[\]\\\,\~]
WILDCHAR [_a-zA-Z0-9\/\.\-\_\+\=\$\:\[\]\\\,\~\?\*]
-WHITE [ \t\n\r]+
+WHITE [ \t\n\r]+
NOCFILENAMECHAR [_a-zA-Z0-9\/\.\-\_\+\$\:\[\]\\\~]
}
}
-<BOTH,SCRIPT,EXPRESSION,VERS_START,VERS_NODE,VERS_SCRIPT>"/*" { comment(); }
+<BOTH,SCRIPT,EXPRESSION,VERS_START,VERS_NODE,VERS_SCRIPT>"/*" { comment (); }
<DEFSYMEXP>"-" { RTOKEN('-');}
<DEFSYMEXP>"+" { RTOKEN('+');}
-<DEFSYMEXP>{FILENAMECHAR1}{SYMBOLCHARN}* { yylval.name = xstrdup(yytext); return NAME; }
+<DEFSYMEXP>{FILENAMECHAR1}{SYMBOLCHARN}* { yylval.name = xstrdup (yytext); return NAME; }
<DEFSYMEXP>"=" { RTOKEN('='); }
<MRI,EXPRESSION>"$"([0-9A-Fa-f])+ {
- yylval.integer = bfd_scan_vma (yytext+1, 0,16);
- yylval.bigint.str = (char *) 0;
+ yylval.integer = bfd_scan_vma (yytext + 1, 0, 16);
+ yylval.bigint.str = NULL;
return INT;
}
<MRI,EXPRESSION>([0-9A-Fa-f])+(H|h|X|x|B|b|O|o|D|d) {
int ibase ;
- switch (yytext[yyleng-1]) {
- case 'X':
+ switch (yytext[yyleng - 1]) {
+ case 'X':
case 'x':
case 'H':
case 'h':
}
yylval.integer = bfd_scan_vma (yytext, 0,
ibase);
- yylval.bigint.str = (char *) 0;
+ yylval.bigint.str = NULL;
return INT;
}
<SCRIPT,DEFSYMEXP,MRI,BOTH,EXPRESSION>((("$"|0[xX])([0-9A-Fa-f])+)|(([0-9])+))(M|K|m|k)? {
ibase = 16;
}
yylval.integer = bfd_scan_vma (s, 0, ibase);
- yylval.bigint.str = (char *) 0;
- if (yytext[yyleng-1] == 'M'
- || yytext[yyleng-1] == 'm')
+ yylval.bigint.str = NULL;
+ if (yytext[yyleng - 1] == 'M'
+ || yytext[yyleng - 1] == 'm')
{
yylval.integer *= 1024 * 1024;
}
- else if (yytext[yyleng-1] == 'K'
- || yytext[yyleng-1]=='k')
+ else if (yytext[yyleng - 1] == 'K'
+ || yytext[yyleng - 1]=='k')
{
yylval.integer *= 1024;
}
<MRI>{FILENAMECHAR1}{NOCFILENAMECHAR}* {
/* Filename without commas, needed to parse mri stuff */
- yylval.name = xstrdup(yytext);
+ yylval.name = xstrdup (yytext);
return NAME;
}
<BOTH,EXPRESSION>{FILENAMECHAR1}{FILENAMECHAR}* {
- yylval.name = xstrdup(yytext);
+ yylval.name = xstrdup (yytext);
return NAME;
}
<BOTH,EXPRESSION>"-l"{FILENAMECHAR}+ {
try again. */
if (yytext[0] == '/' && yytext[1] == '*')
{
- yyless(2);
+ yyless (2);
comment ();
}
else
{
- yylval.name = xstrdup(yytext);
+ yylval.name = xstrdup (yytext);
return NAME;
}
}
<EXPRESSION,BOTH,SCRIPT,VERS_NODE>"\""[^\"]*"\"" {
/* No matter the state, quotes
give what's inside */
- yylval.name = xstrdup(yytext+1);
- yylval.name[yyleng-2] = 0;
+ yylval.name = xstrdup (yytext + 1);
+ yylval.name[yyleng - 2] = 0;
return NAME;
}
<BOTH,SCRIPT,EXPRESSION>"\n" { lineno++;}
<VERS_START>"{" { BEGIN(VERS_SCRIPT); return *yytext; }
-<VERS_SCRIPT>"{" { BEGIN(VERS_NODE);
+<VERS_SCRIPT>"{" { BEGIN(VERS_NODE);
vers_node_nesting = 0;
return *yytext;
}
<<EOF>> {
include_stack_ptr--;
-
- if (include_stack_ptr == 0)
+
+ if (include_stack_ptr == 0)
{
- yyterminate();
+ yyterminate ();
}
- else
+ else
{
- yy_switch_to_buffer(include_stack[include_stack_ptr]);
+ yy_switch_to_buffer (include_stack[include_stack_ptr]);
}
ldfile_input_filename = file_name_stack[include_stack_ptr - 1];
return END;
}
-<SCRIPT,MRI,VERS_START,VERS_SCRIPT,VERS_NODE>. lex_warn_invalid(" in script", yytext);
-<EXPRESSION,DEFSYMEXP,BOTH>. lex_warn_invalid(" in expression", yytext);
-
+<SCRIPT,MRI,VERS_START,VERS_SCRIPT,VERS_NODE>. lex_warn_invalid (" in script", yytext);
+<EXPRESSION,DEFSYMEXP,BOTH>. lex_warn_invalid (" in expression", yytext);
+
%%
\f
saving the current input info on the include stack. */
void
-lex_push_file (file, name)
- FILE *file;
- const char *name;
+lex_push_file (FILE *file, const char *name)
{
- if (include_stack_ptr >= MAX_INCLUDE_DEPTH)
+ if (include_stack_ptr >= MAX_INCLUDE_DEPTH)
{
- einfo("%F:includes nested too deeply\n");
+ einfo ("%F:includes nested too deeply\n");
}
file_name_stack[include_stack_ptr] = name;
lineno_stack[include_stack_ptr] = lineno;
include_stack_ptr++;
lineno = 1;
yyin = file;
- yy_switch_to_buffer(yy_create_buffer(yyin, YY_BUF_SIZE));
+ yy_switch_to_buffer (yy_create_buffer (yyin, YY_BUF_SIZE));
}
/* Return a newly created flex input buffer containing STRING,
which is SIZE bytes long. */
-static YY_BUFFER_STATE
-yy_create_string_buffer (string, size)
- const char *string;
- size_t size;
+static YY_BUFFER_STATE
+yy_create_string_buffer (const char *string, size_t size)
{
YY_BUFFER_STATE b;
/* Calls to m-alloc get turned by sed into xm-alloc. */
- b = (YY_BUFFER_STATE) malloc (sizeof (struct yy_buffer_state));
+ b = malloc (sizeof (struct yy_buffer_state));
b->yy_input_file = 0;
b->yy_buf_size = size;
/* yy_ch_buf has to be 2 characters longer than the size given because
we need to put in 2 end-of-buffer characters. */
- b->yy_ch_buf = (char *) malloc ((unsigned) (b->yy_buf_size + 3));
+ b->yy_ch_buf = malloc ((unsigned) (b->yy_buf_size + 3));
b->yy_ch_buf[0] = '\n';
strcpy (b->yy_ch_buf+1, string);
on the include stack. */
void
-lex_redirect (string)
- const char *string;
+lex_redirect (const char *string)
{
YY_BUFFER_STATE tmp;
yy_init = 0;
- if (include_stack_ptr >= MAX_INCLUDE_DEPTH)
+ if (include_stack_ptr >= MAX_INCLUDE_DEPTH)
{
einfo("%F: macros nested too deeply\n");
}
static int *state_stack_p = state_stack;
void
-ldlex_script ()
+ldlex_script (void)
{
*(state_stack_p)++ = yy_start;
BEGIN (SCRIPT);
}
void
-ldlex_mri_script ()
+ldlex_mri_script (void)
{
*(state_stack_p)++ = yy_start;
BEGIN (MRI);
}
void
-ldlex_version_script ()
+ldlex_version_script (void)
{
*(state_stack_p)++ = yy_start;
BEGIN (VERS_START);
}
void
-ldlex_version_file ()
+ldlex_version_file (void)
{
*(state_stack_p)++ = yy_start;
BEGIN (VERS_SCRIPT);
}
void
-ldlex_defsym ()
+ldlex_defsym (void)
{
*(state_stack_p)++ = yy_start;
BEGIN (DEFSYMEXP);
}
-
+
void
-ldlex_expression ()
+ldlex_expression (void)
{
*(state_stack_p)++ = yy_start;
BEGIN (EXPRESSION);
}
void
-ldlex_both ()
+ldlex_both (void)
{
*(state_stack_p)++ = yy_start;
BEGIN (BOTH);
}
void
-ldlex_popstate ()
+ldlex_popstate (void)
{
yy_start = *(--state_stack_p);
}
either the number of characters read, or 0 to indicate EOF. */
static void
-yy_input (buf, result, max_size)
- char *buf;
- int *result;
- int max_size;
+yy_input (char *buf, int *result, int max_size)
{
- *result = 0;
+ *result = 0;
if (YY_CURRENT_BUFFER->yy_input_file)
{
if (yyin)
{
- *result = fread ((char *) buf, 1, max_size, yyin);
- if (*result < max_size && ferror (yyin))
+ *result = fread (buf, 1, max_size, yyin);
+ if (*result < max_size && ferror (yyin))
einfo ("%F%P: read in flex scanner failed\n");
}
}
/* Eat the rest of a C-style comment. */
static void
-comment ()
+comment (void)
{
int c;
while (1)
{
c = input();
- while (c != '*' && c != EOF)
+ while (c != '*' && c != EOF)
{
if (c == '\n')
lineno++;
in context WHERE. */
static void
-lex_warn_invalid (where, what)
- char *where, *what;
+lex_warn_invalid (char *where, char *what)
{
char buf[5];
#ifdef HAVE_SBRK
#ifdef NEED_DECLARATION_SBRK
-extern PTR sbrk ();
+extern void *sbrk ();
#endif
#endif
#define TARGET_SYSTEM_ROOT ""
#endif
-int main PARAMS ((int, char **));
-
/* EXPORTS */
char *default_target;
ld_config_type config;
static char *get_emulation
- PARAMS ((int, char **));
+ (int, char **);
static void set_scripts_dir
- PARAMS ((void));
-static void remove_output
- PARAMS ((void));
-static bfd_boolean check_for_scripts_dir
- PARAMS ((char *));
+ (void);
static bfd_boolean add_archive_element
- PARAMS ((struct bfd_link_info *, bfd *, const char *));
+ (struct bfd_link_info *, bfd *, const char *);
static bfd_boolean multiple_definition
- PARAMS ((struct bfd_link_info *, const char *, bfd *, asection *, bfd_vma,
- bfd *, asection *, bfd_vma));
+ (struct bfd_link_info *, const char *, bfd *, asection *, bfd_vma,
+ bfd *, asection *, bfd_vma);
static bfd_boolean multiple_common
- PARAMS ((struct bfd_link_info *, const char *, bfd *,
- enum bfd_link_hash_type, bfd_vma, bfd *, enum bfd_link_hash_type,
- bfd_vma));
+ (struct bfd_link_info *, const char *, bfd *, enum bfd_link_hash_type,
+ bfd_vma, bfd *, enum bfd_link_hash_type, bfd_vma);
static bfd_boolean add_to_set
- PARAMS ((struct bfd_link_info *, struct bfd_link_hash_entry *,
- bfd_reloc_code_real_type, bfd *, asection *, bfd_vma));
+ (struct bfd_link_info *, struct bfd_link_hash_entry *,
+ bfd_reloc_code_real_type, bfd *, asection *, bfd_vma);
static bfd_boolean constructor_callback
- PARAMS ((struct bfd_link_info *, bfd_boolean, const char *, bfd *,
- asection *, bfd_vma));
+ (struct bfd_link_info *, bfd_boolean, const char *, bfd *,
+ asection *, bfd_vma);
static bfd_boolean warning_callback
- PARAMS ((struct bfd_link_info *, const char *, const char *, bfd *,
- asection *, bfd_vma));
+ (struct bfd_link_info *, const char *, const char *, bfd *,
+ asection *, bfd_vma);
static void warning_find_reloc
- PARAMS ((bfd *, asection *, PTR));
+ (bfd *, asection *, void *);
static bfd_boolean undefined_symbol
- PARAMS ((struct bfd_link_info *, const char *, bfd *, asection *, bfd_vma,
- bfd_boolean));
+ (struct bfd_link_info *, const char *, bfd *, asection *, bfd_vma,
+ bfd_boolean);
static bfd_boolean reloc_overflow
- PARAMS ((struct bfd_link_info *, const char *, const char *, bfd_vma,
- bfd *, asection *, bfd_vma));
+ (struct bfd_link_info *, const char *, const char *, bfd_vma,
+ bfd *, asection *, bfd_vma);
static bfd_boolean reloc_dangerous
- PARAMS ((struct bfd_link_info *, const char *, bfd *, asection *, bfd_vma));
+ (struct bfd_link_info *, const char *, bfd *, asection *, bfd_vma);
static bfd_boolean unattached_reloc
- PARAMS ((struct bfd_link_info *, const char *, bfd *, asection *, bfd_vma));
+ (struct bfd_link_info *, const char *, bfd *, asection *, bfd_vma);
static bfd_boolean notice
- PARAMS ((struct bfd_link_info *, const char *, bfd *, asection *, bfd_vma));
+ (struct bfd_link_info *, const char *, bfd *, asection *, bfd_vma);
static struct bfd_link_callbacks link_callbacks =
{
struct bfd_link_info link_info;
\f
static void
-remove_output ()
+remove_output (void)
{
if (output_filename)
{
}
int
-main (argc, argv)
- int argc;
- char **argv;
+main (int argc, char **argv)
{
char *emulation;
long start_time = get_run_time ();
link_info.pei386_auto_import = -1;
link_info.pei386_runtime_pseudo_reloc = FALSE;
link_info.spare_dynamic_tags = 5;
- link_info.flags = (bfd_vma) 0;
- link_info.flags_1 = (bfd_vma) 0;
+ link_info.flags = 0;
+ link_info.flags_1 = 0;
link_info.relax_finalizing = FALSE;
ldfile_add_arch ("");
dst = fopen (dst_name, FOPEN_WB);
if (!src)
- einfo (_("%X%P: unable to open for source of copy `%s'\n"), output_filename);
+ einfo (_("%X%P: unable to open for source of copy `%s'\n"),
+ output_filename);
if (!dst)
- einfo (_("%X%P: unable to open for destination of copy `%s'\n"), dst_name);
+ einfo (_("%X%P: unable to open for destination of copy `%s'\n"),
+ dst_name);
while ((l = fread (buf, 1, bsize, src)) > 0)
{
int done = fwrite (buf, 1, l, dst);
if (config.stats)
{
#ifdef HAVE_SBRK
- char *lim = (char *) sbrk (0);
+ char *lim = sbrk (0);
#endif
long run_time = get_run_time () - start_time;
state that's needed by the lex&yacc argument parser (parse_args). */
static char *
-get_emulation (argc, argv)
- int argc;
- char **argv;
+get_emulation (int argc, char **argv)
{
char *emulation;
int i;
else return FALSE. */
static bfd_boolean
-check_for_scripts_dir (dir)
- char *dir;
+check_for_scripts_dir (char *dir)
{
size_t dirlen;
char *buf;
dirlen = strlen (dir);
/* sizeof counts the terminating NUL. */
- buf = (char *) xmalloc (dirlen + sizeof ("/ldscripts"));
+ buf = xmalloc (dirlen + sizeof ("/ldscripts"));
sprintf (buf, "%s/ldscripts", dir);
res = stat (buf, &s) == 0 && S_ISDIR (s.st_mode);
(for installing the tool suite elsewhere). */
static void
-set_scripts_dir ()
+set_scripts_dir (void)
{
char *end, *dir;
size_t dirlen;
dirlen = end - program_name;
/* Make a copy of program_name in dir.
Leave room for later "/../lib". */
- dir = (char *) xmalloc (dirlen + 8);
+ dir = xmalloc (dirlen + 8);
strncpy (dir, program_name, dirlen);
dir[dirlen] = '\0';
}
void
-add_ysym (name)
- const char *name;
+add_ysym (const char *name)
{
- if (link_info.notice_hash == (struct bfd_hash_table *) NULL)
+ if (link_info.notice_hash == NULL)
{
- link_info.notice_hash = ((struct bfd_hash_table *)
- xmalloc (sizeof (struct bfd_hash_table)));
+ link_info.notice_hash = xmalloc (sizeof (struct bfd_hash_table));
if (! bfd_hash_table_init_n (link_info.notice_hash,
bfd_hash_newfunc,
61))
einfo (_("%P%F: bfd_hash_table_init failed: %E\n"));
}
- if (bfd_hash_lookup (link_info.notice_hash, name, TRUE, TRUE)
- == (struct bfd_hash_entry *) NULL)
+ if (bfd_hash_lookup (link_info.notice_hash, name, TRUE, TRUE) == NULL)
einfo (_("%P%F: bfd_hash_lookup failed: %E\n"));
}
/* Record a symbol to be wrapped, from the --wrap option. */
void
-add_wrap (name)
- const char *name;
+add_wrap (const char *name)
{
if (link_info.wrap_hash == NULL)
{
- link_info.wrap_hash = ((struct bfd_hash_table *)
- xmalloc (sizeof (struct bfd_hash_table)));
+ link_info.wrap_hash = xmalloc (sizeof (struct bfd_hash_table));
if (! bfd_hash_table_init_n (link_info.wrap_hash,
bfd_hash_newfunc,
61))
/* Handle the -retain-symbols-file option. */
void
-add_keepsyms_file (filename)
- const char *filename;
+add_keepsyms_file (const char *filename)
{
FILE *file;
char *buf;
einfo (_("%X%P: error: duplicate retain-symbols-file\n"));
file = fopen (filename, "r");
- if (file == (FILE *) NULL)
+ if (file == NULL)
{
bfd_set_error (bfd_error_system_call);
einfo ("%X%P: %s: %E\n", filename);
return;
}
- link_info.keep_hash = ((struct bfd_hash_table *)
- xmalloc (sizeof (struct bfd_hash_table)));
+ link_info.keep_hash = xmalloc (sizeof (struct bfd_hash_table));
if (! bfd_hash_table_init (link_info.keep_hash, bfd_hash_newfunc))
einfo (_("%P%F: bfd_hash_table_init failed: %E\n"));
bufsize = 100;
- buf = (char *) xmalloc (bufsize);
+ buf = xmalloc (bufsize);
c = getc (file);
while (c != EOF)
buf[len] = '\0';
- if (bfd_hash_lookup (link_info.keep_hash, buf, TRUE, TRUE)
- == (struct bfd_hash_entry *) NULL)
+ if (bfd_hash_lookup (link_info.keep_hash, buf, TRUE, TRUE) == NULL)
einfo (_("%P%F: bfd_hash_lookup for insertion failed: %E\n"));
}
}
a link. */
static bfd_boolean
-add_archive_element (info, abfd, name)
- struct bfd_link_info *info ATTRIBUTE_UNUSED;
- bfd *abfd;
- const char *name;
+add_archive_element (struct bfd_link_info *info ATTRIBUTE_UNUSED,
+ bfd *abfd,
+ const char *name)
{
lang_input_statement_type *input;
- input = ((lang_input_statement_type *)
- xmalloc (sizeof (lang_input_statement_type)));
+ input = xmalloc (sizeof (lang_input_statement_type));
input->filename = abfd->filename;
input->local_sym_name = abfd->filename;
input->the_bfd = abfd;
ldlang_add_file (input);
- if (config.map_file != (FILE *) NULL)
+ if (config.map_file != NULL)
{
static bfd_boolean header_printed;
struct bfd_link_hash_entry *h;
multiple times. */
static bfd_boolean
-multiple_definition (info, name, obfd, osec, oval, nbfd, nsec, nval)
- struct bfd_link_info *info ATTRIBUTE_UNUSED;
- const char *name;
- bfd *obfd;
- asection *osec;
- bfd_vma oval;
- bfd *nbfd;
- asection *nsec;
- bfd_vma nval;
+multiple_definition (struct bfd_link_info *info ATTRIBUTE_UNUSED,
+ const char *name,
+ bfd *obfd,
+ asection *osec,
+ bfd_vma oval,
+ bfd *nbfd,
+ asection *nsec,
+ bfd_vma nval)
{
/* If either section has the output_section field set to
bfd_abs_section_ptr, it means that the section is being
einfo (_("%X%C: multiple definition of `%T'\n"),
nbfd, nsec, nval, name);
- if (obfd != (bfd *) NULL)
+ if (obfd != NULL)
einfo (_("%D: first defined here\n"), obfd, osec, oval);
if (command_line.relax)
-warn-common was used. */
static bfd_boolean
-multiple_common (info, name, obfd, otype, osize, nbfd, ntype, nsize)
- struct bfd_link_info *info ATTRIBUTE_UNUSED;
- const char *name;
- bfd *obfd;
- enum bfd_link_hash_type otype;
- bfd_vma osize;
- bfd *nbfd;
- enum bfd_link_hash_type ntype;
- bfd_vma nsize;
+multiple_common (struct bfd_link_info *info ATTRIBUTE_UNUSED,
+ const char *name,
+ bfd *obfd,
+ enum bfd_link_hash_type otype,
+ bfd_vma osize,
+ bfd *nbfd,
+ enum bfd_link_hash_type ntype,
+ bfd_vma nsize)
{
if (! config.warn_common)
return TRUE;
represent a value which should be added to the set. */
static bfd_boolean
-add_to_set (info, h, reloc, abfd, section, value)
- struct bfd_link_info *info ATTRIBUTE_UNUSED;
- struct bfd_link_hash_entry *h;
- bfd_reloc_code_real_type reloc;
- bfd *abfd;
- asection *section;
- bfd_vma value;
+add_to_set (struct bfd_link_info *info ATTRIBUTE_UNUSED,
+ struct bfd_link_hash_entry *h,
+ bfd_reloc_code_real_type reloc,
+ bfd *abfd,
+ asection *section,
+ bfd_vma value)
{
if (config.warn_constructors)
einfo (_("%P: warning: global constructor %s used\n"),
if (! config.build_constructors)
return TRUE;
- ldctor_add_set_entry (h, reloc, (const char *) NULL, section, value);
+ ldctor_add_set_entry (h, reloc, NULL, section, value);
if (h->type == bfd_link_hash_new)
{
adding an element to a set, but less general. */
static bfd_boolean
-constructor_callback (info, constructor, name, abfd, section, value)
- struct bfd_link_info *info;
- bfd_boolean constructor;
- const char *name;
- bfd *abfd;
- asection *section;
- bfd_vma value;
+constructor_callback (struct bfd_link_info *info,
+ bfd_boolean constructor,
+ const char *name,
+ bfd *abfd,
+ asection *section,
+ bfd_vma value)
{
char *s;
struct bfd_link_hash_entry *h;
/* This is called when there is a reference to a warning symbol. */
static bfd_boolean
-warning_callback (info, warning, symbol, abfd, section, address)
- struct bfd_link_info *info ATTRIBUTE_UNUSED;
- const char *warning;
- const char *symbol;
- bfd *abfd;
- asection *section;
- bfd_vma address;
+warning_callback (struct bfd_link_info *info ATTRIBUTE_UNUSED,
+ const char *warning,
+ const char *symbol,
+ bfd *abfd,
+ asection *section,
+ bfd_vma address)
{
/* This is a hack to support warn_multiple_gp. FIXME: This should
have a cleaner interface, but what? */
symsize = bfd_get_symtab_upper_bound (abfd);
if (symsize < 0)
einfo (_("%B%F: could not read symbols: %E\n"), abfd);
- asymbols = (asymbol **) xmalloc (symsize);
+ asymbols = xmalloc (symsize);
symbol_count = bfd_canonicalize_symtab (abfd, asymbols);
if (symbol_count < 0)
einfo (_("%B%F: could not read symbols: %E\n"), abfd);
info.warning = warning;
info.symbol = symbol;
info.asymbols = asymbols;
- bfd_map_over_sections (abfd, warning_find_reloc, (PTR) &info);
+ bfd_map_over_sections (abfd, warning_find_reloc, &info);
if (! info.found)
einfo ("%B: %s\n", abfd, warning);
to give an error message with a file and line number. */
static void
-warning_find_reloc (abfd, sec, iarg)
- bfd *abfd;
- asection *sec;
- PTR iarg;
+warning_find_reloc (bfd *abfd, asection *sec, void *iarg)
{
- struct warning_callback_info *info = (struct warning_callback_info *) iarg;
+ struct warning_callback_info *info = iarg;
long relsize;
arelent **relpp;
long relcount;
if (relsize == 0)
return;
- relpp = (arelent **) xmalloc (relsize);
+ relpp = xmalloc (relsize);
relcount = bfd_canonicalize_reloc (abfd, sec, relpp, info->asymbols);
if (relcount < 0)
einfo (_("%B%F: could not read relocs: %E\n"), abfd);
/* This is called when an undefined symbol is found. */
static bfd_boolean
-undefined_symbol (info, name, abfd, section, address, fatal)
- struct bfd_link_info *info ATTRIBUTE_UNUSED;
- const char *name;
- bfd *abfd;
- asection *section;
- bfd_vma address;
- bfd_boolean fatal ATTRIBUTE_UNUSED;
+undefined_symbol (struct bfd_link_info *info ATTRIBUTE_UNUSED,
+ const char *name,
+ bfd *abfd,
+ asection *section,
+ bfd_vma address,
+ bfd_boolean fatal ATTRIBUTE_UNUSED)
{
static char *error_name;
static unsigned int error_count;
/* Only warn once about a particular undefined symbol. */
if (hash == NULL)
{
- hash = ((struct bfd_hash_table *)
- xmalloc (sizeof (struct bfd_hash_table)));
+ hash = xmalloc (sizeof (struct bfd_hash_table));
if (! bfd_hash_table_init (hash, bfd_hash_newfunc))
einfo (_("%F%P: bfd_hash_table_init failed: %E\n"));
}
/* We never print more than a reasonable number of errors in a row
for a single symbol. */
- if (error_name != (char *) NULL
+ if (error_name != NULL
&& strcmp (name, error_name) == 0)
++error_count;
else
{
error_count = 0;
- if (error_name != (char *) NULL)
+ if (error_name != NULL)
free (error_name);
error_name = xstrdup (name);
}
/* This is called when a reloc overflows. */
static bfd_boolean
-reloc_overflow (info, name, reloc_name, addend, abfd, section, address)
- struct bfd_link_info *info ATTRIBUTE_UNUSED;
- const char *name;
- const char *reloc_name;
- bfd_vma addend;
- bfd *abfd;
- asection *section;
- bfd_vma address;
+reloc_overflow (struct bfd_link_info *info ATTRIBUTE_UNUSED,
+ const char *name,
+ const char *reloc_name,
+ bfd_vma addend,
+ bfd *abfd,
+ asection *section,
+ bfd_vma address)
{
if (overflow_cutoff_limit == -1)
return TRUE;
- if (abfd == (bfd *) NULL)
+ if (abfd == NULL)
einfo (_("%P%X: generated"));
else
einfo ("%X%C:", abfd, section, address);
/* This is called when a dangerous relocation is made. */
static bfd_boolean
-reloc_dangerous (info, message, abfd, section, address)
- struct bfd_link_info *info ATTRIBUTE_UNUSED;
- const char *message;
- bfd *abfd;
- asection *section;
- bfd_vma address;
+reloc_dangerous (struct bfd_link_info *info ATTRIBUTE_UNUSED,
+ const char *message,
+ bfd *abfd,
+ asection *section,
+ bfd_vma address)
{
- if (abfd == (bfd *) NULL)
+ if (abfd == NULL)
einfo (_("%P%X: generated"));
else
einfo ("%X%C:", abfd, section, address);
that is not being output. */
static bfd_boolean
-unattached_reloc (info, name, abfd, section, address)
- struct bfd_link_info *info ATTRIBUTE_UNUSED;
- const char *name;
- bfd *abfd;
- asection *section;
- bfd_vma address;
+unattached_reloc (struct bfd_link_info *info ATTRIBUTE_UNUSED,
+ const char *name,
+ bfd *abfd,
+ asection *section,
+ bfd_vma address)
{
- if (abfd == (bfd *) NULL)
+ if (abfd == NULL)
einfo (_("%P%X: generated"));
else
einfo ("%X%C:", abfd, section, address);
using the -y option. */
static bfd_boolean
-notice (info, name, abfd, section, value)
- struct bfd_link_info *info;
- const char *name;
- bfd *abfd;
- asection *section;
- bfd_vma value;
+notice (struct bfd_link_info *info,
+ const char *name,
+ bfd *abfd,
+ asection *section,
+ bfd_vma value)
{
if (! info->notice_all
|| (info->notice_hash != NULL
extern struct bfd_link_info link_info;
extern int overflow_cutoff_limit;
-extern void add_ysym PARAMS ((const char *));
-extern void add_wrap PARAMS ((const char *));
-extern void add_keepsyms_file PARAMS ((const char *));
+extern void add_ysym (const char *);
+extern void add_wrap (const char *);
+extern void add_keepsyms_file (const char *);
#endif
#include "sysdep.h"
#include "libiberty.h"
#include "demangle.h"
-
-#ifdef ANSI_PROTOTYPES
#include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
-
#include "ld.h"
#include "ldmisc.h"
#include "ldexp.h"
#include "ldmain.h"
#include "ldfile.h"
-static void vfinfo PARAMS ((FILE *, const char *, va_list));
-
/*
%% literal %
%F error is fatal
*/
static void
-vfinfo (fp, fmt, arg)
- FILE *fp;
- const char *fmt;
- va_list arg;
+vfinfo (FILE *fp, const char *fmt, va_list arg)
{
bfd_boolean fatal = FALSE;
case 'W':
/* hex bfd_vma with 0x with no leading zeroes taking up
- 8 spaces. */
+ 8 spaces. */
{
char buf[100];
bfd_vma value;
{
const char *name = va_arg (arg, const char *);
- if (name == (const char *) NULL || *name == 0)
+ if (name == NULL || *name == 0)
fprintf (fp, _("no symbol"));
else if (! demangling)
fprintf (fp, "%s", name);
symsize = bfd_get_symtab_upper_bound (abfd);
if (symsize < 0)
einfo (_("%B%F: could not read symbols\n"), abfd);
- asymbols = (asymbol **) xmalloc (symsize);
+ asymbols = xmalloc (symsize);
symbol_count = bfd_canonicalize_symtab (abfd, asymbols);
if (symbol_count < 0)
einfo (_("%B%F: could not read symbols\n"), abfd);
other such chars that would otherwise confuse the demangler. */
char *
-demangle (name)
- const char *name;
+demangle (const char *name)
{
char *res;
const char *p;
/* Format info message and print on stdout. */
/* (You would think this should be called just "info", but then you
- would hosed by LynxOS, which defines that name in its libc.) */
+ would be hosed by LynxOS, which defines that name in its libc.) */
void
-info_msg VPARAMS ((const char *fmt, ...))
+info_msg (const char *fmt, ...)
{
- VA_OPEN (arg, fmt);
- VA_FIXEDARG (arg, const char *, fmt);
+ va_list arg;
+ va_start (arg, fmt);
vfinfo (stdout, fmt, arg);
- VA_CLOSE (arg);
+ va_end (arg);
}
/* ('e' for error.) Format info message and print on stderr. */
void
-einfo VPARAMS ((const char *fmt, ...))
+einfo (const char *fmt, ...)
{
- VA_OPEN (arg, fmt);
- VA_FIXEDARG (arg, const char *, fmt);
+ va_list arg;
+ va_start (arg, fmt);
vfinfo (stderr, fmt, arg);
- VA_CLOSE (arg);
+ va_end (arg);
}
void
-info_assert (file, line)
- const char *file;
- unsigned int line;
+info_assert (const char *file, unsigned int line)
{
einfo (_("%F%P: internal error %s %d\n"), file, line);
}
/* ('m' for map) Format info message and print on map. */
void
-minfo VPARAMS ((const char *fmt, ...))
+minfo (const char *fmt, ...)
{
- VA_OPEN (arg, fmt);
- VA_FIXEDARG (arg, const char *, fmt);
+ va_list arg;
+ va_start (arg, fmt);
vfinfo (config.map_file, fmt, arg);
- VA_CLOSE (arg);
+ va_end (arg);
}
void
-lfinfo VPARAMS ((FILE *file, const char *fmt, ...))
+lfinfo (FILE *file, const char *fmt, ...)
{
- VA_OPEN (arg, fmt);
- VA_FIXEDARG (arg, FILE *, file);
- VA_FIXEDARG (arg, const char *, fmt);
+ va_list arg;
+ va_start (arg, fmt);
vfinfo (file, fmt, arg);
- VA_CLOSE (arg);
+ va_end (arg);
}
\f
/* Functions to print the link map. */
void
-print_space ()
+print_space (void)
{
fprintf (config.map_file, " ");
}
void
-print_nl ()
+print_nl (void)
{
fprintf (config.map_file, "\n");
}
call this function. */
void
-ld_abort (file, line, fn)
- const char *file;
- int line;
- const char *fn;
+ld_abort (const char *file, int line, const char *fn)
{
if (fn != NULL)
einfo (_("%P: internal error: aborting at %s line %d in %s\n"),
}
bfd_boolean
-error_handler VPARAMS ((int id, const char *fmt, ...))
+error_handler (int id, const char *fmt, ...)
{
- VA_OPEN (arg, fmt);
- VA_FIXEDARG (arg, const char *, fmt);
+ va_list arg;
va_start (arg, fmt);
break;
/* We can be called with
-
+
error_handler (-LD_DEFINITION_IN_DISCARDED_SECTION, "", 0);
-
+
to make this error non-fatal and
error_handler (-LD_DEFINITION_IN_DISCARDED_SECTION, "", 1);
/* Only warn once about a particular undefined symbol. */
if (hash == NULL)
{
- hash = ((struct bfd_hash_table *)
- xmalloc (sizeof (struct bfd_hash_table)));
+ hash = xmalloc (sizeof (struct bfd_hash_table));
if (! bfd_hash_table_init (hash, bfd_hash_newfunc))
einfo (_("%F%P: bfd_hash_table_init failed: %E\n"));
}
break;
}
vfinfo (stderr, fmt, arg);
+
out:
- VA_CLOSE (arg);
+ va_end (arg);
return TRUE;
}
/* ldmisc.h -
- Copyright 1991, 1992, 1993, 1994, 1996, 1997, 2001
+ Copyright 1991, 1992, 1993, 1994, 1996, 1997, 2001, 2003
Free Software Foundation, Inc.
This file is part of GLD, the Gnu Linker.
#ifndef LDMISC_H
#define LDMISC_H
-extern bfd_boolean error_handler PARAMS ((int, const char *, ...));
-extern void einfo PARAMS ((const char *, ...));
-extern void minfo PARAMS ((const char *, ...));
-extern void info_msg PARAMS ((const char *, ...));
-extern void lfinfo PARAMS ((FILE *, const char *, ...));
-extern void info_assert PARAMS ((const char *, unsigned int));
-extern void yyerror PARAMS ((const char *));
-extern PTR xmalloc PARAMS ((size_t));
-extern PTR xrealloc PARAMS ((PTR, size_t));
-extern void xexit PARAMS ((int));
+extern bfd_boolean error_handler (int, const char *, ...);
+extern void einfo (const char *, ...);
+extern void minfo (const char *, ...);
+extern void info_msg (const char *, ...);
+extern void lfinfo (FILE *, const char *, ...);
+extern void info_assert (const char *, unsigned int);
+extern void yyerror (const char *);
+extern void *xmalloc (size_t);
+extern void *xrealloc (void *, size_t);
+extern void xexit (int);
#define ASSERT(x) \
do { if (!(x)) info_assert(__FILE__,__LINE__); } while (0)
#define FAIL() \
do { info_assert(__FILE__,__LINE__); } while (0)
-extern void print_space PARAMS ((void));
-extern void print_nl PARAMS ((void));
-extern char *demangle PARAMS ((const char *));
+extern void print_space (void);
+extern void print_nl (void);
+extern char *demangle (const char *);
#endif
/* ldver.h -- Header file for ldver.c.
- Copyright 1991, 1992, 1993, 1996 Free Software Foundation, Inc.
+ Copyright 1991, 1992, 1993, 1996, 2003 Free Software Foundation, Inc.
This file is part of GLD, the Gnu Linker.
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-void ldversion PARAMS ((int));
+void ldversion (int);
#include <ldgram.h>
#include "ldmain.h"
-static void build_link_order PARAMS ((lang_statement_union_type *));
-static asection *clone_section PARAMS ((bfd *, asection *, const char *, int *));
-static void split_sections PARAMS ((bfd *, struct bfd_link_info *));
-
/* Build link_order structures for the BFD linker. */
static void
-build_link_order (statement)
- lang_statement_union_type *statement;
+build_link_order (lang_statement_union_type *statement)
{
switch (statement->header.type)
{
link_order->type = bfd_data_link_order;
link_order->offset = statement->data_statement.output_vma;
- link_order->u.data.contents = (bfd_byte *) xmalloc (QUAD_SIZE);
+ link_order->u.data.contents = xmalloc (QUAD_SIZE);
value = statement->data_statement.value;
link_order->offset = rs->output_vma;
link_order->size = bfd_get_reloc_size (rs->howto);
- link_order->u.reloc.p =
- ((struct bfd_link_order_reloc *)
- xmalloc (sizeof (struct bfd_link_order_reloc)));
+ link_order->u.reloc.p = xmalloc (sizeof (struct bfd_link_order_reloc));
link_order->u.reloc.p->reloc = rs->reloc;
link_order->u.reloc.p->addend = rs->addend_value;
}
}
-/* Call BFD to write out the linked file. */
-
-/**********************************************************************/
-
/* Wander around the input sections, make sure that
we'll never try and create an output section with more relocs
than will fit.. Do this by always assuming the worst case, and
creating new output sections with all the right bits. */
#define TESTIT 1
static asection *
-clone_section (abfd, s, name, count)
- bfd *abfd;
- asection *s;
- const char *name;
- int *count;
+clone_section (bfd *abfd, asection *s, const char *name, int *count)
{
char templ[6];
char *sname;
#if TESTING
static void
-ds (s)
- asection *s;
+ds (asection *s)
{
struct bfd_link_order *l = s->link_order_head;
printf ("vma %x size %x\n", s->vma, s->_raw_size);
printf ("\n");
}
-dump (s, a1, a2)
- char *s;
- asection *a1;
- asection *a2;
+dump (char *s, asection *a1, asection *a2)
{
printf ("%s\n", s);
ds (a1);
}
static void
-sanity_check (abfd)
- bfd *abfd;
+sanity_check (bfd *abfd)
{
asection *s;
for (s = abfd->sections; s; s = s->next)
#endif
static void
-split_sections (abfd, info)
- bfd *abfd;
- struct bfd_link_info *info;
+split_sections (bfd *abfd, struct bfd_link_info *info)
{
asection *original_sec;
int nsecs = abfd->section_count;
sanity_check (abfd);
}
-/**********************************************************************/
+/* Call BFD to write out the linked file. */
void
-ldwrite ()
+ldwrite (void)
{
/* Reset error indicator, which can typically something like invalid
format from opening up the .o files. */
/* ldwrite.h -
- Copyright 1991, 1992, 1993 Free Software Foundation, Inc.
+ Copyright 1991, 1992, 1993, 2003 Free Software Foundation, Inc.
This file is part of GLD, the Gnu Linker.
You should have received a copy of the GNU General Public License
along with GLD; see the file COPYING. If not, write to
- the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+ the Free Software Foundation, 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
-void ldwrite PARAMS ((void));
+void ldwrite (void);
#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
#endif
-static int is_num PARAMS ((const char *, int, int, int));
-static void set_default_dirlist PARAMS ((char *));
-static void set_section_start PARAMS ((char *, char *));
-static void help PARAMS ((void));
+static void set_default_dirlist (char *);
+static void set_section_start (char *, char *);
+static void help (void);
/* Non-zero if we are processing a --defsym from the command line. */
int parsing_defsym = 0;
#define OPTION_WARN_ONCE (OPTION_WARN_MULTIPLE_GP + 1)
#define OPTION_WARN_SECTION_ALIGN (OPTION_WARN_ONCE + 1)
#define OPTION_SPLIT_BY_RELOC (OPTION_WARN_SECTION_ALIGN + 1)
-#define OPTION_SPLIT_BY_FILE (OPTION_SPLIT_BY_RELOC + 1)
+#define OPTION_SPLIT_BY_FILE (OPTION_SPLIT_BY_RELOC + 1)
#define OPTION_WHOLE_ARCHIVE (OPTION_SPLIT_BY_FILE + 1)
#define OPTION_WRAP (OPTION_WHOLE_ARCHIVE + 1)
#define OPTION_FORCE_EXE_SUFFIX (OPTION_WRAP + 1)
#define OPTION_NO_GC_SECTIONS (OPTION_GC_SECTIONS + 1)
#define OPTION_CHECK_SECTIONS (OPTION_NO_GC_SECTIONS + 1)
#define OPTION_NO_CHECK_SECTIONS (OPTION_CHECK_SECTIONS + 1)
-#define OPTION_MPC860C0 (OPTION_NO_CHECK_SECTIONS + 1)
+#define OPTION_MPC860C0 (OPTION_NO_CHECK_SECTIONS + 1)
#define OPTION_NO_UNDEFINED (OPTION_MPC860C0 + 1)
-#define OPTION_INIT (OPTION_NO_UNDEFINED + 1)
-#define OPTION_FINI (OPTION_INIT + 1)
+#define OPTION_INIT (OPTION_NO_UNDEFINED + 1)
+#define OPTION_FINI (OPTION_INIT + 1)
#define OPTION_SECTION_START (OPTION_FINI + 1)
#define OPTION_UNIQUE (OPTION_SECTION_START + 1)
-#define OPTION_TARGET_HELP (OPTION_UNIQUE + 1)
+#define OPTION_TARGET_HELP (OPTION_UNIQUE + 1)
#define OPTION_ALLOW_SHLIB_UNDEFINED (OPTION_TARGET_HELP + 1)
#define OPTION_NO_ALLOW_SHLIB_UNDEFINED (OPTION_ALLOW_SHLIB_UNDEFINED + 1)
#define OPTION_ALLOW_MULTIPLE_DEFINITION (OPTION_NO_ALLOW_SHLIB_UNDEFINED + 1)
between MIN and MAX. The return value is the number or ERR. */
static int
-is_num (string, min, max, err)
- const char *string;
- int min;
- int max;
- int err;
+is_num (const char *string, int min, int max, int err)
{
int result = 0;
}
void
-parse_args (argc, argv)
- unsigned argc;
- char **argv;
+parse_args (unsigned argc, char **argv)
{
unsigned i;
int is, il, irl;
struct option *really_longopts;
int last_optind;
- shortopts = (char *) xmalloc (OPTION_COUNT * 3 + 2);
- longopts = (struct option *) xmalloc (sizeof (*longopts)
- * (OPTION_COUNT + 1));
- really_longopts = (struct option *) xmalloc (sizeof (*really_longopts)
- * (OPTION_COUNT + 1));
+ shortopts = xmalloc (OPTION_COUNT * 3 + 2);
+ longopts = xmalloc (sizeof (*longopts) * (OPTION_COUNT + 1));
+ really_longopts = xmalloc (sizeof (*really_longopts) * (OPTION_COUNT + 1));
/* Starting the short option string with '-' is for programs that
expect options and other ARGV-elements in any order and that care about
{
char *n;
- n = (char *) xmalloc (strlen (argv[i]) + 20);
+ n = xmalloc (strlen (argv[i]) + 20);
sprintf (n, "--library=%s", argv[i] + 2);
argv[i] = n;
}
einfo (_("%P%F: use the --help option for usage information\n"));
case 1: /* File name. */
- lang_add_input_file (optarg, lang_input_file_is_file_enum,
- (char *) NULL);
+ lang_add_input_file (optarg, lang_input_file_is_file_enum, NULL);
break;
case OPTION_IGNORE:
break;
case 'a':
/* For HP/UX compatibility. Actually -a shared should mean
- ``use only shared libraries'' but, then, we don't
- currently support shared libraries on HP/UX anyhow. */
+ ``use only shared libraries'' but, then, we don't
+ currently support shared libraries on HP/UX anyhow. */
if (strcmp (optarg, "archive") == 0)
config.dynamic_link = FALSE;
else if (strcmp (optarg, "shared") == 0
case 'f':
if (command_line.auxiliary_filters == NULL)
{
- command_line.auxiliary_filters =
- (char **) xmalloc (2 * sizeof (char *));
+ command_line.auxiliary_filters = xmalloc (2 * sizeof (char *));
command_line.auxiliary_filters[0] = optarg;
command_line.auxiliary_filters[1] = NULL;
}
c = 0;
for (p = command_line.auxiliary_filters; *p != NULL; p++)
++c;
- command_line.auxiliary_filters =
- (char **) xrealloc (command_line.auxiliary_filters,
- (c + 2) * sizeof (char *));
+ command_line.auxiliary_filters
+ = xrealloc (command_line.auxiliary_filters,
+ (c + 2) * sizeof (char *));
command_line.auxiliary_filters[c] = optarg;
command_line.auxiliary_filters[c + 1] = NULL;
}
ldfile_add_library_path (optarg, TRUE);
break;
case 'l':
- lang_add_input_file (optarg, lang_input_file_is_l_enum,
- (char *) NULL);
+ lang_add_input_file (optarg, lang_input_file_is_l_enum, NULL);
break;
case 'M':
config.map_filename = "-";
lang_add_output (optarg, 0);
break;
case OPTION_OFORMAT:
- lang_add_output_format (optarg, (char *) NULL, (char *) NULL, 0);
+ lang_add_output_format (optarg, NULL, NULL, 0);
break;
case 'q':
link_info.emitrelocations = TRUE;
{
lang_add_input_file (optarg,
lang_input_file_is_symbols_only_enum,
- (char *) NULL);
+ NULL);
break;
}
}
break;
case OPTION_VERSION_SCRIPT:
/* This option indicates a small script that only specifies
- version information. Read it, but don't assume that
- we've seen a linker script. */
+ version information. Read it, but don't assume that
+ we've seen a linker script. */
{
FILE *hold_script_handle;
library search path. */
static void
-set_default_dirlist (dirlist_ptr)
- char *dirlist_ptr;
+set_default_dirlist (char *dirlist_ptr)
{
char *p;
}
static void
-set_section_start (sect, valstr)
- char *sect, *valstr;
+set_section_start (char *sect, char *valstr)
{
const char *end;
bfd_vma val = bfd_scan_vma (valstr, &end, 16);
/* Print help messages for the options. */
static void
-help ()
+help (void)
{
unsigned i;
const char **targets, **pp;
/* mri.c -- handle MRI style linker scripts
- Copyright 1991, 1992, 1993, 1994, 1996, 1997, 1998, 1999, 2000, 2002
+ Copyright 1991, 1992, 1993, 1994, 1996, 1997, 1998, 1999, 2000, 2002, 2003
Free Software Foundation, Inc.
This file is part of GLD, the Gnu Linker.
struct section_name_struct *alignment;
struct section_name_struct *subalignment;
-static struct section_name_struct **lookup
- PARAMS ((const char *name, struct section_name_struct **list));
-static void mri_add_to_list PARAMS ((struct section_name_struct **list,
- const char *name, etree_type *vma,
- const char *zalias, etree_type *align,
- etree_type *subalign));
-
static struct section_name_struct **
-lookup (name, list)
- const char *name;
- struct section_name_struct **list;
+lookup (const char *name, struct section_name_struct **list)
{
struct section_name_struct **ptr = list;
ptr = &((*ptr)->next);
}
- *ptr = (struct section_name_struct *) xmalloc (sizeof (struct section_name_struct));
+ *ptr = xmalloc (sizeof (struct section_name_struct));
return ptr;
}
static void
-mri_add_to_list (list, name, vma, zalias, align, subalign)
- struct section_name_struct **list;
- const char *name;
- etree_type *vma;
- const char *zalias;
- etree_type *align;
- etree_type *subalign;
+mri_add_to_list (struct section_name_struct **list,
+ const char *name,
+ etree_type *vma,
+ const char *zalias,
+ etree_type *align,
+ etree_type *subalign)
{
struct section_name_struct **ptr = lookup (name, list);
(*ptr)->name = name;
(*ptr)->vma = vma;
- (*ptr)->next = (struct section_name_struct *) NULL;
+ (*ptr)->next = NULL;
(*ptr)->ok_to_load = 0;
(*ptr)->alias = zalias;
(*ptr)->align = align;
}
void
-mri_output_section (name, vma)
- const char *name;
- etree_type *vma;
+mri_output_section (const char *name, etree_type *vma)
{
mri_add_to_list (&address, name, vma, 0, 0, 0);
}
marked thus. */
void
-mri_only_load (name)
- const char *name;
+mri_only_load (const char *name)
{
mri_add_to_list (&only_load, name, 0, 0, 0, 0);
}
void
-mri_base (exp)
- etree_type *exp;
+mri_base (etree_type *exp)
{
base = exp;
}
static int done_tree = 0;
void
-mri_draw_tree ()
+mri_draw_tree (void)
{
if (done_tree)
return;
r = lang_memory_region_lookup("long");
r->current = r->origin = exp_get_vma (base, (bfd_vma)0, "origin",
lang_first_phase_enum);
- r->length = (bfd_size_type) exp_get_vma (0, (bfd_vma) ~((bfd_size_type)0),
- "length", lang_first_phase_enum);
+ r->length = (bfd_size_type) exp_get_vma (0, ~(bfd_vma) 0, "length",
+ lang_first_phase_enum);
}
#endif
/* Attach the addresses of any which have addresses,
and add the ones not mentioned. */
- if (address != (struct section_name_struct *) NULL)
+ if (address != NULL)
{
struct section_name_struct *alist;
struct section_name_struct *olist;
- if (order == (struct section_name_struct *) NULL)
+ if (order == NULL)
order = address;
for (alist = address;
- alist != (struct section_name_struct *) NULL;
+ alist != NULL;
alist = alist->next)
{
int done = 0;
- for (olist = order;
- done == 0 && olist != (struct section_name_struct *) NULL;
- olist = olist->next)
+ for (olist = order; done == 0 && olist != NULL; olist = olist->next)
{
if (strcmp (alist->name, olist->name) == 0)
{
/* If we're only supposed to load a subset of them in, then prune
the list. */
- if (only_load != (struct section_name_struct *) NULL)
+ if (only_load != NULL)
{
struct section_name_struct *ptr1;
struct section_name_struct *ptr2;
- if (order == (struct section_name_struct *) NULL)
+ if (order == NULL)
order = only_load;
/* See if this name is in the list, if it is then we can load it. */
}
/* Create the order of sections to load. */
- if (order != (struct section_name_struct *) NULL)
+ if (order != NULL)
{
/* Been told to output the sections in a certain order. */
struct section_name_struct *p = order;
lang_enter_output_section_statement (p->name, base,
p->ok_to_load ? 0 : noload_section,
- 1, align, subalign,
- (etree_type *) NULL);
+ 1, align, subalign, NULL);
base = 0;
- tmp = (struct wildcard_list *) xmalloc (sizeof *tmp);
+ tmp = xmalloc (sizeof *tmp);
tmp->next = NULL;
tmp->spec.name = p->name;
tmp->spec.exclude_name_list = NULL;
for (aptr = alias; aptr; aptr = aptr->next)
if (strcmp (aptr->alias, p->name) == 0)
{
- tmp = (struct wildcard_list *) xmalloc (sizeof *tmp);
+ tmp = xmalloc (sizeof *tmp);
tmp->next = NULL;
tmp->spec.name = aptr->name;
tmp->spec.exclude_name_list = NULL;
lang_add_wild (NULL, tmp, FALSE);
}
- lang_leave_output_section_statement
- (0, "*default*", (struct lang_output_section_phdr_list *) NULL,
- NULL);
+ lang_leave_output_section_statement (0, "*default*", NULL, NULL);
p = p->next;
}
}
void
-mri_load (name)
- const char *name;
+mri_load (const char *name)
{
base = 0;
- lang_add_input_file (name,
- lang_input_file_is_file_enum, (char *) NULL);
+ lang_add_input_file (name, lang_input_file_is_file_enum, NULL);
#if 0
lang_leave_output_section_statement (0, "*default*");
#endif
}
void
-mri_order (name)
- const char *name;
+mri_order (const char *name)
{
mri_add_to_list (&order, name, 0, 0, 0, 0);
}
void
-mri_alias (want, is, isn)
- const char *want;
- const char *is;
- int isn;
+mri_alias (const char *want, const char *is, int isn)
{
if (!is)
{
}
void
-mri_name (name)
- const char *name;
+mri_name (const char *name)
{
lang_add_output (name, 1);
}
void
-mri_format (name)
- const char *name;
+mri_format (const char *name)
{
if (strcmp (name, "S") == 0)
- lang_add_output_format ("srec", (char *) NULL, (char *) NULL, 1);
+ lang_add_output_format ("srec", NULL, NULL, 1);
else if (strcmp (name, "IEEE") == 0)
- lang_add_output_format ("ieee", (char *) NULL, (char *) NULL, 1);
+ lang_add_output_format ("ieee", NULL, NULL, 1);
else if (strcmp (name, "COFF") == 0)
- lang_add_output_format ("coff-m68k", (char *) NULL, (char *) NULL, 1);
+ lang_add_output_format ("coff-m68k", NULL, NULL, 1);
else
einfo (_("%P%F: unknown format type %s\n"), name);
}
void
-mri_public (name, exp)
- const char *name;
- etree_type *exp;
+mri_public (const char *name, etree_type *exp)
{
lang_add_assignment (exp_assop ('=', name, exp));
}
void
-mri_align (name, exp)
- const char *name;
- etree_type *exp;
+mri_align (const char *name, etree_type *exp)
{
mri_add_to_list (&alignment, name, 0, 0, exp, 0);
}
void
-mri_alignmod (name, exp)
- const char *name;
- etree_type *exp;
+mri_alignmod (const char *name, etree_type *exp)
{
mri_add_to_list (&subalignment, name, 0, 0, 0, exp);
}
void
-mri_truncate (exp)
- unsigned int exp;
+mri_truncate (unsigned int exp)
{
symbol_truncate = exp;
}
/* mri.h -- header file for MRI scripting functions
- Copyright 1993, 1995, 1996 Free Software Foundation, Inc.
+ Copyright 1993, 1995, 1996, 2003 Free Software Foundation, Inc.
This file is part of GLD, the Gnu Linker.
extern unsigned int symbol_truncate;
-extern void mri_output_section PARAMS ((const char *name, etree_type *vma));
-extern void mri_only_load PARAMS ((const char *name));
-extern void mri_base PARAMS ((etree_type *exp));
-extern void mri_load PARAMS ((const char *name));
-extern void mri_order PARAMS ((const char *name));
-extern void mri_alias PARAMS ((const char *want, const char *is, int isn));
-extern void mri_name PARAMS ((const char *name));
-extern void mri_format PARAMS ((const char *name));
-extern void mri_public PARAMS ((const char *name, etree_type *exp));
-extern void mri_align PARAMS ((const char *name, etree_type *exp));
-extern void mri_alignmod PARAMS ((const char *name, etree_type *exp));
-extern void mri_truncate PARAMS ((unsigned int exp));
-extern void mri_draw_tree PARAMS ((void));
+extern void mri_output_section (const char *, etree_type *);
+extern void mri_only_load (const char *);
+extern void mri_base (etree_type *);
+extern void mri_load (const char *);
+extern void mri_order (const char *);
+extern void mri_alias (const char *, const char *, int);
+extern void mri_name (const char *);
+extern void mri_format (const char *);
+extern void mri_public (const char *, etree_type *);
+extern void mri_align (const char *, etree_type *);
+extern void mri_alignmod (const char *, etree_type *);
+extern void mri_truncate (unsigned int);
+extern void mri_draw_tree (void);
#endif
See also: ld/emultempl/pe.em. */
-static void
-add_bfd_to_link PARAMS ((bfd *, const char *, struct bfd_link_info *));
+static void add_bfd_to_link (bfd *, const char *, struct bfd_link_info *);
/* For emultempl/pe.em. */
#define U(str) (pe_details->underscored ? "_" str : str)
-static int reloc_sort PARAMS ((const void *, const void *));
-static int pe_export_sort PARAMS ((const void *, const void *));
-static int auto_export PARAMS ((bfd *, def_file *, const char *));
-static void process_def_file PARAMS ((bfd *, struct bfd_link_info *));
-static void build_filler_bfd PARAMS ((int));
-static void generate_edata PARAMS ((bfd *, struct bfd_link_info *));
-static void fill_exported_offsets PARAMS ((bfd *, struct bfd_link_info *));
-static void fill_edata PARAMS ((bfd *, struct bfd_link_info *));
-static void generate_reloc PARAMS ((bfd *, struct bfd_link_info *));
-static void quoteput PARAMS ((char *, FILE *, int));
-static asection *quick_section PARAMS ((bfd *, const char *, int, int));
-static void quick_symbol
- PARAMS ((bfd *, const char *, const char *, const char *,
- asection *, int, int));
-static void quick_reloc PARAMS ((bfd *, int, int, int));
-static bfd *make_head PARAMS ((bfd *));
-static bfd *make_tail PARAMS ((bfd *));
-static bfd *make_one PARAMS ((def_file_export *, bfd *));
-static bfd *make_singleton_name_thunk PARAMS ((const char *, bfd *));
-static char *make_import_fixup_mark PARAMS ((arelent *));
-static bfd *make_import_fixup_entry
- PARAMS ((const char *, const char *, const char *, bfd *));
-static bfd *make_runtime_pseudo_reloc
- PARAMS ((const char *, const char *, int, bfd *));
-static bfd *pe_create_runtime_relocator_reference
- PARAMS ((bfd *));
-static unsigned int pe_get16 PARAMS ((bfd *, int));
-static unsigned int pe_get32 PARAMS ((bfd *, int));
-static unsigned int pe_as32 PARAMS ((void *));
-
void
-pe_dll_id_target (target)
- const char *target;
+pe_dll_id_target (const char *target)
{
int i;
reloc_data_type;
static int
-reloc_sort (va, vb)
- const void *va, *vb;
+reloc_sort (const void *va, const void *vb)
{
- bfd_vma a = ((reloc_data_type *) va)->vma;
- bfd_vma b = ((reloc_data_type *) vb)->vma;
+ bfd_vma a = ((const reloc_data_type *) va)->vma;
+ bfd_vma b = ((const reloc_data_type *) vb)->vma;
return (a > b) ? 1 : ((a < b) ? -1 : 0);
}
static int
-pe_export_sort (va, vb)
- const void *va, *vb;
+pe_export_sort (const void *va, const void *vb)
{
- def_file_export *a = (def_file_export *) va;
- def_file_export *b = (def_file_export *) vb;
+ const def_file_export *a = va;
+ const def_file_export *b = vb;
return strcmp (a->name, b->name);
}
static struct exclude_list_struct *excludes = 0;
void
-pe_dll_add_excludes (new_excludes, type)
- const char *new_excludes;
- const int type;
+pe_dll_add_excludes (const char *new_excludes, const int type)
{
char *local_copy;
char *exclude_string;
{
struct exclude_list_struct *new_exclude;
- new_exclude = ((struct exclude_list_struct *)
- xmalloc (sizeof (struct exclude_list_struct)));
- new_exclude->string = (char *) xmalloc (strlen (exclude_string) + 1);
+ new_exclude = xmalloc (sizeof (struct exclude_list_struct));
+ new_exclude->string = xmalloc (strlen (exclude_string) + 1);
strcpy (new_exclude->string, exclude_string);
new_exclude->type = type;
new_exclude->next = excludes;
It can be used for contextual checks. */
static int
-auto_export (abfd, d, n)
- bfd *abfd;
- def_file *d;
- const char *n;
+auto_export (bfd *abfd, def_file *d, const char *n)
{
int i;
struct exclude_list_struct *ex;
n, abfd, abfd->my_archive);
/* First of all, make context checks:
- Don't export anything from standard libs. */
+ Don't export anything from standard libs. */
if (libname)
{
afptr = autofilter_liblist;
}
static void
-process_def_file (abfd, info)
- bfd *abfd ATTRIBUTE_UNUSED;
- struct bfd_link_info *info;
+process_def_file (bfd *abfd ATTRIBUTE_UNUSED, struct bfd_link_info *info)
{
int i, j;
struct bfd_link_hash_entry *blhe;
/* If we are not building a DLL, when there are no exports
we do not build an export table at all. */
if (!pe_dll_export_everything && pe_def_file->num_exports == 0
- && !(info->shared))
+ && !info->shared)
return;
/* Now, maybe export everything else the default way. */
int nsyms, symsize;
symsize = bfd_get_symtab_upper_bound (b);
- symbols = (asymbol **) xmalloc (symsize);
+ symbols = xmalloc (symsize);
nsyms = bfd_canonicalize_symtab (b, symbols);
for (j = 0; j < nsyms; j++)
{
/* We should export symbols which are either global or not
- anything at all. (.bss data is the latter)
- We should not export undefined symbols. */
+ anything at all. (.bss data is the latter)
+ We should not export undefined symbols. */
if (symbols[j]->section != &bfd_und_section
&& ((symbols[j]->flags & BSF_GLOBAL)
|| (symbols[j]->flags == BFD_FORT_COMM_DEFAULT_VALUE)))
/* We should not re-export imported stuff. */
{
- char *name = (char *) xmalloc (strlen (sn) + 2 + 6);
+ char *name = xmalloc (strlen (sn) + 2 + 6);
sprintf (name, "%s%s", U("_imp_"), sn);
blhe = bfd_link_hash_lookup (info->hash, name,
if (strchr (pe_def_file->exports[i].name, '@'))
{
/* This will preserve internal_name, which may have been
- pointing to the same memory as name, or might not
- have. */
- int lead_at = (*pe_def_file->exports[i].name =='@');
+ pointing to the same memory as name, or might not
+ have. */
+ int lead_at = (*pe_def_file->exports[i].name == '@');
char *tmp = xstrdup (pe_def_file->exports[i].name + lead_at);
*(strchr (tmp, '@')) = 0;
{
if (strchr (pe_def_file->exports[i].name, '@'))
{
- int lead_at = (*pe_def_file->exports[i].name == '@' ) ;
+ int lead_at = (*pe_def_file->exports[i].name == '@');
char *tmp = xstrdup (pe_def_file->exports[i].name + lead_at);
*(strchr (tmp, '@')) = 0;
/* Convenience, but watch out for it changing. */
e = pe_def_file->exports;
- exported_symbol_offsets = (bfd_vma *) xmalloc (NE * sizeof (bfd_vma));
- exported_symbol_sections = (struct sec **) xmalloc (NE * sizeof (struct sec *));
+ exported_symbol_offsets = xmalloc (NE * sizeof (bfd_vma));
+ exported_symbol_sections = xmalloc (NE * sizeof (struct sec *));
memset (exported_symbol_sections, 0, NE * sizeof (struct sec *));
max_ordinal = 0;
count_exported_byname = 0;
count_with_ordinals = 0;
- qsort (pe_def_file->exports, NE, sizeof (pe_def_file->exports[0]), pe_export_sort);
+ qsort (pe_def_file->exports, NE, sizeof (pe_def_file->exports[0]),
+ pe_export_sort);
for (i = 0, j = 0; i < NE; i++)
{
if (i > 0 && strcmp (e[i].name, e[i - 1].name) == 0)
for (i = 0; i < NE; i++)
{
- char *name = (char *) xmalloc (strlen (pe_def_file->exports[i].internal_name) + 2);
+ char *name;
+ name = xmalloc (strlen (pe_def_file->exports[i].internal_name) + 2);
if (pe_details->underscored
&& (*pe_def_file->exports[i].internal_name != '@'))
{
/* Build the bfd that will contain .edata and .reloc sections. */
static void
-build_filler_bfd (include_edata)
- int include_edata;
+build_filler_bfd (int include_edata)
{
lang_input_statement_type *filler_file;
filler_file = lang_add_input_file ("dll stuff",
/* Gather all the exported symbols and build the .edata section. */
static void
-generate_edata (abfd, info)
- bfd *abfd;
- struct bfd_link_info *info ATTRIBUTE_UNUSED;
+generate_edata (bfd *abfd, struct bfd_link_info *info ATTRIBUTE_UNUSED)
{
int i, next_ordinal;
int name_table_size = 0;
}
export_table_size = max_ordinal - min_ordinal + 1;
- exported_symbols = (int *) xmalloc (export_table_size * sizeof (int));
+ exported_symbols = xmalloc (export_table_size * sizeof (int));
for (i = 0; i < export_table_size; i++)
exported_symbols[i] = -1;
been done in process_def_file(). */
static void
-fill_exported_offsets (abfd, info)
- bfd *abfd ATTRIBUTE_UNUSED;
- struct bfd_link_info *info;
+fill_exported_offsets (bfd *abfd ATTRIBUTE_UNUSED, struct bfd_link_info *info)
{
int i;
struct bfd_link_hash_entry *blhe;
for (i = 0; i < pe_def_file->num_exports; i++)
{
- char *name = (char *) xmalloc (strlen (pe_def_file->exports[i].internal_name) + 2);
+ char *name;
+ name = xmalloc (strlen (pe_def_file->exports[i].internal_name) + 2);
if (pe_details->underscored
- && (*pe_def_file->exports[i].internal_name != '@'))
+ && *pe_def_file->exports[i].internal_name != '@')
{
*name = '_';
strcpy (name + 1, pe_def_file->exports[i].internal_name);
name,
FALSE, FALSE, TRUE);
- if (blhe && (blhe->type == bfd_link_hash_defined))
+ if (blhe && blhe->type == bfd_link_hash_defined)
exported_symbol_offsets[i] = blhe->u.def.value;
free (name);
}
static void
-fill_edata (abfd, info)
- bfd *abfd;
- struct bfd_link_info *info ATTRIBUTE_UNUSED;
+fill_edata (bfd *abfd, struct bfd_link_info *info ATTRIBUTE_UNUSED)
{
int s, hint;
unsigned char *edirectory;
time (&now);
- edata_d = (unsigned char *) xmalloc (edata_sz);
+ edata_d = xmalloc (edata_sz);
/* Note use of array pointer math here. */
edirectory = edata_d;
eordinals = (unsigned short *) (enameptrs + count_exported_byname);
enamestr = (char *) (eordinals + count_exported_byname);
-#define ERVA(ptr) (((unsigned char *)(ptr) - edata_d) + edata_s->output_section->vma - image_base)
+#define ERVA(ptr) (((unsigned char *)(ptr) - edata_d) \
+ + edata_s->output_section->vma - image_base)
memset (edata_d, 0, edata_sz);
bfd_put_32 (abfd, now, edata_d + 4);
rather than by ordinal - the ordering in the exported_symbol[]
table. See dlltool.c and:
http://sources.redhat.com/ml/binutils/2003-04/msg00379.html
- for more information. */
+ for more information. */
hint = 0;
for (s = 0; s < NE; s++)
{
static struct sec *current_sec;
void
-pe_walk_relocs_of_symbol (info, name, cb)
- struct bfd_link_info *info;
- const char *name;
- int (*cb) (arelent *, asection *);
+pe_walk_relocs_of_symbol (struct bfd_link_info *info,
+ const char *name,
+ int (*cb) (arelent *, asection *))
{
bfd *b;
asection *s;
int nsyms, symsize;
symsize = bfd_get_symtab_upper_bound (b);
- symbols = (asymbol **) xmalloc (symsize);
+ symbols = xmalloc (symsize);
nsyms = bfd_canonicalize_symtab (b, symbols);
for (s = b->sections; s; s = s->next)
current_sec = s;
relsize = bfd_get_reloc_upper_bound (b, s);
- relocs = (arelent **) xmalloc ((size_t) relsize);
+ relocs = xmalloc (relsize);
nrelocs = bfd_canonicalize_reloc (b, s, relocs, symbols);
for (i = 0; i < nrelocs; i++)
/* Gather all the relocations and build the .reloc section. */
static void
-generate_reloc (abfd, info)
- bfd *abfd;
- struct bfd_link_info *info;
+generate_reloc (bfd *abfd, struct bfd_link_info *info)
{
/* For .reloc stuff. */
reloc_data_type *reloc_data;
int total_relocs = 0;
int i;
- unsigned long sec_page = (unsigned long) (-1);
+ unsigned long sec_page = (unsigned long) -1;
unsigned long page_ptr, page_count;
int bi;
bfd *b;
for (s = b->sections; s; s = s->next)
total_relocs += s->reloc_count;
- reloc_data =
- (reloc_data_type *) xmalloc (total_relocs * sizeof (reloc_data_type));
+ reloc_data = xmalloc (total_relocs * sizeof (reloc_data_type));
total_relocs = 0;
bi = 0;
}
symsize = bfd_get_symtab_upper_bound (b);
- symbols = (asymbol **) xmalloc (symsize);
+ symbols = xmalloc (symsize);
nsyms = bfd_canonicalize_symtab (b, symbols);
relsize = bfd_get_reloc_upper_bound (b, s);
- relocs = (arelent **) xmalloc ((size_t) relsize);
+ relocs = xmalloc (relsize);
nrelocs = bfd_canonicalize_reloc (b, s, relocs, symbols);
for (i = 0; i < nrelocs; i++)
}
reloc_sz = (reloc_sz + 3) & ~3; /* 4-byte align. */
- reloc_d = (unsigned char *) xmalloc (reloc_sz);
- sec_page = (unsigned long) (-1);
+ reloc_d = xmalloc (reloc_sz);
+ sec_page = (unsigned long) -1;
reloc_sz = 0;
- page_ptr = (unsigned long) (-1);
+ page_ptr = (unsigned long) -1;
page_count = 0;
for (i = 0; i < total_relocs; i++)
while (reloc_sz & 3)
reloc_d[reloc_sz++] = 0;
- if (page_ptr != (unsigned long) (-1))
+ if (page_ptr != (unsigned long) -1)
bfd_put_32 (abfd, reloc_sz - page_ptr, reloc_d + page_ptr + 4);
bfd_put_32 (abfd, this_page, reloc_d + reloc_sz);
while (reloc_sz & 3)
reloc_d[reloc_sz++] = 0;
- if (page_ptr != (unsigned long) (-1))
+ if (page_ptr != (unsigned long) -1)
bfd_put_32 (abfd, reloc_sz - page_ptr, reloc_d + page_ptr + 4);
while (reloc_sz < reloc_s->_raw_size)
corresponds to it. */
static void
-quoteput (s, f, needs_quotes)
- char *s;
- FILE *f;
- int needs_quotes;
+quoteput (char *s, FILE *f, int needs_quotes)
{
char *cp;
}
void
-pe_dll_generate_def_file (pe_out_def_filename)
- const char *pe_out_def_filename;
+pe_dll_generate_def_file (const char *pe_out_def_filename)
{
int i;
FILE *out = fopen (pe_out_def_filename, "w");
#define UNDSEC (asection *) &bfd_und_section
static asection *
-quick_section (abfd, name, flags, align)
- bfd *abfd;
- const char *name;
- int flags;
- int align;
+quick_section (bfd *abfd, const char *name, int flags, int align)
{
asection *sec;
asymbol *sym;
}
static void
-quick_symbol (abfd, n1, n2, n3, sec, flags, addr)
- bfd *abfd;
- const char *n1;
- const char *n2;
- const char *n3;
- asection *sec;
- int flags;
- int addr;
+quick_symbol (bfd *abfd,
+ const char *n1,
+ const char *n2,
+ const char *n3,
+ asection *sec,
+ int flags,
+ int addr)
{
asymbol *sym;
- char *name = (char *) xmalloc (strlen (n1) + strlen (n2) + strlen (n3) + 1);
+ char *name = xmalloc (strlen (n1) + strlen (n2) + strlen (n3) + 1);
strcpy (name, n1);
strcat (name, n2);
static int relcount = 0, relsize = 0;
static void
-quick_reloc (abfd, address, which_howto, symidx)
- bfd *abfd;
- int address;
- int which_howto;
- int symidx;
+quick_reloc (bfd *abfd, int address, int which_howto, int symidx)
{
- if (relcount >= (relsize - 1))
+ if (relcount >= relsize - 1)
{
relsize += 10;
if (reltab)
- reltab = (arelent *) xrealloc (reltab, relsize * sizeof (arelent));
+ reltab = xrealloc (reltab, relsize * sizeof (arelent));
else
- reltab = (arelent *) xmalloc (relsize * sizeof (arelent));
+ reltab = xmalloc (relsize * sizeof (arelent));
}
reltab[relcount].address = address;
reltab[relcount].addend = 0;
sec->relocation = reltab;
sec->reloc_count = relcount;
- sec->orelocation = (arelent **) xmalloc ((relcount + 1) * sizeof (arelent *));
+ sec->orelocation = xmalloc ((relcount + 1) * sizeof (arelent *));
for (i = 0; i < relcount; i++)
sec->orelocation[i] = sec->relocation + i;
sec->orelocation[relcount] = 0;
hname: */
static bfd *
-make_head (parent)
- bfd *parent;
+make_head (bfd *parent)
{
asection *id2, *id5, *id4;
unsigned char *d2, *d5, *d4;
char *oname;
bfd *abfd;
- oname = (char *) xmalloc (20);
+ oname = xmalloc (20);
sprintf (oname, "d%06d.o", tmp_seq);
tmp_seq++;
bfd_set_arch_mach (abfd, pe_details->bfd_arch, 0);
symptr = 0;
- symtab = (asymbol **) xmalloc (6 * sizeof (asymbol *));
+ symtab = xmalloc (6 * sizeof (asymbol *));
id2 = quick_section (abfd, ".idata$2", SEC_HAS_CONTENTS, 2);
id5 = quick_section (abfd, ".idata$5", SEC_HAS_CONTENTS, 2);
id4 = quick_section (abfd, ".idata$4", SEC_HAS_CONTENTS, 2);
the start of the list of sections from other objects. */
bfd_set_section_size (abfd, id2, 20);
- d2 = (unsigned char *) xmalloc (20);
+ d2 = xmalloc (20);
id2->contents = d2;
memset (d2, 0, 20);
d2[0] = d2[16] = 4; /* Reloc addend. */
save_relocs (id2);
bfd_set_section_size (abfd, id5, 4);
- d5 = (unsigned char *) xmalloc (4);
+ d5 = xmalloc (4);
id5->contents = d5;
memset (d5, 0, 4);
bfd_set_section_size (abfd, id4, 4);
- d4 = (unsigned char *) xmalloc (4);
+ d4 = xmalloc (4);
id4->contents = d4;
memset (d4, 0, 4);
.asciz "my.dll" */
static bfd *
-make_tail (parent)
- bfd *parent;
+make_tail (bfd *parent)
{
asection *id4, *id5, *id7;
unsigned char *d4, *d5, *d7;
char *oname;
bfd *abfd;
- oname = (char *) xmalloc (20);
+ oname = xmalloc (20);
sprintf (oname, "d%06d.o", tmp_seq);
tmp_seq++;
bfd_set_arch_mach (abfd, pe_details->bfd_arch, 0);
symptr = 0;
- symtab = (asymbol **) xmalloc (5 * sizeof (asymbol *));
+ symtab = xmalloc (5 * sizeof (asymbol *));
id4 = quick_section (abfd, ".idata$4", SEC_HAS_CONTENTS, 2);
id5 = quick_section (abfd, ".idata$5", SEC_HAS_CONTENTS, 2);
id7 = quick_section (abfd, ".idata$7", SEC_HAS_CONTENTS, 2);
quick_symbol (abfd, U (""), dll_symname, "_iname", id7, BSF_GLOBAL, 0);
bfd_set_section_size (abfd, id4, 4);
- d4 = (unsigned char *) xmalloc (4);
+ d4 = xmalloc (4);
id4->contents = d4;
memset (d4, 0, 4);
bfd_set_section_size (abfd, id5, 4);
- d5 = (unsigned char *) xmalloc (4);
+ d5 = xmalloc (4);
id5->contents = d5;
memset (d5, 0, 4);
if (len & 1)
len++;
bfd_set_section_size (abfd, id7, len);
- d7 = (unsigned char *) xmalloc (len);
+ d7 = xmalloc (len);
id7->contents = d7;
strcpy (d7, dll_filename);
};
static bfd *
-make_one (exp, parent)
- def_file_export *exp;
- bfd *parent;
+make_one (def_file_export *exp, bfd *parent)
{
asection *tx, *id7, *id5, *id4, *id6;
unsigned char *td = NULL, *d7, *d5, *d4, *d6 = NULL;
abort ();
}
- oname = (char *) xmalloc (20);
+ oname = xmalloc (20);
sprintf (oname, "d%06d.o", tmp_seq);
tmp_seq++;
bfd_set_arch_mach (abfd, pe_details->bfd_arch, 0);
symptr = 0;
- symtab = (asymbol **) xmalloc (11 * sizeof (asymbol *));
+ symtab = xmalloc (11 * sizeof (asymbol *));
tx = quick_section (abfd, ".text", SEC_CODE|SEC_HAS_CONTENTS, 2);
id7 = quick_section (abfd, ".idata$7", SEC_HAS_CONTENTS, 2);
id5 = quick_section (abfd, ".idata$5", SEC_HAS_CONTENTS, 2);
{
if (! exp->flag_data)
quick_symbol (abfd, "", exp->internal_name, "", tx, BSF_GLOBAL, 0);
- quick_symbol (abfd, U ("_head_"), dll_symname, "", UNDSEC, BSF_GLOBAL, 0);
- quick_symbol (abfd, U ("_imp_"), exp->internal_name, "", id5, BSF_GLOBAL, 0);
+ quick_symbol (abfd, U ("_head_"), dll_symname, "", UNDSEC,
+ BSF_GLOBAL, 0);
+ quick_symbol (abfd, U ("_imp_"), exp->internal_name, "", id5,
+ BSF_GLOBAL, 0);
/* Fastcall applies only to functions,
so no need for auto-import symbol. */
}
else
{
if (! exp->flag_data)
- quick_symbol (abfd, U (""), exp->internal_name, "", tx, BSF_GLOBAL, 0);
- quick_symbol (abfd, U ("_head_"), dll_symname, "", UNDSEC, BSF_GLOBAL, 0);
- quick_symbol (abfd, U ("_imp__"), exp->internal_name, "", id5, BSF_GLOBAL, 0);
+ quick_symbol (abfd, U (""), exp->internal_name, "", tx,
+ BSF_GLOBAL, 0);
+ quick_symbol (abfd, U ("_head_"), dll_symname, "", UNDSEC,
+ BSF_GLOBAL, 0);
+ quick_symbol (abfd, U ("_imp__"), exp->internal_name, "", id5,
+ BSF_GLOBAL, 0);
/* Symbol to reference ord/name of imported
- data symbol, used to implement auto-import. */
+ data symbol, used to implement auto-import. */
if (exp->flag_data)
- quick_symbol (abfd, U("_nm__"), exp->internal_name, "", id6, BSF_GLOBAL,0);
+ quick_symbol (abfd, U("_nm__"), exp->internal_name, "", id6,
+ BSF_GLOBAL,0);
}
if (pe_dll_compat_implib)
- quick_symbol (abfd, U ("__imp_"), exp->internal_name, "",
- id5, BSF_GLOBAL, 0);
+ quick_symbol (abfd, U ("__imp_"), exp->internal_name, "", id5,
+ BSF_GLOBAL, 0);
if (! exp->flag_data)
{
bfd_set_section_size (abfd, tx, jmp_byte_count);
- td = (unsigned char *) xmalloc (jmp_byte_count);
+ td = xmalloc (jmp_byte_count);
tx->contents = td;
memcpy (td, jmp_bytes, jmp_byte_count);
}
bfd_set_section_size (abfd, id7, 4);
- d7 = (unsigned char *) xmalloc (4);
+ d7 = xmalloc (4);
id7->contents = d7;
memset (d7, 0, 4);
quick_reloc (abfd, 0, BFD_RELOC_RVA, 6);
save_relocs (id7);
bfd_set_section_size (abfd, id5, 4);
- d5 = (unsigned char *) xmalloc (4);
+ d5 = xmalloc (4);
id5->contents = d5;
memset (d5, 0, 4);
}
bfd_set_section_size (abfd, id4, 4);
- d4 = (unsigned char *) xmalloc (4);
+ d4 = xmalloc (4);
id4->contents = d4;
memset (d4, 0, 4);
if (len & 1)
len++;
bfd_set_section_size (abfd, id6, len);
- d6 = (unsigned char *) xmalloc (len);
+ d6 = xmalloc (len);
id6->contents = d6;
memset (d6, 0, len);
d6[0] = exp->hint & 0xff;
}
static bfd *
-make_singleton_name_thunk (import, parent)
- const char *import;
- bfd *parent;
+make_singleton_name_thunk (const char *import, bfd *parent)
{
/* Name thunks go to idata$4. */
asection *id4;
char *oname;
bfd *abfd;
- oname = (char *) xmalloc (20);
+ oname = xmalloc (20);
sprintf (oname, "nmth%06d.o", tmp_seq);
tmp_seq++;
bfd_set_arch_mach (abfd, pe_details->bfd_arch, 0);
symptr = 0;
- symtab = (asymbol **) xmalloc (3 * sizeof (asymbol *));
+ symtab = xmalloc (3 * sizeof (asymbol *));
id4 = quick_section (abfd, ".idata$4", SEC_HAS_CONTENTS, 2);
quick_symbol (abfd, U ("_nm_thnk_"), import, "", id4, BSF_GLOBAL, 0);
quick_symbol (abfd, U ("_nm_"), import, "", UNDSEC, BSF_GLOBAL, 0);
bfd_set_section_size (abfd, id4, 8);
- d4 = (unsigned char *) xmalloc (4);
+ d4 = xmalloc (4);
id4->contents = d4;
memset (d4, 0, 8);
quick_reloc (abfd, 0, BFD_RELOC_RVA, 2);
}
static char *
-make_import_fixup_mark (rel)
- arelent *rel;
+make_import_fixup_mark (arelent *rel)
{
/* We convert reloc to symbol, for later reference. */
static int counter;
if (!fixup_name)
{
- fixup_name = (char *) xmalloc (384);
+ fixup_name = xmalloc (384);
buffer_len = 384;
}
/* New buffer size is length of symbol, plus 25, but
then rounded up to the nearest multiple of 128. */
buffer_len = ((strlen (sym->name) + 25) + 127) & ~127;
- fixup_name = (char *) xmalloc (buffer_len);
+ fixup_name = xmalloc (buffer_len);
}
sprintf (fixup_name, "__fu%d_%s", counter++, sym->name);
.rva __fuNN_SYM (pointer to reference (address) in text) */
static bfd *
-make_import_fixup_entry (name, fixup_name, dll_symname, parent)
- const char *name;
- const char *fixup_name;
- const char *dll_symname;
- bfd *parent;
+make_import_fixup_entry (const char *name,
+ const char *fixup_name,
+ const char *dll_symname,
+ bfd *parent)
{
asection *id3;
unsigned char *d3;
char *oname;
bfd *abfd;
- oname = (char *) xmalloc (20);
+ oname = xmalloc (20);
sprintf (oname, "fu%06d.o", tmp_seq);
tmp_seq++;
bfd_set_arch_mach (abfd, pe_details->bfd_arch, 0);
symptr = 0;
- symtab = (asymbol **) xmalloc (6 * sizeof (asymbol *));
+ symtab = xmalloc (6 * sizeof (asymbol *));
id3 = quick_section (abfd, ".idata$3", SEC_HAS_CONTENTS, 2);
#if 0
quick_symbol (abfd, "", fixup_name, "", UNDSEC, BSF_GLOBAL, 0);
bfd_set_section_size (abfd, id3, 20);
- d3 = (unsigned char *) xmalloc (20);
+ d3 = xmalloc (20);
id3->contents = d3;
memset (d3, 0, 20);
.rva __fuNN_SYM (pointer to reference (address) in text) */
static bfd *
-make_runtime_pseudo_reloc (name, fixup_name, addend, parent)
- const char *name ATTRIBUTE_UNUSED;
- const char *fixup_name;
- int addend;
- bfd *parent;
+make_runtime_pseudo_reloc (const char *name ATTRIBUTE_UNUSED,
+ const char *fixup_name,
+ int addend,
+ bfd *parent)
{
asection *rt_rel;
unsigned char *rt_rel_d;
char *oname;
bfd *abfd;
- oname = (char *) xmalloc (20);
+ oname = xmalloc (20);
sprintf (oname, "rtr%06d.o", tmp_seq);
tmp_seq++;
bfd_set_arch_mach (abfd, pe_details->bfd_arch, 0);
symptr = 0;
- symtab = (asymbol **) xmalloc (2 * sizeof (asymbol *));
- rt_rel = quick_section (abfd, ".rdata_runtime_pseudo_reloc", SEC_HAS_CONTENTS, 2);
+ symtab = xmalloc (2 * sizeof (asymbol *));
+ rt_rel = quick_section (abfd, ".rdata_runtime_pseudo_reloc",
+ SEC_HAS_CONTENTS, 2);
quick_symbol (abfd, "", fixup_name, "", UNDSEC, BSF_GLOBAL, 0);
bfd_set_section_size (abfd, rt_rel, 8);
- rt_rel_d = (unsigned char *) xmalloc (8);
+ rt_rel_d = xmalloc (8);
rt_rel->contents = rt_rel_d;
memset (rt_rel_d, 0, 8);
bfd_put_32 (abfd, addend, rt_rel_d);
.rva __pei386_runtime_relocator */
static bfd *
-pe_create_runtime_relocator_reference (parent)
- bfd *parent;
+pe_create_runtime_relocator_reference (bfd *parent)
{
asection *extern_rt_rel;
unsigned char *extern_rt_rel_d;
char *oname;
bfd *abfd;
- oname = (char *) xmalloc (20);
+ oname = xmalloc (20);
sprintf (oname, "ertr%06d.o", tmp_seq);
tmp_seq++;
bfd_set_arch_mach (abfd, pe_details->bfd_arch, 0);
symptr = 0;
- symtab = (asymbol **) xmalloc (2 * sizeof (asymbol *));
+ symtab = xmalloc (2 * sizeof (asymbol *));
extern_rt_rel = quick_section (abfd, ".rdata", SEC_HAS_CONTENTS, 2);
- quick_symbol (abfd, "", "__pei386_runtime_relocator", "", UNDSEC, BSF_NO_FLAGS, 0);
+ quick_symbol (abfd, "", "__pei386_runtime_relocator", "", UNDSEC,
+ BSF_NO_FLAGS, 0);
bfd_set_section_size (abfd, extern_rt_rel, 4);
- extern_rt_rel_d = (unsigned char *) xmalloc (4);
+ extern_rt_rel_d = xmalloc (4);
extern_rt_rel->contents = extern_rt_rel_d;
quick_reloc (abfd, 0, BFD_RELOC_RVA, 1);
}
void
-pe_create_import_fixup (rel, s, addend)
- arelent *rel;
- asection *s;
- int addend;
+pe_create_import_fixup (arelent *rel, asection *s, int addend)
{
char buf[300];
struct symbol_cache_entry *sym = *rel->sym_ptr_ptr;
void
-pe_dll_generate_implib (def, impfilename)
- def_file *def;
- const char *impfilename;
+pe_dll_generate_implib (def_file *def, const char *impfilename)
{
int i;
bfd *ar_head;
}
static void
-add_bfd_to_link (abfd, name, link_info)
- bfd *abfd;
- const char *name;
- struct bfd_link_info *link_info;
+add_bfd_to_link (bfd *abfd, const char *name, struct bfd_link_info *link_info)
{
lang_input_statement_type *fake_file;
}
void
-pe_process_import_defs (output_bfd, link_info)
- bfd *output_bfd;
- struct bfd_link_info *link_info;
+pe_process_import_defs (bfd *output_bfd, struct bfd_link_info *link_info)
{
def_file_module *module;
struct bfd_link_hash_entry *blhe;
int lead_at = (*pe_def_file->imports[i].internal_name == '@');
/* See if we need this import. */
- char *name = (char *) xmalloc (strlen (pe_def_file->imports[i].internal_name) + 2 + 6);
+ size_t len = strlen (pe_def_file->imports[i].internal_name);
+ char *name = xmalloc (len + 2 + 6);
if (lead_at)
- sprintf (name, "%s%s", "", pe_def_file->imports[i].internal_name);
+ sprintf (name, "%s%s", "",
+ pe_def_file->imports[i].internal_name);
else
- sprintf (name, "%s%s",U (""), pe_def_file->imports[i].internal_name);
+ sprintf (name, "%s%s",U (""),
+ pe_def_file->imports[i].internal_name);
blhe = bfd_link_hash_lookup (link_info->hash, name,
FALSE, FALSE, FALSE);
handled, FALSE if not. */
static unsigned int
-pe_get16 (abfd, where)
- bfd *abfd;
- int where;
+pe_get16 (bfd *abfd, int where)
{
unsigned char b[2];
}
static unsigned int
-pe_get32 (abfd, where)
- bfd *abfd;
- int where;
+pe_get32 (bfd *abfd, int where)
{
unsigned char b[4];
#if 0 /* This is not currently used. */
static unsigned int
-pe_as16 (ptr)
- void *ptr;
+pe_as16 (void *ptr)
{
unsigned char *b = ptr;
#endif
static unsigned int
-pe_as32 (ptr)
- void *ptr;
+pe_as32 (void *ptr)
{
unsigned char *b = ptr;
}
bfd_boolean
-pe_implied_import_dll (filename)
- const char *filename;
+pe_implied_import_dll (const char *filename)
{
bfd *dll;
unsigned long pe_header_offset, opthdr_ofs, num_entries, i;
pe_get16 (dll, pe_header_offset + 4 + 16));
expptr = 0;
- /* Get the rva and size of the export section. */
+ /* Get the rva and size of the export section. */
for (i = 0; i < nsections; i++)
{
char sname[8];
}
/* Scan sections and store the base and size of the
- data and bss segments in data/base_start/end. */
+ data and bss segments in data/base_start/end. */
for (i = 0; i < nsections; i++)
{
unsigned long secptr1 = secptr + 40 * i;
if (pe_dll_extra_pe_debug)
printf ("%s %s: 0x%08lx-0x%08lx (0x%08lx)\n",
__FUNCTION__, sec_name, vaddr, vaddr + vsize, flags);
- }
+ }
else if (strcmp (sec_name,".bss") == 0)
{
bss_start = vaddr;
}
}
- expdata = (unsigned char *) xmalloc (export_size);
+ expdata = xmalloc (export_size);
bfd_seek (dll, (file_ptr) expptr, SEEK_SET);
bfd_bread (expdata, (bfd_size_type) export_size, dll);
erva = expdata - export_rva;
/* Pointer to the names vector. */
unsigned long name_rva = pe_as32 (erva + name_rvas + i * 4);
def_file_import *imp;
- /* Pointer to the function address vector. */
+ /* Pointer to the function address vector. */
unsigned long func_rva = pe_as32 (erva + exp_funcbase + i * 4);
int is_data = 0;
dll_name, i, 0);
/* Mark symbol type. */
imp->data = is_data;
-
+
if (pe_dll_extra_pe_debug)
printf ("%s dll-name: %s sym: %s addr: 0x%lx %s\n",
__FUNCTION__, dll_name, erva + name_rva,
can put the right values in place. */
void
-pe_dll_build_sections (abfd, info)
- bfd *abfd;
- struct bfd_link_info *info;
+pe_dll_build_sections (bfd *abfd, struct bfd_link_info *info)
{
pe_dll_id_target (bfd_get_target (abfd));
process_def_file (abfd, info);
- if (pe_def_file->num_exports == 0 && !(info->shared))
+ if (pe_def_file->num_exports == 0 && !info->shared)
return;
generate_edata (abfd, info);
}
void
-pe_exe_build_sections (abfd, info)
- bfd *abfd;
- struct bfd_link_info *info ATTRIBUTE_UNUSED;
+pe_exe_build_sections (bfd *abfd, struct bfd_link_info *info ATTRIBUTE_UNUSED)
{
pe_dll_id_target (bfd_get_target (abfd));
build_filler_bfd (0);
}
void
-pe_dll_fill_sections (abfd, info)
- bfd *abfd;
- struct bfd_link_info *info;
+pe_dll_fill_sections (bfd *abfd, struct bfd_link_info *info)
{
pe_dll_id_target (bfd_get_target (abfd));
image_base = pe_data (abfd)->pe_opthdr.ImageBase;
/* Resize the sections. */
lang_size_sections (stat_ptr->head, abs_output_section,
- &stat_ptr->head, 0, (bfd_vma) 0, NULL, TRUE);
+ &stat_ptr->head, 0, 0, NULL, TRUE);
/* Redo special stuff. */
ldemul_after_allocation ();
/* Do the assignments again. */
- lang_do_assignments (stat_ptr->head,
- abs_output_section,
- (fill_type *) 0, (bfd_vma) 0);
+ lang_do_assignments (stat_ptr->head, abs_output_section, NULL, 0);
}
fill_edata (abfd, info);
}
void
-pe_exe_fill_sections (abfd, info)
- bfd *abfd;
- struct bfd_link_info *info;
+pe_exe_fill_sections (bfd *abfd, struct bfd_link_info *info)
{
pe_dll_id_target (bfd_get_target (abfd));
image_base = pe_data (abfd)->pe_opthdr.ImageBase;
/* Resize the sections. */
lang_size_sections (stat_ptr->head, abs_output_section,
- &stat_ptr->head, 0, (bfd_vma) 0, NULL, TRUE);
+ &stat_ptr->head, 0, 0, NULL, TRUE);
/* Redo special stuff. */
ldemul_after_allocation ();
/* Do the assignments again. */
- lang_do_assignments (stat_ptr->head,
- abs_output_section,
- (fill_type *) 0, (bfd_vma) 0);
+ lang_do_assignments (stat_ptr->head, abs_output_section, NULL, 0);
}
reloc_s->contents = reloc_d;
}
/* pe-dll.h: Header file for routines used to build Windows DLLs.
- Copyright 1999, 2000, 2002 Free Software Foundation, Inc.
+ Copyright 1999, 2000, 2002, 2003 Free Software Foundation, Inc.
This file is part of GLD, the Gnu Linker.
extern int pe_dll_extra_pe_debug;
extern void pe_dll_id_target
- PARAMS ((const char *));
+ (const char *);
extern void pe_dll_add_excludes
- PARAMS ((const char *, const int));
+ (const char *, const int);
extern void pe_dll_generate_def_file
- PARAMS ((const char *));
+ (const char *);
extern void pe_dll_generate_implib
- PARAMS ((def_file *, const char *));
+ (def_file *, const char *);
extern void pe_process_import_defs
- PARAMS ((bfd *, struct bfd_link_info *));
+ (bfd *, struct bfd_link_info *);
extern bfd_boolean pe_implied_import_dll
- PARAMS ((const char *));
+ (const char *);
extern void pe_dll_build_sections
- PARAMS ((bfd *, struct bfd_link_info *));
+ (bfd *, struct bfd_link_info *);
extern void pe_exe_build_sections
- PARAMS ((bfd *, struct bfd_link_info *));
+ (bfd *, struct bfd_link_info *);
extern void pe_dll_fill_sections
- PARAMS ((bfd *, struct bfd_link_info *));
+ (bfd *, struct bfd_link_info *);
extern void pe_exe_fill_sections
- PARAMS ((bfd *, struct bfd_link_info *));
+ (bfd *, struct bfd_link_info *);
extern void pe_walk_relocs_of_symbol
- PARAMS ((struct bfd_link_info * info, const char *name,
- int (*cb) (arelent *, asection *)));
+ (struct bfd_link_info *, const char *, int (*) (arelent *, asection *));
extern void pe_create_import_fixup
- PARAMS ((arelent * rel, asection *, int));
+ (arelent * rel, asection *, int);
#endif /* PE_DLL_H */
/* sysdep.h -- handle host dependencies for the GNU linker
- Copyright 1995, 1996, 1997, 1999, 2002 Free Software Foundation, Inc.
+ Copyright 1995, 1996, 1997, 1999, 2002, 2003
+ Free Software Foundation, Inc.
This file is part of GLD, the Gnu Linker.
#ifndef LD_SYSDEP_H
#define LD_SYSDEP_H
-#include "ansidecl.h"
-
#include "config.h"
#include <stdio.h>