aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ld/ChangeLog164
-rw-r--r--ld/Makefile.am2
-rw-r--r--ld/Makefile.in2
-rw-r--r--ld/deffile.h27
-rw-r--r--ld/deffilep.y212
-rw-r--r--ld/emulparams/elf32mcore.sh2
-rw-r--r--ld/emultempl/m68kcoff.em2
-rw-r--r--ld/emultempl/m68kelf.em6
-rw-r--r--ld/emultempl/ticoff.em2
-rw-r--r--ld/ld.h15
-rw-r--r--ld/ldcref.c112
-rw-r--r--ld/ldctor.c45
-rw-r--r--ld/ldctor.h8
-rw-r--r--ld/ldemul.h117
-rw-r--r--ld/ldexp.c270
-rw-r--r--ld/ldexp.h40
-rw-r--r--ld/ldfile.c95
-rw-r--r--ld/ldfile.h21
-rw-r--r--ld/ldlang.c1127
-rw-r--r--ld/ldlang.h156
-rw-r--r--ld/ldlex.h34
-rw-r--r--ld/ldlex.l135
-rw-r--r--ld/ldmain.c288
-rw-r--r--ld/ldmain.h6
-rw-r--r--ld/ldmisc.c85
-rw-r--r--ld/ldmisc.h28
-rw-r--r--ld/ldver.h4
-rw-r--r--ld/ldwrite.c42
-rw-r--r--ld/ldwrite.h7
-rw-r--r--ld/lexsup.c72
-rw-r--r--ld/mri.c114
-rw-r--r--ld/mri.h28
-rw-r--r--ld/pe-dll.c424
-rw-r--r--ld/pe-dll.h27
-rw-r--r--ld/sysdep.h5
35 files changed, 1501 insertions, 2223 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 1d6ed67..b8b160e 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,41 @@
+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
@@ -8,74 +46,74 @@
* 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>
@@ -3111,7 +3149,7 @@
* 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.
diff --git a/ld/Makefile.am b/ld/Makefile.am
index a3ce88c..3f0a721 100644
--- a/ld/Makefile.am
+++ b/ld/Makefile.am
@@ -1727,7 +1727,7 @@ ldgram.o: ldgram.c ../bfd/bfd.h $(INCDIR)/ansidecl.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 \
diff --git a/ld/Makefile.in b/ld/Makefile.in
index 17a833b..71e03a8 100644
--- a/ld/Makefile.in
+++ b/ld/Makefile.in
@@ -2427,7 +2427,7 @@ ldgram.o: ldgram.c ../bfd/bfd.h $(INCDIR)/ansidecl.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 \
diff --git a/ld/deffile.h b/ld/deffile.h
index 99681887..f1e3301 100644
--- a/ld/deffile.h
+++ b/ld/deffile.h
@@ -22,8 +22,6 @@
#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. */
@@ -87,24 +85,19 @@ typedef struct 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 */
diff --git a/ld/deffilep.y b/ld/deffilep.y
index fba1c2e..875f482 100644
--- a/ld/deffilep.y
+++ b/ld/deffilep.y
@@ -78,24 +78,21 @@
#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;
@@ -218,7 +215,7 @@ attr:
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;
}
@@ -242,7 +239,7 @@ opt_base: BASE '=' NUMBER { $$ = $3;}
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;
}
@@ -271,12 +268,12 @@ struct directive
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;
@@ -284,9 +281,7 @@ def_file_empty ()
}
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;
@@ -329,8 +324,7 @@ def_file_parse (filename, add_to)
}
void
-def_file_free (def)
- def_file *def;
+def_file_free (def_file *def)
{
int i;
@@ -391,9 +385,7 @@ def_file_free (def)
#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;
@@ -402,7 +394,7 @@ def_file_print (file, def)
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);
@@ -478,11 +470,10 @@ def_file_print (file, def)
#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);
@@ -491,11 +482,10 @@ def_file_add_export (def, external_name, internal_name, ordinal)
{
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));
@@ -511,9 +501,7 @@ def_file_add_export (def, external_name, internal_name, ordinal)
}
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;
@@ -521,19 +509,17 @@ def_get_module (def, name)
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;
@@ -542,26 +528,24 @@ def_stash_module (def, name)
}
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));
@@ -594,10 +578,7 @@ diropts[] =
};
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;
@@ -608,7 +589,8 @@ def_file_add_directive (my_def, 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)
@@ -620,7 +602,9 @@ def_file_add_directive (my_def, param, len)
- 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++)
;
@@ -663,9 +647,7 @@ def_file_add_directive (my_def, param, len)
/* 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);
@@ -675,9 +657,7 @@ def_name (name, base)
}
static void
-def_library (name, base)
- const char *name;
- int base;
+def_library (const char *name, int base)
{
if (def->name)
free (def->name);
@@ -687,58 +667,52 @@ def_library (name, base)
}
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));
@@ -756,9 +730,7 @@ def_section (name, attr)
}
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;
@@ -788,11 +760,10 @@ def_section_alt (name, attr)
}
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;
@@ -814,17 +785,16 @@ def_exports (external_name, internal_name, ordinal, flags)
}
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;
@@ -834,19 +804,16 @@ def_import (internal_name, module, dllext, name, ordinal)
}
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;
@@ -855,11 +822,10 @@ def_directive (str)
}
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;
}
@@ -875,16 +841,15 @@ static int buflen = 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. */
@@ -926,7 +891,7 @@ tokens[] =
};
static int
-def_getc ()
+def_getc (void)
{
int rv;
@@ -947,8 +912,7 @@ def_getc ()
}
static int
-def_ungetc (c)
- int c;
+def_ungetc (int c)
{
if (lex_parse_string)
{
@@ -960,7 +924,7 @@ def_ungetc (c)
}
static int
-def_lex ()
+def_lex (void)
{
int c, i, q;
diff --git a/ld/emulparams/elf32mcore.sh b/ld/emulparams/elf32mcore.sh
index 36befc8..930a9c3 100644
--- a/ld/emulparams/elf32mcore.sh
+++ b/ld/emulparams/elf32mcore.sh
@@ -47,7 +47,7 @@ PARSE_AND_LIST_OPTIONS='
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 */
diff --git a/ld/emultempl/m68kcoff.em b/ld/emultempl/m68kcoff.em
index 3b92d17..eefa327 100644
--- a/ld/emultempl/m68kcoff.em
+++ b/ld/emultempl/m68kcoff.em
@@ -99,7 +99,7 @@ gld${EMULATION_NAME}_after_open (void)
/* 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);
}
}
diff --git a/ld/emultempl/m68kelf.em b/ld/emultempl/m68kelf.em
index 64d4aa8..31db20b 100644
--- a/ld/emultempl/m68kelf.em
+++ b/ld/emultempl/m68kelf.em
@@ -93,7 +93,7 @@ m68k_elf_after_open (void)
/* 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 */
@@ -104,10 +104,10 @@ m68k_elf_after_open (void)
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));
diff --git a/ld/emultempl/ticoff.em b/ld/emultempl/ticoff.em
index 448fea8..ce9f739 100644
--- a/ld/emultempl/ticoff.em
+++ b/ld/emultempl/ticoff.em
@@ -77,8 +77,6 @@ gld${EMULATION_NAME}_handle_option (int optc)
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;
diff --git a/ld/ld.h b/ld/ld.h
index 75c054e..dde4cfe 100644
--- a/ld/ld.h
+++ b/ld/ld.h
@@ -232,18 +232,15 @@ extern bfd_boolean force_make_executable;
/* 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
diff --git a/ld/ldcref.c b/ld/ldcref.c
index fec77b0..3094735 100644
--- a/ld/ldcref.c
+++ b/ld/ldcref.c
@@ -1,5 +1,6 @@
/* 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.
@@ -65,18 +66,14 @@ struct cref_hash_table {
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. */
@@ -89,7 +86,7 @@ static void check_reloc_refs PARAMS ((bfd *, asection *, PTR));
#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. */
@@ -107,10 +104,9 @@ static size_t cref_symcount;
/* 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;
@@ -120,7 +116,7 @@ cref_hash_newfunc (entry, table, string)
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 *)
@@ -132,22 +128,21 @@ cref_hash_newfunc (entry, table, string)
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;
@@ -169,7 +164,7 @@ add_cref (name, abfd, section, value)
if (r == NULL)
{
- r = (struct cref_ref *) xmalloc (sizeof *r);
+ r = xmalloc (sizeof *r);
r->next = h->refs;
h->refs = r;
r->abfd = abfd;
@@ -191,11 +186,9 @@ add_cref (name, abfd, section, value)
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);
@@ -210,12 +203,10 @@ cref_fill_array (h, data)
/* 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);
}
@@ -225,8 +216,7 @@ cref_sort_array (a1, a2)
#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;
@@ -249,8 +239,7 @@ output_cref (fp)
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);
@@ -266,9 +255,7 @@ output_cref (fp)
/* 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;
@@ -336,12 +323,12 @@ output_one_cref (fp, h)
/* 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);
}
@@ -349,8 +336,7 @@ check_nocrossrefs ()
/* 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;
@@ -382,9 +368,7 @@ check_section_sym_xref (statement)
/* 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;
@@ -436,11 +420,10 @@ struct check_refs_info {
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;
@@ -452,7 +435,7 @@ check_refs (name, sec, abfd, ncrs)
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
@@ -463,7 +446,7 @@ check_refs (name, sec, abfd, ncrs)
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);
@@ -478,7 +461,7 @@ check_refs (name, sec, abfd, ncrs)
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);
@@ -491,12 +474,9 @@ check_refs (name, sec, abfd, ncrs)
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;
@@ -538,7 +518,7 @@ check_reloc_refs (abfd, sec, iarg)
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);
@@ -557,9 +537,9 @@ check_reloc_refs (abfd, sec, iarg)
&& 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);
diff --git a/ld/ldctor.c b/ld/ldctor.c
index 2081900..34d5e52 100644
--- a/ld/ldctor.c
+++ b/ld/ldctor.c
@@ -33,9 +33,6 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#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;
@@ -56,24 +53,23 @@ struct set_info *sets;
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;
@@ -109,7 +105,7 @@ ldctor_add_set_entry (h, reloc, name, section, value)
}
}
- e = (struct set_element *) xmalloc (sizeof (struct set_element));
+ e = xmalloc (sizeof (struct set_element));
e->next = NULL;
e->name = name;
e->section = section;
@@ -126,8 +122,7 @@ ldctor_add_set_entry (h, reloc, name, section, value)
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
@@ -155,12 +150,10 @@ ctor_prio (name)
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;
@@ -202,7 +195,7 @@ ctor_cmp (p1, p2)
themselves into constructor_list. */
void
-ldctor_build_sets ()
+ldctor_build_sets (void)
{
static bfd_boolean called;
lang_statement_list_type *old;
@@ -230,7 +223,7 @@ ldctor_build_sets ()
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)
@@ -257,7 +250,7 @@ ldctor_build_sets ()
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;
@@ -281,7 +274,7 @@ ldctor_build_sets ()
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)
{
@@ -331,9 +324,9 @@ ldctor_build_sets ()
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)
{
diff --git a/ld/ldctor.h b/ld/ldctor.h
index e5e0926..436df6c 100644
--- a/ld/ldctor.h
+++ b/ld/ldctor.h
@@ -1,5 +1,5 @@
/* 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.
@@ -52,9 +52,9 @@ struct set_element {
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
diff --git a/ld/ldemul.h b/ld/ldemul.h
index b88fedf..8feef67 100644
--- a/ld/ldemul.h
+++ b/ld/ldemul.h
@@ -1,5 +1,5 @@
/* 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.
@@ -18,104 +18,103 @@
#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;
@@ -124,65 +123,65 @@ typedef struct ld_emulation_xfer_struct {
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;
diff --git a/ld/ldexp.c b/ld/ldexp.c
index cafd561..ce57790 100644
--- a/ld/ldexp.c
+++ b/ld/ldexp.c
@@ -41,43 +41,8 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#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;
@@ -85,9 +50,7 @@ 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
{
@@ -159,8 +122,7 @@ exp_print_token (code, infix_p)
}
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;
@@ -168,8 +130,7 @@ make_abs (ptr)
}
static etree_value_type
-new_abs (value)
- bfd_vma value;
+new_abs (bfd_vma value)
{
etree_value_type new;
new.valid_p = TRUE;
@@ -179,10 +140,9 @@ new_abs (value)
}
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);
@@ -191,10 +151,9 @@ check (os, name, op)
}
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;
@@ -203,11 +162,9 @@ exp_intop (value)
}
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;
@@ -218,11 +175,9 @@ exp_bigintop (value, 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;
@@ -231,10 +186,9 @@ exp_relop (section, value)
}
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;
@@ -245,9 +199,8 @@ new_rel (value, str, section)
}
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;
@@ -261,12 +214,11 @@ new_rel_from_section (value, section)
}
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;
@@ -348,12 +300,11 @@ fold_unary (tree, current_section, allocation_done, dot, dotp)
}
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;
@@ -483,12 +434,11 @@ fold_binary (tree, current_section, allocation_done, dot, dotp)
}
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;
@@ -505,7 +455,7 @@ fold_trinary (tree, current_section, allocation_done, dot, dotp)
}
etree_value_type
-invalid ()
+invalid (void)
{
etree_value_type new;
new.valid_p = FALSE;
@@ -513,11 +463,10 @@ invalid ()
}
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;
@@ -526,8 +475,7 @@ fold_name (tree, current_section, allocation_done, dot)
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
@@ -545,7 +493,7 @@ fold_name (tree, current_section, allocation_done, dot)
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));
@@ -661,12 +609,11 @@ fold_name (tree, current_section, allocation_done, dot)
}
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;
@@ -774,7 +721,7 @@ exp_fold_tree (tree, current_section, allocation_done, dot, dotp)
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"),
@@ -814,20 +761,15 @@ exp_fold_tree (tree, current_section, allocation_done, dot, dotp)
}
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;
@@ -843,17 +785,13 @@ exp_binop (code, lhs, rhs)
{
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;
@@ -862,21 +800,17 @@ exp_trinop (code, cond, lhs, rhs)
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;
@@ -889,15 +823,13 @@ exp_unop (code, child)
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;
@@ -905,23 +837,18 @@ exp_nameop (code, name)
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;
@@ -935,21 +862,19 @@ exp_assop (code, dst, src)
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;
@@ -960,13 +885,11 @@ exp_provide (dst, 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;
@@ -975,8 +898,7 @@ exp_assert (exp, message)
}
void
-exp_print_tree (tree)
- etree_type *tree;
+exp_print_tree (etree_type *tree)
{
if (config.map_file == NULL)
config.map_file = stderr;
@@ -999,7 +921,7 @@ exp_print_tree (tree)
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
@@ -1067,11 +989,10 @@ exp_print_tree (tree)
}
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;
@@ -1087,21 +1008,19 @@ exp_get_vma (tree, def, name, allocation_done)
}
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;
@@ -1119,7 +1038,7 @@ exp_get_fill (tree, def, name, allocation_done)
{
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;
@@ -1144,7 +1063,7 @@ exp_get_fill (tree, def, name, allocation_done)
}
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;
@@ -1156,11 +1075,10 @@ exp_get_fill (tree, def, name, allocation_done)
}
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);
@@ -1173,9 +1091,7 @@ exp_get_abs_int (tree, def, name, 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;
diff --git a/ld/ldexp.h b/ld/ldexp.h
index df814df..c3cd5ed 100644
--- a/ld/ldexp.h
+++ b/ld/ldexp.h
@@ -1,5 +1,5 @@
/* 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.
@@ -104,41 +104,41 @@ extern struct exp_data_seg {
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
diff --git a/ld/ldfile.c b/ld/ldfile.c
index 79d3b48..cdec8ee 100644
--- a/ld/ldfile.c
+++ b/ld/ldfile.c
@@ -69,18 +69,11 @@ static search_dirs_type **search_tail_ptr = &search_head;
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;
@@ -110,16 +103,14 @@ is_sysrooted_pathname (name, notsame)
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;
@@ -142,9 +133,8 @@ ldfile_add_library_path (name, cmdline)
/* 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);
@@ -298,11 +288,10 @@ ldfile_try_open_bfd (attempt, entry)
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;
@@ -332,9 +321,7 @@ ldfile_open_file_search (arch, entry, lib, suffix)
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;
@@ -347,13 +334,13 @@ ldfile_open_file_search (arch, entry, lib, suffix)
}
}
- 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,
@@ -377,8 +364,7 @@ ldfile_open_file_search (arch, entry, lib, suffix)
/* 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;
@@ -399,9 +385,7 @@ ldfile_open_file (entry)
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)
@@ -433,9 +417,7 @@ ldfile_open_file (entry)
/* 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];
@@ -474,9 +456,7 @@ try_open (name, exten)
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;
@@ -484,12 +464,10 @@ ldfile_find_command_file (name, extend)
/* 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);
@@ -503,13 +481,12 @@ ldfile_find_command_file (name, extend)
}
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);
@@ -525,8 +502,7 @@ ldfile_open_command_file (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[] =
@@ -556,11 +532,9 @@ gnu960_map_archname (name)
}
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')
{
@@ -573,7 +547,7 @@ ldfile_add_arch (name)
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;
@@ -582,17 +556,15 @@ ldfile_add_arch (name)
#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);
@@ -607,8 +579,7 @@ ldfile_add_arch (in_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);
diff --git a/ld/ldfile.h b/ld/ldfile.h
index 0bfea7c..8b2e6e9 100644
--- a/ld/ldfile.h
+++ b/ld/ldfile.h
@@ -16,7 +16,8 @@
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
@@ -44,21 +45,21 @@ typedef struct search_dirs {
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
diff --git a/ld/ldlang.c b/ld/ldlang.c
index 267a32c..56d65eb 100644
--- a/ld/ldlang.c
+++ b/ld/ldlang.c
@@ -62,169 +62,23 @@ static lang_statement_list_type statement_list;
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;
@@ -244,16 +98,8 @@ static bfd_boolean ldlang_sysrooted_script = FALSE;
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)
@@ -263,16 +109,14 @@ etree_type *base; /* Relocation base - or null */
#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;
@@ -290,11 +134,10 @@ unique_section_p (secnam)
/* 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;
@@ -365,11 +208,10 @@ walk_wild_section (ptr, file, callback, data)
/* 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))
@@ -380,7 +222,7 @@ walk_wild_file (s, f, callback, data)
/* 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
@@ -390,9 +232,7 @@ walk_wild_file (s, f, callback, data)
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);
@@ -401,10 +241,7 @@ walk_wild_file (s, f, callback, data)
}
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;
@@ -439,11 +276,10 @@ walk_wild (s, callback, data)
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);
@@ -486,8 +322,7 @@ lang_for_each_statement_worker (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);
}
@@ -495,26 +330,24 @@ lang_for_each_statement (func)
/*----------------------------------------------------------------------*/
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;
}
@@ -529,11 +362,10 @@ new_statement (type, size, list)
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;
@@ -541,8 +373,7 @@ new_afile (name, file_type, target, add_to_list)
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;
}
@@ -571,7 +402,7 @@ new_afile (name, file_type, target, add_to_list)
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;
@@ -603,10 +434,10 @@ new_afile (name, file_type, target, add_to_list)
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;
@@ -618,10 +449,9 @@ new_afile (name, file_type, target, add_to_list)
}
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);
@@ -630,7 +460,7 @@ lang_add_input_file (name, file_type, target)
/* Build enough state so that the parser can build its tree. */
void
-lang_init ()
+lang_init (void)
{
obstack_begin (&stat_obstack, 1000);
@@ -641,14 +471,12 @@ lang_init ()
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;
-
}
/*----------------------------------------------------------------------
@@ -665,23 +493,19 @@ static lang_memory_region_type *lang_memory_region_list;
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
@@ -693,36 +517,30 @@ lang_memory_region_lookup (name)
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;
@@ -732,9 +550,7 @@ lang_memory_default (section)
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)
@@ -746,55 +562,47 @@ lang_memory_default (section)
}
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;
@@ -806,8 +614,7 @@ lang_output_section_statement_lookup (name)
}
static void
-lang_map_flags (flag)
- flagword flag;
+lang_map_flags (flagword flag)
{
if (flag & SEC_ALLOC)
minfo ("a");
@@ -826,7 +633,7 @@ lang_map_flags (flag)
}
void
-lang_map ()
+lang_map (void)
{
lang_memory_region_type *m;
@@ -834,9 +641,7 @@ lang_map ()
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;
@@ -882,8 +687,7 @@ lang_map ()
/* 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;
@@ -893,13 +697,12 @@ init_os (s)
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);
@@ -909,7 +712,7 @@ init_os (s)
/* 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. */
@@ -924,8 +727,7 @@ init_os (s)
initialized. */
static void
-exp_init_os (exp)
- etree_type *exp;
+exp_init_os (etree_type *exp)
{
switch (exp->type.node_class)
{
@@ -1000,12 +802,9 @@ struct already_linked
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;
@@ -1105,8 +904,7 @@ section_already_linked (abfd, sec, data)
/* 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;
@@ -1117,21 +915,20 @@ section_already_linked (abfd, sec, data)
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,
@@ -1140,7 +937,7 @@ already_linked_table_init ()
}
static void
-already_linked_table_free ()
+already_linked_table_free (void)
{
bfd_hash_table_free (&already_linked_table);
}
@@ -1158,8 +955,7 @@ already_linked_table_free ()
That lets us handle DOS filenames more naturally. */
static bfd_boolean
-wildcardp (pattern)
- const char *pattern;
+wildcardp (const char *pattern)
{
const char *s;
@@ -1176,11 +972,10 @@ wildcardp (pattern)
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;
@@ -1329,11 +1124,10 @@ lang_add_section (ptr, section, output, file)
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;
@@ -1429,12 +1223,11 @@ wild_sort (wild, sec, file, section)
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;
@@ -1490,24 +1283,23 @@ output_section_callback (ptr, sec, section, file, output)
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);
@@ -1516,10 +1308,10 @@ lookup_name (name)
(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;
@@ -1528,9 +1320,8 @@ lookup_name (name)
/* 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;
@@ -1661,14 +1452,13 @@ load_symbols (entry, place)
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)
{
@@ -1686,11 +1476,9 @@ wild (s, target, output)
/* 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;
}
@@ -1698,9 +1486,7 @@ get_target (target, data)
/* 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;
@@ -1714,9 +1500,7 @@ stricpy (dest, src)
from haystack. */
static void
-strcut (haystack, needle)
- char *haystack;
- char *needle;
+strcut (char *haystack, char *needle)
{
haystack = strstr (haystack, needle);
@@ -1735,9 +1519,7 @@ strcut (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;
@@ -1750,7 +1532,7 @@ name_compare (first, second)
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");
@@ -1780,11 +1562,9 @@ static const bfd_target *winner;
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)
@@ -1818,7 +1598,7 @@ closest_target_match (target, data)
/* Return the BFD target format of the first input file. */
static char *
-get_first_input_target ()
+get_first_input_target (void)
{
char *target = NULL;
@@ -1844,12 +1624,12 @@ get_first_input_target ()
}
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
@@ -1869,8 +1649,7 @@ lang_get_output_target ()
/* Open the output file. */
static bfd *
-open_output (name)
- const char *name;
+open_output (const char *name)
{
bfd *output;
@@ -1884,7 +1663,7 @@ open_output (name)
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)
@@ -1910,8 +1689,8 @@ open_output (name)
/* 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. */
@@ -1926,7 +1705,7 @@ open_output (name)
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);
@@ -1948,7 +1727,7 @@ open_output (name)
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);
@@ -1956,13 +1735,12 @@ open_output (name)
}
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)
@@ -1990,11 +1768,9 @@ ldlang_open_output (statement)
/* 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)
{
@@ -2070,7 +1846,7 @@ open_input_bfds (s, force)
section. */
static void
-lang_reasonable_defaults ()
+lang_reasonable_defaults (void)
{
#if 0
lang_output_section_statement_lookup (".text");
@@ -2085,7 +1861,7 @@ lang_reasonable_defaults ()
&default_common_section->children);
new->section_name = "COMMON";
- new->filename = (char *) NULL;
+ new->filename = NULL;
lang_list_init (&new->children);
}
#endif
@@ -2102,12 +1878,10 @@ typedef struct bfd_sym_chain ldlang_undef_chain_list_type;
#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;
@@ -2121,13 +1895,12 @@ ldlang_add_undef (name)
/* 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)
{
@@ -2142,27 +1915,22 @@ insert_undefined (name)
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)
{
@@ -2233,7 +2001,7 @@ map_input_to_output_sections (s, target, output_section_statement)
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;
@@ -2264,8 +2032,8 @@ strip_excluded_output_sections ()
}
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;
@@ -2310,9 +2078,8 @@ print_output_section_statement (output_section_statement)
}
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;
@@ -2350,10 +2117,9 @@ print_assignment (assignment, output_section)
}
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);
}
@@ -2363,11 +2129,9 @@ print_input_statement (statm)
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)
@@ -2391,8 +2155,7 @@ print_one_symbol (hash_entry, ptr)
/* 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;
@@ -2441,7 +2204,7 @@ print_input_section (in)
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;
}
@@ -2449,8 +2212,7 @@ print_input_section (in)
}
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;
@@ -2461,8 +2223,7 @@ print_fill_statement (fill)
}
static void
-print_data_statement (data)
- lang_data_statement_type *data;
+print_data_statement (lang_data_statement_type *data)
{
int i;
bfd_vma addr;
@@ -2522,8 +2283,7 @@ print_data_statement (data)
-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);
@@ -2533,8 +2293,7 @@ print_address_statement (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;
@@ -2566,8 +2325,7 @@ print_reloc_statement (reloc)
}
static void
-print_padding_statement (s)
- lang_padding_statement_type *s;
+print_padding_statement (lang_padding_statement_type *s)
{
int len;
bfd_vma addr;
@@ -2602,9 +2360,8 @@ print_padding_statement (s)
}
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;
@@ -2651,9 +2408,8 @@ print_wild_statement (w, os)
/* 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);
@@ -2664,9 +2420,8 @@ print_group (s, 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)
{
@@ -2679,9 +2434,8 @@ print_statement_list (s, os)
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)
{
@@ -2751,7 +2505,7 @@ print_statement (s, os)
}
static void
-print_statements ()
+print_statements (void)
{
print_statement_list (statement_list.head, abs_output_section);
}
@@ -2762,9 +2516,7 @@ print_statements ()
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;
@@ -2785,12 +2537,11 @@ dprint_statement (s, n)
}
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;
@@ -2807,13 +2558,12 @@ insert_pad (ptr, fill, alignment_needed, output_section, dot)
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;
}
@@ -2825,11 +2575,10 @@ insert_pad (ptr, fill, alignment_needed, output_section, dot)
/* 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;
@@ -2890,7 +2639,7 @@ size_input_section (this_ptr, output_section_statement, fill, dot)
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);
@@ -2947,18 +2696,17 @@ _("%X%P: section %s [%V -> %V] overlaps section %s [%V -> %V]\n"),
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,
@@ -2981,21 +2729,20 @@ os_region_check (os, region, tree, base)
/* 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)
{
@@ -3038,11 +2785,11 @@ lang_size_sections_1 (s, output_section_statement, prev, fill, dot, relax,
}
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] == '*'
@@ -3071,7 +2818,7 @@ lang_size_sections_1 (s, output_section_statement, prev, fill, dot, relax,
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. */
@@ -3160,7 +2907,7 @@ lang_size_sections_1 (s, output_section_statement, prev, fill, dot, relax,
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)
@@ -3375,15 +3122,14 @@ lang_size_sections_1 (s, output_section_statement, prev, fill, dot, relax,
}
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;
@@ -3413,16 +3159,16 @@ lang_size_sections (s, output_section_statement, prev, fill, dot, relax,
}
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)
{
@@ -3581,7 +3327,7 @@ lang_do_assignments (s, output_section_statement, fill, dot)
such symbols, and set them to the correct value. */
static void
-lang_set_startof ()
+lang_set_startof (void)
{
asection *s;
@@ -3627,7 +3373,7 @@ lang_set_startof ()
}
static void
-lang_finish ()
+lang_finish (void)
{
struct bfd_link_hash_entry *h;
bfd_boolean warn;
@@ -3637,7 +3383,7 @@ lang_finish ()
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. */
@@ -3647,7 +3393,7 @@ lang_finish ()
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)
@@ -3681,7 +3427,7 @@ lang_finish ()
/* 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"),
@@ -3706,12 +3452,7 @@ lang_finish ()
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. */
}
@@ -3721,15 +3462,13 @@ ignore_bfd_errors (s)
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,
@@ -3790,7 +3529,7 @@ lang_check ()
to roughly sort the entries by size. */
static void
-lang_common ()
+lang_common (void)
{
if (command_line.inhibit_common_definition)
return;
@@ -3799,23 +3538,20 @@ lang_common ()
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;
@@ -3911,17 +3647,15 @@ lang_one_common (h, info)
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. */
@@ -3969,10 +3703,7 @@ lang_place_orphans ()
}
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;
@@ -4014,8 +3745,7 @@ lang_set_flags (ptr, flags, invert)
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;
@@ -4030,8 +3760,7 @@ lang_for_each_input_file (func)
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)
{
@@ -4044,27 +3773,21 @@ lang_for_each_file (func)
/* 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;
@@ -4074,14 +3797,12 @@ ldlang_add_file (entry)
/* 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
@@ -4094,13 +3815,11 @@ ldlang_add_file (entry)
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)
@@ -4113,8 +3832,7 @@ lang_add_output (name, 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;
@@ -4133,16 +3851,13 @@ topower (x)
}
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;
@@ -4157,7 +3872,7 @@ lang_enter_output_section_statement (output_section_statement_name,
#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;
}
@@ -4179,7 +3894,7 @@ lang_enter_output_section_statement (output_section_statement_name,
}
void
-lang_final ()
+lang_final (void)
{
lang_output_statement_type *new =
new_stat (lang_output_statement, stat_ptr);
@@ -4190,14 +3905,12 @@ lang_final ()
/* 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;
@@ -4211,12 +3924,11 @@ lang_reset_memory_regions ()
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;
@@ -4225,8 +3937,7 @@ gc_section_callback (ptr, sec, section, file, data)
/* 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);
}
@@ -4234,10 +3945,9 @@ lang_gc_wild (s)
/* 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)
{
@@ -4260,7 +3970,7 @@ lang_gc_sections_1 (s)
}
static void
-lang_gc_sections ()
+lang_gc_sections (void)
{
struct bfd_link_hash_entry *h;
ldlang_undef_chain_list_type *ulist;
@@ -4277,7 +3987,7 @@ lang_gc_sections ()
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))
@@ -4290,7 +4000,7 @@ lang_gc_sections ()
}
void
-lang_process ()
+lang_process (void)
{
lang_reasonable_defaults ();
current_target = default_target;
@@ -4347,8 +4057,7 @@ lang_process ()
/* 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 ();
@@ -4358,7 +4067,7 @@ lang_process ()
/* 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;
@@ -4379,9 +4088,8 @@ lang_process ()
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. */
@@ -4402,16 +4110,13 @@ lang_process ()
/* 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. */
@@ -4425,13 +4130,9 @@ lang_process ()
/* 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
@@ -4444,9 +4145,7 @@ lang_process ()
/* 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
@@ -4462,10 +4161,9 @@ lang_process ()
/* 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;
@@ -4504,9 +4202,7 @@ lang_add_wild (filespec, section_list, keep_sections)
}
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;
@@ -4521,9 +4217,7 @@ lang_section_start (name, address)
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
@@ -4535,8 +4229,7 @@ lang_add_entry (name, 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);
@@ -4546,8 +4239,7 @@ lang_add_target (name)
}
void
-lang_add_map (name)
- const char *name;
+lang_add_map (const char *name)
{
while (*name)
{
@@ -4562,8 +4254,7 @@ lang_add_map (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);
@@ -4572,9 +4263,7 @@ lang_add_fill (fill)
}
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,
@@ -4593,12 +4282,11 @@ lang_add_data (type, exp)
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);
@@ -4614,8 +4302,7 @@ lang_add_reloc (reloc, howto, section, name, addend)
}
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);
@@ -4625,17 +4312,15 @@ lang_add_assignment (exp)
}
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"));
}
@@ -4647,8 +4332,7 @@ lang_startup (name)
}
void
-lang_float (maybe)
- bfd_boolean maybe;
+lang_float (bfd_boolean maybe)
{
lang_float_flag = maybe;
}
@@ -4665,10 +4349,11 @@ lang_float (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);
@@ -4684,11 +4369,9 @@ lang_get_regions (region, lma_region, memspec, lma_memspec, have_lma_p)
}
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 (&current_section->region,
&current_section->lma_region,
@@ -4705,14 +4388,12 @@ lang_leave_output_section_statement (fill, memspec, phdrs, lma_memspec)
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
@@ -4723,7 +4404,7 @@ lang_abs_symbol_at_beginning_of (secname, name)
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);
@@ -4738,14 +4419,12 @@ lang_abs_symbol_at_beginning_of (secname, name)
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
@@ -4756,7 +4435,7 @@ lang_abs_symbol_at_end_of (secname, name)
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)
@@ -4768,10 +4447,9 @@ lang_abs_symbol_at_end_of (secname, name)
}
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;
@@ -4780,11 +4458,10 @@ lang_statement_append (list, element, 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)
{
@@ -4803,7 +4480,7 @@ lang_add_output_format (format, big, little, from_script)
stat_ptr to build new statements within the group. */
void
-lang_enter_group ()
+lang_enter_group (void)
{
lang_group_statement_type *g;
@@ -4818,7 +4495,7 @@ lang_enter_group ()
but currently they can't. */
void
-lang_leave_group ()
+lang_leave_group (void)
{
stat_ptr = &statement_list;
}
@@ -4827,17 +4504,16 @@ lang_leave_group ()
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",
@@ -4856,7 +4532,7 @@ lang_new_phdr (name, type, filehdr, phdrs, at, flags)
should not be calling an ELF specific function here. */
static void
-lang_record_phdrs ()
+lang_record_phdrs (void)
{
unsigned int alc;
asection **secs;
@@ -4865,7 +4541,7 @@ lang_record_phdrs ()
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)
{
@@ -4905,8 +4581,7 @@ lang_record_phdrs ()
if (c >= alc)
{
alc *= 2;
- secs = ((asection **)
- xrealloc (secs, alc * sizeof (asection *)));
+ secs = xrealloc (secs, alc * sizeof (asection *));
}
secs[c] = os->bfd_section;
++c;
@@ -4957,12 +4632,11 @@ lang_record_phdrs ()
/* 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;
@@ -4991,8 +4665,7 @@ static struct overlay_list *overlay_list;
/* 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);
@@ -5005,8 +4678,7 @@ lang_enter_overlay (vma_expr)
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;
@@ -5021,7 +4693,7 @@ lang_enter_overlay_section (name)
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;
@@ -5039,9 +4711,8 @@ lang_enter_overlay_section (name)
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;
@@ -5083,13 +4754,12 @@ lang_leave_overlay_section (fill, phdrs)
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;
@@ -5113,7 +4783,7 @@ lang_leave_overlay (lma_expr, nocrossrefs, fill, memspec, phdrs, lma_memspec)
{
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;
@@ -5137,7 +4807,7 @@ lang_leave_overlay (lma_expr, nocrossrefs, fill, memspec, phdrs, lma_memspec)
{
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;
@@ -5163,9 +4833,8 @@ lang_leave_overlay (lma_expr, nocrossrefs, fill, memspec, phdrs, lma_memspec)
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;
@@ -5173,9 +4842,8 @@ lang_vers_match_lang_c (expr, sym)
}
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;
@@ -5200,9 +4868,8 @@ lang_vers_match_lang_cplusplus (expr, sym)
}
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;
@@ -5229,14 +4896,13 @@ lang_vers_match_lang_java (expr, sym)
/* 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;
@@ -5262,13 +4928,12 @@ lang_new_vers_pattern (orig, new, lang)
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;
@@ -5288,10 +4953,9 @@ static int version_index;
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;
@@ -5359,14 +5023,12 @@ lang_register_vers_node (name, version, deps)
/* 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)
@@ -5384,7 +5046,7 @@ lang_add_vers_depend (list, name)
}
static void
-lang_do_version_exports_section ()
+lang_do_version_exports_section (void)
{
struct bfd_elf_version_expr *greg = NULL, *lreg;
@@ -5422,8 +5084,7 @@ lang_do_version_exports_section ()
}
void
-lang_add_unique (name)
- const char *name;
+lang_add_unique (const char *name)
{
struct unique_sections *ent;
@@ -5431,7 +5092,7 @@ lang_add_unique (name)
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;
diff --git a/ld/ldlang.h b/ld/ldlang.h
index 3c4936b..9fc930b 100644
--- a/ld/ldlang.h
+++ b/ld/ldlang.h
@@ -376,70 +376,68 @@ extern bfd_boolean entry_from_cmdline;
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; \
@@ -448,80 +446,76 @@ extern bfd_vma lang_do_assignments
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
diff --git a/ld/ldlex.h b/ld/ldlex.h
index 36f2ad3..f956e9c 100644
--- a/ld/ldlex.h
+++ b/ld/ldlex.h
@@ -1,5 +1,5 @@
/* 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.
@@ -39,25 +39,25 @@ extern unsigned int lineno;
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
diff --git a/ld/ldlex.l b/ld/ldlex.l
index c9eb1af..b55ebe7 100644
--- a/ld/ldlex.l
+++ b/ld/ldlex.l
@@ -1,7 +1,7 @@
%{
/* 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.
@@ -26,7 +26,6 @@ This was written by steve chamberlain
*/
-#include "ansidecl.h"
#include <stdio.h>
#ifdef MPW
@@ -69,7 +68,7 @@ const char *lex_string = NULL;
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];
@@ -78,14 +77,11 @@ static unsigned int lineno_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
@@ -99,7 +95,7 @@ static void lex_warn_invalid PARAMS ((char *where, char *what));
/* Some versions of flex want this. */
#ifndef yywrap
-int yywrap () { return 1; }
+int yywrap (void) { return 1; }
#endif
%}
@@ -112,7 +108,7 @@ FILENAMECHAR1 [_a-zA-Z\/\.\\\$\_\~]
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\/\.\-\_\+\$\:\[\]\\\~]
@@ -144,24 +140,24 @@ V_IDENTIFIER [*?.$_a-zA-Z\[\]\-\!\^]([*?.$_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':
@@ -180,7 +176,7 @@ V_IDENTIFIER [*?.$_a-zA-Z\[\]\-\!\^]([*?.$_a-zA-Z0-9\[\]\-\!\^]|::)*
}
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)? {
@@ -193,14 +189,14 @@ V_IDENTIFIER [*?.$_a-zA-Z\[\]\-\!\^]([*?.$_a-zA-Z0-9\[\]\-\!\^]|::)*
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;
}
@@ -355,13 +351,13 @@ V_IDENTIFIER [*?.$_a-zA-Z\[\]\-\!\^]([*?.$_a-zA-Z0-9\[\]\-\!\^]|::)*
<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}+ {
@@ -375,12 +371,12 @@ V_IDENTIFIER [*?.$_a-zA-Z\[\]\-\!\^]([*?.$_a-zA-Z0-9\[\]\-\!\^]|::)*
try again. */
if (yytext[0] == '/' && yytext[1] == '*')
{
- yyless(2);
+ yyless (2);
comment ();
}
else
{
- yylval.name = xstrdup(yytext);
+ yylval.name = xstrdup (yytext);
return NAME;
}
}
@@ -388,8 +384,8 @@ V_IDENTIFIER [*?.$_a-zA-Z\[\]\-\!\^]([*?.$_a-zA-Z0-9\[\]\-\!\^]|::)*
<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++;}
@@ -411,7 +407,7 @@ V_IDENTIFIER [*?.$_a-zA-Z\[\]\-\!\^]([*?.$_a-zA-Z0-9\[\]\-\!\^]|::)*
<VERS_START>"{" { BEGIN(VERS_SCRIPT); return *yytext; }
-<VERS_SCRIPT>"{" { BEGIN(VERS_NODE);
+<VERS_SCRIPT>"{" { BEGIN(VERS_NODE);
vers_node_nesting = 0;
return *yytext;
}
@@ -430,14 +426,14 @@ V_IDENTIFIER [*?.$_a-zA-Z\[\]\-\!\^]([*?.$_a-zA-Z0-9\[\]\-\!\^]|::)*
<<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];
@@ -446,9 +442,9 @@ V_IDENTIFIER [*?.$_a-zA-Z\[\]\-\!\^]([*?.$_a-zA-Z0-9\[\]\-\!\^]|::)*
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);
+
%%
@@ -456,13 +452,11 @@ V_IDENTIFIER [*?.$_a-zA-Z\[\]\-\!\^]([*?.$_a-zA-Z0-9\[\]\-\!\^]|::)*
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;
@@ -471,27 +465,25 @@ lex_push_file (file, name)
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);
@@ -520,13 +512,12 @@ yy_create_string_buffer (string, size)
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");
}
@@ -546,56 +537,56 @@ static int state_stack[MAX_INCLUDE_DEPTH * 2];
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);
}
@@ -605,18 +596,15 @@ ldlex_popstate ()
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");
}
}
@@ -625,14 +613,14 @@ yy_input (buf, result, max_size)
/* 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++;
@@ -663,8 +651,7 @@ comment ()
in context WHERE. */
static void
-lex_warn_invalid (where, what)
- char *where, *what;
+lex_warn_invalid (char *where, char *what)
{
char buf[5];
diff --git a/ld/ldmain.c b/ld/ldmain.c
index 424a400..3647217 100644
--- a/ld/ldmain.c
+++ b/ld/ldmain.c
@@ -51,7 +51,7 @@
#ifdef HAVE_SBRK
#ifdef NEED_DECLARATION_SBRK
-extern PTR sbrk ();
+extern void *sbrk ();
#endif
#endif
@@ -59,8 +59,6 @@ extern PTR sbrk ();
#define TARGET_SYSTEM_ROOT ""
#endif
-int main PARAMS ((int, char **));
-
/* EXPORTS */
char *default_target;
@@ -103,45 +101,40 @@ args_type command_line;
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 =
{
@@ -162,7 +155,7 @@ static struct bfd_link_callbacks link_callbacks =
struct bfd_link_info link_info;
static void
-remove_output ()
+remove_output (void)
{
if (output_filename)
{
@@ -174,9 +167,7 @@ remove_output ()
}
int
-main (argc, argv)
- int argc;
- char **argv;
+main (int argc, char **argv)
{
char *emulation;
long start_time = get_run_time ();
@@ -329,8 +320,8 @@ main (argc, argv)
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 ("");
@@ -530,9 +521,11 @@ main (argc, argv)
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);
@@ -555,7 +548,7 @@ main (argc, argv)
if (config.stats)
{
#ifdef HAVE_SBRK
- char *lim = (char *) sbrk (0);
+ char *lim = sbrk (0);
#endif
long run_time = get_run_time () - start_time;
@@ -578,9 +571,7 @@ main (argc, argv)
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;
@@ -643,8 +634,7 @@ get_emulation (argc, argv)
else return FALSE. */
static bfd_boolean
-check_for_scripts_dir (dir)
- char *dir;
+check_for_scripts_dir (char *dir)
{
size_t dirlen;
char *buf;
@@ -653,7 +643,7 @@ check_for_scripts_dir (dir)
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);
@@ -675,7 +665,7 @@ check_for_scripts_dir (dir)
(for installing the tool suite elsewhere). */
static void
-set_scripts_dir ()
+set_scripts_dir (void)
{
char *end, *dir;
size_t dirlen;
@@ -723,7 +713,7 @@ set_scripts_dir ()
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';
@@ -740,34 +730,29 @@ set_scripts_dir ()
}
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))
@@ -781,8 +766,7 @@ add_wrap (name)
/* Handle the -retain-symbols-file option. */
void
-add_keepsyms_file (filename)
- const char *filename;
+add_keepsyms_file (const char *filename)
{
FILE *file;
char *buf;
@@ -793,20 +777,19 @@ add_keepsyms_file (filename)
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)
@@ -832,8 +815,7 @@ add_keepsyms_file (filename)
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"));
}
}
@@ -851,15 +833,13 @@ add_keepsyms_file (filename)
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;
@@ -877,7 +857,7 @@ add_archive_element (info, abfd, name)
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;
@@ -964,15 +944,14 @@ add_archive_element (info, abfd, name)
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
@@ -989,7 +968,7 @@ multiple_definition (info, name, obfd, osec, oval, nbfd, nsec, nval)
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)
@@ -1007,15 +986,14 @@ multiple_definition (info, name, obfd, osec, oval, nbfd, nsec, nval)
-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;
@@ -1073,13 +1051,12 @@ multiple_common (info, name, obfd, otype, osize, nbfd, ntype, nsize)
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"),
@@ -1088,7 +1065,7 @@ add_to_set (info, h, reloc, abfd, section, value)
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)
{
@@ -1108,13 +1085,12 @@ add_to_set (info, h, reloc, abfd, section, value)
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;
@@ -1171,13 +1147,12 @@ struct warning_callback_info
/* 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? */
@@ -1210,7 +1185,7 @@ warning_callback (info, warning, symbol, abfd, section, address)
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);
@@ -1225,7 +1200,7 @@ warning_callback (info, warning, symbol, abfd, section, address)
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);
@@ -1243,12 +1218,9 @@ warning_callback (info, warning, symbol, abfd, section, address)
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;
@@ -1263,7 +1235,7 @@ warning_find_reloc (abfd, sec, iarg)
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);
@@ -1291,13 +1263,12 @@ warning_find_reloc (abfd, sec, iarg)
/* 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;
@@ -1311,8 +1282,7 @@ undefined_symbol (info, name, abfd, section, address, fatal)
/* 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"));
}
@@ -1326,13 +1296,13 @@ undefined_symbol (info, name, abfd, section, address, fatal)
/* 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);
}
@@ -1379,19 +1349,18 @@ int overflow_cutoff_limit = 10;
/* 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);
@@ -1413,14 +1382,13 @@ reloc_overflow (info, name, reloc_name, addend, 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);
@@ -1432,14 +1400,13 @@ reloc_dangerous (info, message, 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);
@@ -1452,12 +1419,11 @@ unattached_reloc (info, name, 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
diff --git a/ld/ldmain.h b/ld/ldmain.h
index 500a4c7..10169dd 100644
--- a/ld/ldmain.h
+++ b/ld/ldmain.h
@@ -38,8 +38,8 @@ extern const char *output_filename;
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
diff --git a/ld/ldmisc.c b/ld/ldmisc.c
index 461d697..def598d 100644
--- a/ld/ldmisc.c
+++ b/ld/ldmisc.c
@@ -26,13 +26,7 @@
#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"
@@ -42,8 +36,6 @@
#include "ldmain.h"
#include "ldfile.h"
-static void vfinfo PARAMS ((FILE *, const char *, va_list));
-
/*
%% literal %
%F error is fatal
@@ -67,10 +59,7 @@ static void vfinfo PARAMS ((FILE *, const char *, va_list));
*/
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;
@@ -126,7 +115,7 @@ vfinfo (fp, fmt, arg)
case 'W':
/* hex bfd_vma with 0x with no leading zeroes taking up
- 8 spaces. */
+ 8 spaces. */
{
char buf[100];
bfd_vma value;
@@ -154,7 +143,7 @@ vfinfo (fp, fmt, arg)
{
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);
@@ -269,7 +258,7 @@ vfinfo (fp, fmt, arg)
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);
@@ -378,8 +367,7 @@ vfinfo (fp, fmt, arg)
other such chars that would otherwise confuse the demangler. */
char *
-demangle (name)
- const char *name;
+demangle (const char *name)
{
char *res;
const char *p;
@@ -420,34 +408,32 @@ demangle (name)
/* 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);
}
@@ -455,36 +441,35 @@ info_assert (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);
}
/* 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");
}
@@ -493,10 +478,7 @@ print_nl ()
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"),
@@ -509,10 +491,9 @@ ld_abort (file, line, fn)
}
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);
@@ -522,9 +503,9 @@ error_handler VPARAMS ((int id, const char *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);
@@ -547,8 +528,7 @@ error_handler VPARAMS ((int id, const char *fmt, ...))
/* 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"));
}
@@ -565,7 +545,8 @@ error_handler VPARAMS ((int id, const char *fmt, ...))
break;
}
vfinfo (stderr, fmt, arg);
+
out:
- VA_CLOSE (arg);
+ va_end (arg);
return TRUE;
}
diff --git a/ld/ldmisc.h b/ld/ldmisc.h
index c03ed97..b2812fb 100644
--- a/ld/ldmisc.h
+++ b/ld/ldmisc.h
@@ -1,5 +1,5 @@
/* 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.
@@ -22,16 +22,16 @@
#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)
@@ -39,8 +39,8 @@ 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
diff --git a/ld/ldver.h b/ld/ldver.h
index ef06937..fd840a8 100644
--- a/ld/ldver.h
+++ b/ld/ldver.h
@@ -1,5 +1,5 @@
/* 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.
@@ -17,4 +17,4 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-void ldversion PARAMS ((int));
+void ldversion (int);
diff --git a/ld/ldwrite.c b/ld/ldwrite.c
index a93f151..7ca0622 100644
--- a/ld/ldwrite.c
+++ b/ld/ldwrite.c
@@ -32,15 +32,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#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)
{
@@ -60,7 +55,7 @@ build_link_order (statement)
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;
@@ -197,9 +192,7 @@ build_link_order (statement)
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;
@@ -292,21 +285,13 @@ build_link_order (statement)
}
}
-/* 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;
@@ -348,8 +333,7 @@ clone_section (abfd, s, name, count)
#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);
@@ -368,10 +352,7 @@ ds (s)
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);
@@ -379,8 +360,7 @@ dump (s, a1, a2)
}
static void
-sanity_check (abfd)
- bfd *abfd;
+sanity_check (bfd *abfd)
{
asection *s;
for (s = abfd->sections; s; s = s->next)
@@ -403,9 +383,7 @@ sanity_check (abfd)
#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;
@@ -524,10 +502,10 @@ split_sections (abfd, info)
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. */
diff --git a/ld/ldwrite.h b/ld/ldwrite.h
index 68d8b52..13617c0 100644
--- a/ld/ldwrite.h
+++ b/ld/ldwrite.h
@@ -1,5 +1,5 @@
/* 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.
@@ -15,6 +15,7 @@
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);
diff --git a/ld/lexsup.c b/ld/lexsup.c
index 5f30f89..185a86d 100644
--- a/ld/lexsup.c
+++ b/ld/lexsup.c
@@ -53,10 +53,9 @@
#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;
@@ -110,7 +109,7 @@ 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)
@@ -118,13 +117,13 @@ int parsing_defsym = 0;
#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)
@@ -440,11 +439,7 @@ static const struct ld_option ld_options[] =
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;
@@ -464,9 +459,7 @@ is_num (string, min, max, err)
}
void
-parse_args (argc, argv)
- unsigned argc;
- char **argv;
+parse_args (unsigned argc, char **argv)
{
unsigned i;
int is, il, irl;
@@ -477,11 +470,9 @@ parse_args (argc, argv)
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
@@ -566,7 +557,7 @@ parse_args (argc, argv)
{
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;
}
@@ -613,16 +604,15 @@ parse_args (argc, argv)
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
@@ -714,8 +704,7 @@ parse_args (argc, argv)
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;
}
@@ -727,9 +716,9 @@ parse_args (argc, argv)
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;
}
@@ -762,8 +751,7 @@ parse_args (argc, argv)
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 = "-";
@@ -842,7 +830,7 @@ parse_args (argc, argv)
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;
@@ -882,7 +870,7 @@ parse_args (argc, argv)
{
lang_add_input_file (optarg,
lang_input_file_is_symbols_only_enum,
- (char *) NULL);
+ NULL);
break;
}
}
@@ -1077,8 +1065,8 @@ parse_args (argc, argv)
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;
@@ -1220,8 +1208,7 @@ parse_args (argc, argv)
library search path. */
static void
-set_default_dirlist (dirlist_ptr)
- char *dirlist_ptr;
+set_default_dirlist (char *dirlist_ptr)
{
char *p;
@@ -1239,8 +1226,7 @@ set_default_dirlist (dirlist_ptr)
}
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);
@@ -1252,7 +1238,7 @@ set_section_start (sect, valstr)
/* Print help messages for the options. */
static void
-help ()
+help (void)
{
unsigned i;
const char **targets, **pp;
diff --git a/ld/mri.c b/ld/mri.c
index cc9de64..41ba582 100644
--- a/ld/mri.c
+++ b/ld/mri.c
@@ -1,5 +1,5 @@
/* 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.
@@ -53,17 +53,8 @@ struct section_name_struct *alias;
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;
@@ -77,24 +68,23 @@ lookup (name, 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;
@@ -102,9 +92,7 @@ mri_add_to_list (list, name, vma, zalias, align, subalign)
}
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);
}
@@ -113,15 +101,13 @@ mri_output_section (name, vma)
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;
}
@@ -129,7 +115,7 @@ mri_base (exp)
static int done_tree = 0;
void
-mri_draw_tree ()
+mri_draw_tree (void)
{
if (done_tree)
return;
@@ -142,8 +128,8 @@ mri_draw_tree ()
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
@@ -151,23 +137,21 @@ mri_draw_tree ()
/* 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)
{
@@ -186,12 +170,12 @@ mri_draw_tree ()
/* 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. */
@@ -210,7 +194,7 @@ mri_draw_tree ()
}
/* 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;
@@ -236,10 +220,9 @@ mri_draw_tree ()
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;
@@ -250,7 +233,7 @@ mri_draw_tree ()
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;
@@ -258,9 +241,7 @@ mri_draw_tree ()
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;
}
@@ -270,29 +251,23 @@ mri_draw_tree ()
}
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)
{
@@ -311,56 +286,47 @@ mri_alias (want, is, isn)
}
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;
}
diff --git a/ld/mri.h b/ld/mri.h
index e857e3d..b430d20 100644
--- a/ld/mri.h
+++ b/ld/mri.h
@@ -1,5 +1,5 @@
/* 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.
@@ -22,18 +22,18 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
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
diff --git a/ld/pe-dll.c b/ld/pe-dll.c
index b1a3737..d693e30 100644
--- a/ld/pe-dll.c
+++ b/ld/pe-dll.c
@@ -120,8 +120,7 @@
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. */
@@ -287,39 +286,8 @@ static autofilter_entry_type autofilter_symbolsuffixlist[] =
#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;
@@ -346,21 +314,19 @@ typedef struct
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);
}
@@ -392,9 +358,7 @@ exclude_list_struct;
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;
@@ -406,9 +370,8 @@ pe_dll_add_excludes (new_excludes, type)
{
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;
@@ -423,10 +386,7 @@ pe_dll_add_excludes (new_excludes, type)
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;
@@ -453,7 +413,7 @@ auto_export (abfd, d, n)
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;
@@ -535,9 +495,7 @@ auto_export (abfd, d, n)
}
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;
@@ -567,7 +525,7 @@ process_def_file (abfd, info)
/* 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. */
@@ -579,14 +537,14 @@ process_def_file (abfd, info)
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)))
@@ -595,7 +553,7 @@ process_def_file (abfd, info)
/* 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,
@@ -632,9 +590,9 @@ process_def_file (abfd, info)
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;
@@ -649,7 +607,7 @@ process_def_file (abfd, info)
{
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;
@@ -666,8 +624,8 @@ process_def_file (abfd, info)
/* 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;
@@ -676,7 +634,8 @@ process_def_file (abfd, info)
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)
@@ -717,8 +676,9 @@ process_def_file (abfd, info)
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 != '@'))
{
@@ -783,8 +743,7 @@ process_def_file (abfd, info)
/* 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",
@@ -838,9 +797,7 @@ build_filler_bfd (include_edata)
/* 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;
@@ -871,7 +828,7 @@ generate_edata (abfd, info)
}
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;
@@ -923,19 +880,18 @@ generate_edata (abfd, info)
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);
@@ -947,7 +903,7 @@ fill_exported_offsets (abfd, info)
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);
@@ -955,9 +911,7 @@ fill_exported_offsets (abfd, info)
}
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;
@@ -969,7 +923,7 @@ fill_edata (abfd, info)
time (&now);
- edata_d = (unsigned char *) xmalloc (edata_sz);
+ edata_d = xmalloc (edata_sz);
/* Note use of array pointer math here. */
edirectory = edata_d;
@@ -978,7 +932,8 @@ fill_edata (abfd, info)
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);
@@ -1005,7 +960,7 @@ fill_edata (abfd, info)
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++)
{
@@ -1040,10 +995,9 @@ fill_edata (abfd, info)
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;
@@ -1054,7 +1008,7 @@ pe_walk_relocs_of_symbol (info, name, cb)
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)
@@ -1071,7 +1025,7 @@ pe_walk_relocs_of_symbol (info, name, cb)
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++)
@@ -1094,16 +1048,14 @@ pe_walk_relocs_of_symbol (info, name, cb)
/* 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;
@@ -1114,8 +1066,7 @@ generate_reloc (abfd, info)
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;
@@ -1149,11 +1100,11 @@ generate_reloc (abfd, info)
}
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++)
@@ -1249,10 +1200,10 @@ generate_reloc (abfd, info)
}
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++)
@@ -1265,7 +1216,7 @@ generate_reloc (abfd, info)
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);
@@ -1291,7 +1242,7 @@ generate_reloc (abfd, info)
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)
@@ -1302,10 +1253,7 @@ generate_reloc (abfd, info)
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;
@@ -1338,8 +1286,7 @@ quoteput (s, f, needs_quotes)
}
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");
@@ -1507,11 +1454,7 @@ static char *dll_symname;
#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;
@@ -1533,17 +1476,16 @@ quick_section (abfd, name, flags, align)
}
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);
@@ -1560,19 +1502,15 @@ static arelent *reltab = 0;
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;
@@ -1588,7 +1526,7 @@ save_relocs (asection *sec)
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;
@@ -1615,15 +1553,14 @@ save_relocs (asection *sec)
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++;
@@ -1635,7 +1572,7 @@ make_head (parent)
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);
@@ -1649,7 +1586,7 @@ make_head (parent)
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. */
@@ -1659,12 +1596,12 @@ make_head (parent)
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);
@@ -1688,8 +1625,7 @@ make_head (parent)
.asciz "my.dll" */
static bfd *
-make_tail (parent)
- bfd *parent;
+make_tail (bfd *parent)
{
asection *id4, *id5, *id7;
unsigned char *d4, *d5, *d7;
@@ -1697,7 +1633,7 @@ make_tail (parent)
char *oname;
bfd *abfd;
- oname = (char *) xmalloc (20);
+ oname = xmalloc (20);
sprintf (oname, "d%06d.o", tmp_seq);
tmp_seq++;
@@ -1709,19 +1645,19 @@ make_tail (parent)
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);
@@ -1729,7 +1665,7 @@ make_tail (parent)
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);
@@ -1794,9 +1730,7 @@ static unsigned char jmp_mips_bytes[] =
};
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;
@@ -1824,7 +1758,7 @@ make_one (exp, parent)
abort ();
}
- oname = (char *) xmalloc (20);
+ oname = xmalloc (20);
sprintf (oname, "d%06d.o", tmp_seq);
tmp_seq++;
@@ -1836,7 +1770,7 @@ make_one (exp, parent)
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);
@@ -1847,30 +1781,36 @@ make_one (exp, parent)
{
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);
@@ -1894,14 +1834,14 @@ make_one (exp, parent)
}
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);
@@ -1918,7 +1858,7 @@ make_one (exp, parent)
}
bfd_set_section_size (abfd, id4, 4);
- d4 = (unsigned char *) xmalloc (4);
+ d4 = xmalloc (4);
id4->contents = d4;
memset (d4, 0, 4);
@@ -1945,7 +1885,7 @@ make_one (exp, parent)
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;
@@ -1967,9 +1907,7 @@ make_one (exp, parent)
}
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;
@@ -1977,7 +1915,7 @@ make_singleton_name_thunk (import, parent)
char *oname;
bfd *abfd;
- oname = (char *) xmalloc (20);
+ oname = xmalloc (20);
sprintf (oname, "nmth%06d.o", tmp_seq);
tmp_seq++;
@@ -1989,13 +1927,13 @@ make_singleton_name_thunk (import, parent)
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);
@@ -2010,8 +1948,7 @@ make_singleton_name_thunk (import, parent)
}
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;
@@ -2025,7 +1962,7 @@ make_import_fixup_mark (rel)
if (!fixup_name)
{
- fixup_name = (char *) xmalloc (384);
+ fixup_name = xmalloc (384);
buffer_len = 384;
}
@@ -2038,7 +1975,7 @@ make_import_fixup_mark (rel)
/* 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);
@@ -2068,18 +2005,17 @@ make_import_fixup_mark (rel)
.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++;
@@ -2091,7 +2027,7 @@ make_import_fixup_entry (name, fixup_name, dll_symname, parent)
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
@@ -2102,7 +2038,7 @@ make_import_fixup_entry (name, fixup_name, dll_symname, parent)
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);
@@ -2124,18 +2060,17 @@ make_import_fixup_entry (name, fixup_name, dll_symname, parent)
.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++;
@@ -2147,13 +2082,14 @@ make_runtime_pseudo_reloc (name, fixup_name, addend, parent)
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);
@@ -2173,15 +2109,14 @@ make_runtime_pseudo_reloc (name, fixup_name, addend, parent)
.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++;
@@ -2193,13 +2128,14 @@ pe_create_runtime_relocator_reference (parent)
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);
@@ -2214,10 +2150,7 @@ pe_create_runtime_relocator_reference (parent)
}
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;
@@ -2276,9 +2209,7 @@ pe_create_import_fixup (rel, s, addend)
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;
@@ -2350,10 +2281,7 @@ pe_dll_generate_implib (def, impfilename)
}
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;
@@ -2368,9 +2296,7 @@ add_bfd_to_link (abfd, name, link_info)
}
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;
@@ -2398,12 +2324,15 @@ pe_process_import_defs (output_bfd, link_info)
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);
@@ -2459,9 +2388,7 @@ pe_process_import_defs (output_bfd, link_info)
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];
@@ -2471,9 +2398,7 @@ pe_get16 (abfd, where)
}
static unsigned int
-pe_get32 (abfd, where)
- bfd *abfd;
- int where;
+pe_get32 (bfd *abfd, int where)
{
unsigned char b[4];
@@ -2485,8 +2410,7 @@ pe_get32 (abfd, where)
#if 0 /* This is not currently used. */
static unsigned int
-pe_as16 (ptr)
- void *ptr;
+pe_as16 (void *ptr)
{
unsigned char *b = ptr;
@@ -2496,8 +2420,7 @@ pe_as16 (ptr)
#endif
static unsigned int
-pe_as32 (ptr)
- void *ptr;
+pe_as32 (void *ptr)
{
unsigned char *b = ptr;
@@ -2505,8 +2428,7 @@ pe_as32 (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;
@@ -2553,7 +2475,7 @@ pe_implied_import_dll (filename)
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];
@@ -2575,7 +2497,7 @@ pe_implied_import_dll (filename)
}
/* 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;
@@ -2596,7 +2518,7 @@ pe_implied_import_dll (filename)
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;
@@ -2608,7 +2530,7 @@ pe_implied_import_dll (filename)
}
}
- 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;
@@ -2642,7 +2564,7 @@ pe_implied_import_dll (filename)
/* 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;
@@ -2659,7 +2581,7 @@ pe_implied_import_dll (filename)
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,
@@ -2676,14 +2598,12 @@ pe_implied_import_dll (filename)
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);
@@ -2691,18 +2611,14 @@ pe_dll_build_sections (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;
@@ -2714,15 +2630,13 @@ pe_dll_fill_sections (abfd, info)
/* 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);
@@ -2735,9 +2649,7 @@ pe_dll_fill_sections (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;
@@ -2749,15 +2661,13 @@ pe_exe_fill_sections (abfd, info)
/* 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;
}
diff --git a/ld/pe-dll.h b/ld/pe-dll.h
index 9c50f5e..029bf33 100644
--- a/ld/pe-dll.h
+++ b/ld/pe-dll.h
@@ -1,5 +1,5 @@
/* 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.
@@ -36,28 +36,27 @@ extern int pe_dll_compat_implib;
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 */
diff --git a/ld/sysdep.h b/ld/sysdep.h
index 7151f14..f164e74 100644
--- a/ld/sysdep.h
+++ b/ld/sysdep.h
@@ -1,5 +1,6 @@
/* 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.
@@ -21,8 +22,6 @@
#ifndef LD_SYSDEP_H
#define LD_SYSDEP_H
-#include "ansidecl.h"
-
#include "config.h"
#include <stdio.h>