diff options
author | Alan Modra <amodra@gmail.com> | 2003-06-27 00:38:25 +0000 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2003-06-27 00:38:25 +0000 |
commit | 0c7a8e5acd399d1d36dbe0cda815844dd5308c10 (patch) | |
tree | 1b0c74e9719dfd6d6b6b1b396373870147643680 /ld | |
parent | a9232bb2657c979e51dd77e8d823cd90c749e784 (diff) | |
download | gdb-0c7a8e5acd399d1d36dbe0cda815844dd5308c10.zip gdb-0c7a8e5acd399d1d36dbe0cda815844dd5308c10.tar.gz gdb-0c7a8e5acd399d1d36dbe0cda815844dd5308c10.tar.bz2 |
* 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
* Makefile.am: Correct dependencies.
* Makefile.in: Regenerate.
Diffstat (limited to 'ld')
32 files changed, 680 insertions, 1180 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog index 5462143..37a9e49e 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,38 @@ +2003-06-27 Alan Modra <amodra@bigpond.net.au> + + * 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 + * Makefile.am: Correct dependencies. + * Makefile.in: Regenerate. + 2003-06-25 Alan Modra <amodra@bigpond.net.au> * ld.texinfo: Correct spelling of "relocatable". diff --git a/ld/Makefile.am b/ld/Makefile.am index c1070e6..a3ce88c 100644 --- a/ld/Makefile.am +++ b/ld/Makefile.am @@ -637,38 +637,42 @@ eelf32_i960.c: $(srcdir)/emulparams/elf32_i960.sh \ $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} ${GENSCRIPTS} elf32_i960 "$(tdir_elf32_i960)" eelf32b4300.c: $(srcdir)/emulparams/elf32b4300.sh \ - $(srcdir)/emulparams/elf32bmip.sh \ + $(srcdir)/emulparams/elf32bmip.sh $(srcdir)/emultempl/mipself.em \ $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} ${GENSCRIPTS} elf32b4300 "$(tdir_elf32b4300)" eelf32bmip.c: $(srcdir)/emulparams/elf32bmip.sh \ + $(srcdir)/emultempl/mipself.em \ $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} ${GENSCRIPTS} elf32bmip "$(tdir_elf32bmip)" eelf32bsmip.c: $(srcdir)/emulparams/elf32bsmip.sh \ - $(srcdir)/emulparams/elf32bmip.sh \ + $(srcdir)/emulparams/elf32bmip.sh $(srcdir)/emultempl/mipself.em \ $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} ${GENSCRIPTS} elf32bsmip "$(tdir_elf32bsmip)" eelf32btsmip.c: $(srcdir)/emulparams/elf32btsmip.sh \ - $(srcdir)/emulparams/elf32bmip.sh \ + $(srcdir)/emulparams/elf32bmip.sh $(srcdir)/emultempl/mipself.em \ $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} ${GENSCRIPTS} elf32btsmip "$(tdir_elf32btsmip)" eelf32btsmipn32.c: $(srcdir)/emulparams/elf32btsmipn32.sh \ - $(srcdir)/emulparams/elf32bmip.sh \ + $(srcdir)/emulparams/elf32bmip.sh $(srcdir)/emultempl/mipself.em \ $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} ${GENSCRIPTS} elf32btsmipn32 "$(tdir_elf32btsmipn32)" eelf32ltsmip.c: $(srcdir)/emulparams/elf32ltsmip.sh \ $(srcdir)/emulparams/elf32btsmip.sh $(srcdir)/emulparams/elf32bmip.sh \ + $(srcdir)/emultempl/mipself.em \ $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} ${GENSCRIPTS} elf32ltsmip "$(tdir_elf32ltsmip)" eelf32ltsmipn32.c: $(srcdir)/emulparams/elf32ltsmipn32.sh \ $(srcdir)/emulparams/elf32btsmip.sh $(srcdir)/emulparams/elf32bmip.sh \ + $(srcdir)/emultempl/mipself.em \ $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} ${GENSCRIPTS} elf32ltsmipn32 "$(tdir_elf32ltsmipn32)" eelf32ebmip.c: $(srcdir)/emulparams/elf32ebmip.sh \ - $(srcdir)/emulparams/elf32bmip.sh \ + $(srcdir)/emulparams/elf32bmip.sh $(srcdir)/emultempl/mipself.em \ $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} ${GENSCRIPTS} elf32ebmip "$(tdir_elf32ebmip)" eelf32elmip.c: $(srcdir)/emulparams/elf32elmip.sh \ $(srcdir)/emulparams/elf32lmip.sh $(srcdir)/emulparams/elf32bmip.sh \ + $(srcdir)/emultempl/mipself.em \ $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} ${GENSCRIPTS} elf32elmip "$(tdir_elf32elmip)" eelf32bmipn32.c: $(srcdir)/emulparams/elf32bmipn32.sh \ @@ -676,10 +680,11 @@ eelf32bmipn32.c: $(srcdir)/emulparams/elf32bmipn32.sh \ ${GENSCRIPTS} elf32bmipn32 "$(tdir_elf32bmipn32)" eelf32l4300.c: $(srcdir)/emulparams/elf32l4300.sh \ $(srcdir)/emulparams/elf32b4300.sh $(srcdir)/emulparams/elf32bmip.sh \ + $(srcdir)/emultempl/mipself.em \ $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} ${GENSCRIPTS} elf32l4300 "$(tdir_elf32l4300)" eelf32lmip.c: $(srcdir)/emulparams/elf32lmip.sh \ - $(srcdir)/emulparams/elf32bmip.sh \ + $(srcdir)/emulparams/elf32bmip.sh $(srcdir)/emultempl/mipself.em \ $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} ${GENSCRIPTS} elf32lmip "$(tdir_elf32lmip)" eelf32lppc.c: $(srcdir)/emulparams/elf32lppc.sh \ @@ -704,6 +709,7 @@ eelf32ppcwindiss.c: $(srcdir)/emulparams/elf32ppcwindiss.sh \ ${GENSCRIPTS} elf32ppcwindiss "$(tdir_elf32ppcwindiss)" eelf32lsmip.c: $(srcdir)/emulparams/elf32lsmip.sh \ $(srcdir)/emulparams/elf32lmip.sh $(srcdir)/emulparams/elf32bmip.sh \ + $(srcdir)/emultempl/mipself.em \ $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} ${GENSCRIPTS} elf32lsmip "$(tdir_elf32lsmip)" eelf32openrisc.c: $(srcdir)/emulparams/elf32openrisc.sh \ @@ -970,16 +976,20 @@ elnk960.c: $(srcdir)/emulparams/lnk960.sh \ $(srcdir)/emultempl/lnk960.em $(srcdir)/scripttempl/i960.sc ${GEN_DEPENDS} ${GENSCRIPTS} lnk960 "$(tdir_lnk960)" em68hc11elf.c: $(srcdir)/emulparams/m68hc11elf.sh \ - $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elfm68hc11.sc ${GEN_DEPENDS} + $(srcdir)/emultempl/m68hc1xelf.em $(srcdir)/emultempl/elf32.em \ + $(srcdir)/scripttempl/elfm68hc11.sc ${GEN_DEPENDS} ${GENSCRIPTS} m68hc11elf "$(tdir_m68hc11)" em68hc11elfb.c: $(srcdir)/emulparams/m68hc11elfb.sh \ - $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elfm68hc11.sc ${GEN_DEPENDS} + $(srcdir)/emultempl/m68hc1xelf.em $(srcdir)/emultempl/elf32.em \ + $(srcdir)/scripttempl/elfm68hc11.sc ${GEN_DEPENDS} ${GENSCRIPTS} m68hc11elfb "$(tdir_m68hc11b)" em68hc12elf.c: $(srcdir)/emulparams/m68hc12elf.sh \ - $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elfm68hc12.sc ${GEN_DEPENDS} + $(srcdir)/emultempl/m68hc1xelf.em $(srcdir)/emultempl/elf32.em \ + $(srcdir)/scripttempl/elfm68hc12.sc ${GEN_DEPENDS} ${GENSCRIPTS} m68hc12elf "$(tdir_m68hc12)" em68hc12elfb.c: $(srcdir)/emulparams/m68hc12elfb.sh \ - $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elfm68hc12.sc ${GEN_DEPENDS} + $(srcdir)/emultempl/m68hc1xelf.em $(srcdir)/emultempl/elf32.em \ + $(srcdir)/scripttempl/elfm68hc12.sc ${GEN_DEPENDS} ${GENSCRIPTS} m68hc12elfb "$(tdir_m68hc12b)" em68k4knbsd.c: $(srcdir)/emulparams/m68k4knbsd.sh \ $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS} diff --git a/ld/Makefile.in b/ld/Makefile.in index 879af1c..17a833b 100644 --- a/ld/Makefile.in +++ b/ld/Makefile.in @@ -1363,38 +1363,42 @@ eelf32_i960.c: $(srcdir)/emulparams/elf32_i960.sh \ $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} ${GENSCRIPTS} elf32_i960 "$(tdir_elf32_i960)" eelf32b4300.c: $(srcdir)/emulparams/elf32b4300.sh \ - $(srcdir)/emulparams/elf32bmip.sh \ + $(srcdir)/emulparams/elf32bmip.sh $(srcdir)/emultempl/mipself.em \ $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} ${GENSCRIPTS} elf32b4300 "$(tdir_elf32b4300)" eelf32bmip.c: $(srcdir)/emulparams/elf32bmip.sh \ + $(srcdir)/emultempl/mipself.em \ $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} ${GENSCRIPTS} elf32bmip "$(tdir_elf32bmip)" eelf32bsmip.c: $(srcdir)/emulparams/elf32bsmip.sh \ - $(srcdir)/emulparams/elf32bmip.sh \ + $(srcdir)/emulparams/elf32bmip.sh $(srcdir)/emultempl/mipself.em \ $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} ${GENSCRIPTS} elf32bsmip "$(tdir_elf32bsmip)" eelf32btsmip.c: $(srcdir)/emulparams/elf32btsmip.sh \ - $(srcdir)/emulparams/elf32bmip.sh \ + $(srcdir)/emulparams/elf32bmip.sh $(srcdir)/emultempl/mipself.em \ $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} ${GENSCRIPTS} elf32btsmip "$(tdir_elf32btsmip)" eelf32btsmipn32.c: $(srcdir)/emulparams/elf32btsmipn32.sh \ - $(srcdir)/emulparams/elf32bmip.sh \ + $(srcdir)/emulparams/elf32bmip.sh $(srcdir)/emultempl/mipself.em \ $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} ${GENSCRIPTS} elf32btsmipn32 "$(tdir_elf32btsmipn32)" eelf32ltsmip.c: $(srcdir)/emulparams/elf32ltsmip.sh \ $(srcdir)/emulparams/elf32btsmip.sh $(srcdir)/emulparams/elf32bmip.sh \ + $(srcdir)/emultempl/mipself.em \ $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} ${GENSCRIPTS} elf32ltsmip "$(tdir_elf32ltsmip)" eelf32ltsmipn32.c: $(srcdir)/emulparams/elf32ltsmipn32.sh \ $(srcdir)/emulparams/elf32btsmip.sh $(srcdir)/emulparams/elf32bmip.sh \ + $(srcdir)/emultempl/mipself.em \ $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} ${GENSCRIPTS} elf32ltsmipn32 "$(tdir_elf32ltsmipn32)" eelf32ebmip.c: $(srcdir)/emulparams/elf32ebmip.sh \ - $(srcdir)/emulparams/elf32bmip.sh \ + $(srcdir)/emulparams/elf32bmip.sh $(srcdir)/emultempl/mipself.em \ $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} ${GENSCRIPTS} elf32ebmip "$(tdir_elf32ebmip)" eelf32elmip.c: $(srcdir)/emulparams/elf32elmip.sh \ $(srcdir)/emulparams/elf32lmip.sh $(srcdir)/emulparams/elf32bmip.sh \ + $(srcdir)/emultempl/mipself.em \ $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} ${GENSCRIPTS} elf32elmip "$(tdir_elf32elmip)" eelf32bmipn32.c: $(srcdir)/emulparams/elf32bmipn32.sh \ @@ -1402,10 +1406,11 @@ eelf32bmipn32.c: $(srcdir)/emulparams/elf32bmipn32.sh \ ${GENSCRIPTS} elf32bmipn32 "$(tdir_elf32bmipn32)" eelf32l4300.c: $(srcdir)/emulparams/elf32l4300.sh \ $(srcdir)/emulparams/elf32b4300.sh $(srcdir)/emulparams/elf32bmip.sh \ + $(srcdir)/emultempl/mipself.em \ $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} ${GENSCRIPTS} elf32l4300 "$(tdir_elf32l4300)" eelf32lmip.c: $(srcdir)/emulparams/elf32lmip.sh \ - $(srcdir)/emulparams/elf32bmip.sh \ + $(srcdir)/emulparams/elf32bmip.sh $(srcdir)/emultempl/mipself.em \ $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} ${GENSCRIPTS} elf32lmip "$(tdir_elf32lmip)" eelf32lppc.c: $(srcdir)/emulparams/elf32lppc.sh \ @@ -1430,6 +1435,7 @@ eelf32ppcwindiss.c: $(srcdir)/emulparams/elf32ppcwindiss.sh \ ${GENSCRIPTS} elf32ppcwindiss "$(tdir_elf32ppcwindiss)" eelf32lsmip.c: $(srcdir)/emulparams/elf32lsmip.sh \ $(srcdir)/emulparams/elf32lmip.sh $(srcdir)/emulparams/elf32bmip.sh \ + $(srcdir)/emultempl/mipself.em \ $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} ${GENSCRIPTS} elf32lsmip "$(tdir_elf32lsmip)" eelf32openrisc.c: $(srcdir)/emulparams/elf32openrisc.sh \ @@ -1696,16 +1702,20 @@ elnk960.c: $(srcdir)/emulparams/lnk960.sh \ $(srcdir)/emultempl/lnk960.em $(srcdir)/scripttempl/i960.sc ${GEN_DEPENDS} ${GENSCRIPTS} lnk960 "$(tdir_lnk960)" em68hc11elf.c: $(srcdir)/emulparams/m68hc11elf.sh \ - $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elfm68hc11.sc ${GEN_DEPENDS} + $(srcdir)/emultempl/m68hc1xelf.em $(srcdir)/emultempl/elf32.em \ + $(srcdir)/scripttempl/elfm68hc11.sc ${GEN_DEPENDS} ${GENSCRIPTS} m68hc11elf "$(tdir_m68hc11)" em68hc11elfb.c: $(srcdir)/emulparams/m68hc11elfb.sh \ - $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elfm68hc11.sc ${GEN_DEPENDS} + $(srcdir)/emultempl/m68hc1xelf.em $(srcdir)/emultempl/elf32.em \ + $(srcdir)/scripttempl/elfm68hc11.sc ${GEN_DEPENDS} ${GENSCRIPTS} m68hc11elfb "$(tdir_m68hc11b)" em68hc12elf.c: $(srcdir)/emulparams/m68hc12elf.sh \ - $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elfm68hc12.sc ${GEN_DEPENDS} + $(srcdir)/emultempl/m68hc1xelf.em $(srcdir)/emultempl/elf32.em \ + $(srcdir)/scripttempl/elfm68hc12.sc ${GEN_DEPENDS} ${GENSCRIPTS} m68hc12elf "$(tdir_m68hc12)" em68hc12elfb.c: $(srcdir)/emulparams/m68hc12elfb.sh \ - $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elfm68hc12.sc ${GEN_DEPENDS} + $(srcdir)/emultempl/m68hc1xelf.em $(srcdir)/emultempl/elf32.em \ + $(srcdir)/scripttempl/elfm68hc12.sc ${GEN_DEPENDS} ${GENSCRIPTS} m68hc12elfb "$(tdir_m68hc12b)" em68k4knbsd.c: $(srcdir)/emulparams/m68k4knbsd.sh \ $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS} diff --git a/ld/emultempl/aix.em b/ld/emultempl/aix.em index ad4c6dc..842911e 100644 --- a/ld/emultempl/aix.em +++ b/ld/emultempl/aix.em @@ -56,40 +56,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "libcoff.h" #include "libxcoff.h" -static void gld${EMULATION_NAME}_before_parse - PARAMS ((void)); -static bfd_boolean gld${EMULATION_NAME}_parse_args - PARAMS ((int, char **)); -static void gld${EMULATION_NAME}_add_options - PARAMS ((int, char **, int, struct option **, int, struct option **)); -static bfd_boolean gld${EMULATION_NAME}_handle_option - PARAMS ((int)); -static void gld${EMULATION_NAME}_after_open - PARAMS ((void)); -static char *gld${EMULATION_NAME}_choose_target - PARAMS ((int, char **)); -static void gld${EMULATION_NAME}_before_allocation - PARAMS ((void)); -static void gld${EMULATION_NAME}_read_file - PARAMS ((const char *, bfd_boolean)); -static void gld${EMULATION_NAME}_free - PARAMS ((PTR)); -static void gld${EMULATION_NAME}_find_relocs - PARAMS ((lang_statement_union_type *)); -static void gld${EMULATION_NAME}_find_exp_assignment - PARAMS ((etree_type *)); -static char *gld${EMULATION_NAME}_get_script - PARAMS ((int *isfile)); -static bfd_boolean gld${EMULATION_NAME}_unrecognized_file - PARAMS ((lang_input_statement_type *)); -static void gld${EMULATION_NAME}_create_output_section_statements - PARAMS ((void)); -static void gld${EMULATION_NAME}_set_output_arch - PARAMS ((void)); -static int is_syscall - PARAMS ((char *, unsigned int *)); -static int change_symbol_mode - PARAMS ((char *)); +static void gld${EMULATION_NAME}_read_file (const char *, bfd_boolean); +static void gld${EMULATION_NAME}_free (void *); +static void gld${EMULATION_NAME}_find_relocs (lang_statement_union_type *); +static void gld${EMULATION_NAME}_find_exp_assignment (etree_type *); + /* The file alignment required for each section. */ static unsigned long file_align; @@ -160,7 +131,7 @@ static char *command_line_blibpath = NULL; /* This routine is called before anything else is done. */ static void -gld${EMULATION_NAME}_before_parse () +gld${EMULATION_NAME}_before_parse (void) { const bfd_arch_info_type *arch = bfd_scan_arch ("${OUTPUT_ARCH}"); if (arch) @@ -210,13 +181,9 @@ enum }; static void -gld${EMULATION_NAME}_add_options (ns, shortopts, nl, longopts, nrl, really_longopts) - int ns; - char **shortopts; - int nl; - struct option **longopts; - int nrl ATTRIBUTE_UNUSED; - struct option **really_longopts ATTRIBUTE_UNUSED; +gld${EMULATION_NAME}_add_options + (int ns, char **shortopts, int nl, struct option **longopts, + int nrl ATTRIBUTE_UNUSED, struct option **really_longopts ATTRIBUTE_UNUSED) { static const char xtra_short[] = "D:H:KT:z"; static const struct option xtra_long[] = { @@ -291,15 +258,13 @@ gld${EMULATION_NAME}_add_options (ns, shortopts, nl, longopts, nrl, really_longo *shortopts = (char *) xrealloc (*shortopts, ns + sizeof (xtra_short)); memcpy (*shortopts + ns, &xtra_short, sizeof (xtra_short)); - *longopts = (struct option *) - xrealloc (*longopts, nl * sizeof (struct option) + sizeof (xtra_long)); + *longopts = xrealloc (*longopts, + nl * sizeof (struct option) + sizeof (xtra_long)); memcpy (*longopts + nl, &xtra_long, sizeof (xtra_long)); } static bfd_boolean -gld${EMULATION_NAME}_parse_args (argc, argv) - int argc; - char **argv; +gld${EMULATION_NAME}_parse_args (int argc, char **argv) { int indx; @@ -327,8 +292,7 @@ gld${EMULATION_NAME}_parse_args (argc, argv) } static bfd_boolean -gld${EMULATION_NAME}_handle_option (optc) - int optc; +gld${EMULATION_NAME}_handle_option (int optc) { bfd_signed_vma val; const char *end; @@ -570,8 +534,7 @@ gld${EMULATION_NAME}_handle_option (optc) as an import file. This is for AIX compatibility. */ static bfd_boolean -gld${EMULATION_NAME}_unrecognized_file (entry) - lang_input_statement_type *entry; +gld${EMULATION_NAME}_unrecognized_file (lang_input_statement_type *entry) { FILE *e; bfd_boolean ret; @@ -607,7 +570,7 @@ gld${EMULATION_NAME}_unrecognized_file (entry) /* This is called after the input files have been opened. */ static void -gld${EMULATION_NAME}_after_open () +gld${EMULATION_NAME}_after_open (void) { bfd_boolean r; struct set_info *p; @@ -652,7 +615,7 @@ gld${EMULATION_NAME}_after_open () sections, but before any sizes or addresses have been set. */ static void -gld${EMULATION_NAME}_before_allocation () +gld${EMULATION_NAME}_before_allocation (void) { struct filelist *fl; struct export_symbol_list *el; @@ -834,9 +797,7 @@ gld${EMULATION_NAME}_before_allocation () } static char * -gld${EMULATION_NAME}_choose_target (argc, argv) - int argc; - char **argv; +gld${EMULATION_NAME}_choose_target (int argc, char **argv) { int i, j, jmax; static char *from_outside; @@ -871,8 +832,7 @@ gld${EMULATION_NAME}_choose_target (argc, argv) 1 : state changed 0 : no change */ static int -change_symbol_mode (input) - char *input; +change_symbol_mode (char *input) { char *symbol_mode_string[] = { "# 32", /* 0x01 */ @@ -906,9 +866,7 @@ change_symbol_mode (input) 0 : ignore -1 : error, try something else */ static int -is_syscall (input, flag) - char *input; - unsigned int *flag; +is_syscall (char *input, unsigned int *flag) { unsigned int bit; char *string; @@ -958,9 +916,7 @@ is_syscall (input, flag) this is called by the handle_option emulation routine. */ static void -gld${EMULATION_NAME}_read_file (filename, import) - const char *filename; - bfd_boolean import; +gld${EMULATION_NAME}_read_file (const char *filename, bfd_boolean import) { struct obstack *o; FILE *f; @@ -1201,8 +1157,7 @@ gld${EMULATION_NAME}_read_file (filename, import) /* This routine saves us from worrying about declaring free. */ static void -gld${EMULATION_NAME}_free (p) - PTR p; +gld${EMULATION_NAME}_free (void *p) { free (p); } @@ -1212,8 +1167,7 @@ gld${EMULATION_NAME}_free (p) to symbols. */ static void -gld${EMULATION_NAME}_find_relocs (s) - lang_statement_union_type *s; +gld${EMULATION_NAME}_find_relocs (lang_statement_union_type *s) { if (s->header.type == lang_reloc_statement_enum) { @@ -1233,8 +1187,7 @@ gld${EMULATION_NAME}_find_relocs (s) /* Look through an expression for an assignment statement. */ static void -gld${EMULATION_NAME}_find_exp_assignment (exp) - etree_type *exp; +gld${EMULATION_NAME}_find_exp_assignment (etree_type *exp) { struct bfd_link_hash_entry *h; @@ -1278,8 +1231,7 @@ gld${EMULATION_NAME}_find_exp_assignment (exp) } static char * -gld${EMULATION_NAME}_get_script (isfile) - int *isfile; +gld${EMULATION_NAME}_get_script (int *isfile) EOF if test -n "$COMPILE_IN" @@ -1332,7 +1284,7 @@ fi cat >>e${EMULATION_NAME}.c <<EOF static void -gld${EMULATION_NAME}_create_output_section_statements () +gld${EMULATION_NAME}_create_output_section_statements (void) { /* __rtinit */ if ((bfd_get_flavour (output_bfd) == bfd_target_xcoff_flavour) @@ -1371,7 +1323,7 @@ gld${EMULATION_NAME}_create_output_section_statements () } static void -gld${EMULATION_NAME}_set_output_arch () +gld${EMULATION_NAME}_set_output_arch (void) { bfd_set_arch_mach (output_bfd, bfd_xcoff_architecture (output_bfd), diff --git a/ld/emultempl/alphaelf.em b/ld/emultempl/alphaelf.em index a1bb0c5..7e64323 100644 --- a/ld/emultempl/alphaelf.em +++ b/ld/emultempl/alphaelf.em @@ -27,16 +27,13 @@ cat >>e${EMULATION_NAME}.c <<EOF #include "elf/alpha.h" #include "elf-bfd.h" -static void alpha_after_parse PARAMS ((void)); -static void alpha_finish PARAMS ((void)); - static int elf64alpha_32bit = 0; /* Set the start address as in the Tru64 ld. */ #define ALPHA_TEXT_START_32BIT 0x12000000 static void -alpha_after_parse () +alpha_after_parse (void) { if (elf64alpha_32bit && !link_info.shared && !link_info.relocatable) lang_section_start (".interp", @@ -46,7 +43,7 @@ alpha_after_parse () } static void -alpha_finish () +alpha_finish (void) { if (elf64alpha_32bit) elf_elfheader (output_bfd)->e_flags |= EF_ALPHA_32BIT; diff --git a/ld/emultempl/armcoff.em b/ld/emultempl/armcoff.em index 15ebecf..2368b90 100644 --- a/ld/emultempl/armcoff.em +++ b/ld/emultempl/armcoff.em @@ -40,18 +40,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "ldfile.h" #include "ldemul.h" -static void gld${EMULATION_NAME}_before_parse PARAMS ((void)); -static void gld${EMULATION_NAME}_before_allocation PARAMS ((void)); -static char *gld${EMULATION_NAME}_get_script PARAMS ((int *isfile)); -static void gld${EMULATION_NAME}_add_options - PARAMS ((int, char **, int, struct option **, int, struct option **)); -static void gld${EMULATION_NAME}_list_options PARAMS ((FILE *)); -static bfd_boolean gld${EMULATION_NAME}_handle_option PARAMS ((int)); -static void gld${EMULATION_NAME}_finish PARAMS ((void)); -static void gld${EMULATION_NAME}_after_open PARAMS ((void)); - -/* If TRUE, then interworking stubs which support calls to old, non-interworking - aware ARM code should be generated. */ +/* If TRUE, then interworking stubs which support calls to old, + non-interworking aware ARM code should be generated. */ static int support_old_code = 0; static char * thumb_entry_symbol = NULL; @@ -60,13 +50,10 @@ static char * thumb_entry_symbol = NULL; #define OPTION_THUMB_ENTRY 301 static void -gld${EMULATION_NAME}_add_options (ns, shortopts, nl, longopts, nrl, really_longopts) - int ns ATTRIBUTE_UNUSED; - char **shortopts ATTRIBUTE_UNUSED; - int nl; - struct option **longopts; - int nrl ATTRIBUTE_UNUSED; - struct option **really_longopts ATTRIBUTE_UNUSED; +gld${EMULATION_NAME}_add_options + (int ns ATTRIBUTE_UNUSED, char **shortopts ATTRIBUTE_UNUSED, int nl, + struct option **longopts, int nrl ATTRIBUTE_UNUSED, + struct option **really_longopts ATTRIBUTE_UNUSED) { static const struct option xtra_long[] = { {"support-old-code", no_argument, NULL, OPTION_SUPPORT_OLD_CODE}, @@ -74,22 +61,20 @@ gld${EMULATION_NAME}_add_options (ns, shortopts, nl, longopts, nrl, really_longo {NULL, no_argument, NULL, 0} }; - *longopts = (struct option *) - xrealloc (*longopts, nl * sizeof (struct option) + sizeof (xtra_long)); + *longopts = xrealloc (*longopts, + nl * sizeof (struct option) + sizeof (xtra_long)); memcpy (*longopts + nl, &xtra_long, sizeof (xtra_long)); } static void -gld${EMULATION_NAME}_list_options (file) - FILE * file; +gld${EMULATION_NAME}_list_options (FILE *file) { fprintf (file, _(" --support-old-code Support interworking with old code\n")); fprintf (file, _(" --thumb-entry=<sym> Set the entry point to be Thumb symbol <sym>\n")); } static bfd_boolean -gld${EMULATION_NAME}_handle_option (optc) - int optc; +gld${EMULATION_NAME}_handle_option (int optc) { switch (optc) { @@ -104,12 +89,12 @@ gld${EMULATION_NAME}_handle_option (optc) thumb_entry_symbol = optarg; break; } - + return TRUE; } static void -gld${EMULATION_NAME}_before_parse () +gld${EMULATION_NAME}_before_parse (void) { #ifndef TARGET_ /* I.e., if not generic. */ ldfile_set_output_arch ("`echo ${ARCH}`"); @@ -120,7 +105,7 @@ gld${EMULATION_NAME}_before_parse () sections, but before any sizes or addresses have been set. */ static void -gld${EMULATION_NAME}_before_allocation () +gld${EMULATION_NAME}_before_allocation (void) { /* we should be able to set the size of the interworking stub section */ @@ -143,7 +128,7 @@ gld${EMULATION_NAME}_before_allocation () } static void -gld${EMULATION_NAME}_after_open () +gld${EMULATION_NAME}_after_open (void) { if (strstr (bfd_get_target (output_bfd), "arm") == NULL) { @@ -154,7 +139,7 @@ gld${EMULATION_NAME}_after_open () einfo ("%F%X%P: error: cannot change output format whilst linking ARM binaries\n"); return; } - + { LANG_FOR_EACH_INPUT_STATEMENT (is) { @@ -165,13 +150,13 @@ gld${EMULATION_NAME}_after_open () } static void -gld${EMULATION_NAME}_finish PARAMS((void)) +gld${EMULATION_NAME}_finish (void) { struct bfd_link_hash_entry * h; if (thumb_entry_symbol == NULL) return; - + h = bfd_link_hash_lookup (link_info.hash, thumb_entry_symbol, FALSE, FALSE, TRUE); @@ -182,21 +167,21 @@ gld${EMULATION_NAME}_finish PARAMS((void)) { static char buffer[32]; bfd_vma val; - + /* Special procesing is required for a Thumb entry symbol. The bottom bit of its address must be set. */ val = (h->u.def.value + bfd_get_section_vma (output_bfd, h->u.def.section->output_section) + h->u.def.section->output_offset); - + val |= 1; /* Now convert this value into a string and store it in entry_symbol - where the lang_finish() function will pick it up. */ + where the lang_finish() function will pick it up. */ buffer[0] = '0'; buffer[1] = 'x'; - + sprintf_vma (buffer + 2, val); if (entry_symbol.name != NULL && entry_from_cmdline) @@ -209,8 +194,7 @@ gld${EMULATION_NAME}_finish PARAMS((void)) } static char * -gld${EMULATION_NAME}_get_script (isfile) - int *isfile; +gld${EMULATION_NAME}_get_script (int *isfile) EOF if test -n "$COMPILE_IN" @@ -221,7 +205,7 @@ then sc="-f stringify.sed" cat >>e${EMULATION_NAME}.c <<EOF -{ +{ *isfile = 0; if (link_info.relocatable && config.build_constructors) @@ -242,7 +226,7 @@ else # Scripts read from the filesystem. cat >>e${EMULATION_NAME}.c <<EOF -{ +{ *isfile = 1; if (link_info.relocatable && config.build_constructors) @@ -262,7 +246,7 @@ fi cat >>e${EMULATION_NAME}.c <<EOF -struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation = +struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation = { gld${EMULATION_NAME}_before_parse, syslib_default, diff --git a/ld/emultempl/armelf.em b/ld/emultempl/armelf.em index b125c57..c5c69fc 100644 --- a/ld/emultempl/armelf.em +++ b/ld/emultempl/armelf.em @@ -28,9 +28,8 @@ static int no_pipeline_knowledge = 0; static char *thumb_entry_symbol = NULL; static bfd *bfd_for_interwork; - static void -gld${EMULATION_NAME}_before_parse () +gld${EMULATION_NAME}_before_parse (void) { #ifndef TARGET_ /* I.e., if not generic. */ ldfile_set_output_arch ("`echo ${ARCH}`"); @@ -39,10 +38,8 @@ gld${EMULATION_NAME}_before_parse () config.has_shared = `if test -n "$GENERATE_SHLIB_SCRIPT" ; then echo TRUE ; else echo FALSE ; fi`; } -static void arm_elf_after_open PARAMS ((void)); - static void -arm_elf_after_open () +arm_elf_after_open (void) { if (strstr (bfd_get_target (output_bfd), "arm") == NULL) { @@ -65,12 +62,8 @@ arm_elf_after_open () gld${EMULATION_NAME}_after_open (); } -static void arm_elf_set_bfd_for_interworking - PARAMS ((lang_statement_union_type *)); - static void -arm_elf_set_bfd_for_interworking (statement) - lang_statement_union_type *statement; +arm_elf_set_bfd_for_interworking (lang_statement_union_type *statement) { if (statement->header.type == lang_input_section_enum && !statement->input_section.ifile->just_syms_flag) @@ -90,10 +83,8 @@ arm_elf_set_bfd_for_interworking (statement) } } -static void arm_elf_before_allocation PARAMS ((void)); - static void -arm_elf_before_allocation () +arm_elf_before_allocation (void) { bfd *tem; @@ -138,10 +129,8 @@ arm_elf_before_allocation () bfd_elf32_arm_allocate_interworking_sections (& link_info); } -static void arm_elf_finish PARAMS ((void)); - static void -arm_elf_finish () +arm_elf_finish (void) { struct bfd_link_hash_entry * h; @@ -150,7 +139,7 @@ arm_elf_finish () if (thumb_entry_symbol == NULL) return; - + h = bfd_link_hash_lookup (link_info.hash, thumb_entry_symbol, FALSE, FALSE, TRUE); @@ -161,21 +150,21 @@ arm_elf_finish () { static char buffer[32]; bfd_vma val; - + /* Special procesing is required for a Thumb entry symbol. The bottom bit of its address must be set. */ val = (h->u.def.value + bfd_get_section_vma (output_bfd, h->u.def.section->output_section) + h->u.def.section->output_offset); - + val |= 1; /* Now convert this value into a string and store it in entry_symbol - where the lang_finish() function will pick it up. */ + where the lang_finish() function will pick it up. */ buffer[0] = '0'; buffer[1] = 'x'; - + sprintf_vma (buffer + 2, val); if (entry_symbol.name != NULL && entry_from_cmdline) diff --git a/ld/emultempl/armelf_oabi.em b/ld/emultempl/armelf_oabi.em index 99b18cd..f556551 100644 --- a/ld/emultempl/armelf_oabi.em +++ b/ld/emultempl/armelf_oabi.em @@ -47,13 +47,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "ldfile.h" #include "ldemul.h" -static void gld${EMULATION_NAME}_before_parse PARAMS ((void)); -static void gld${EMULATION_NAME}_before_allocation PARAMS ((void)); -static char *gld${EMULATION_NAME}_get_script PARAMS ((int *isfile)); -static void gld${EMULATION_NAME}_after_open PARAMS ((void)); - static void -gld${EMULATION_NAME}_before_parse () +gld${EMULATION_NAME}_before_parse (void) { #ifndef TARGET_ /* I.e., if not generic. */ ldfile_set_output_arch ("`echo ${ARCH}`"); @@ -64,7 +59,7 @@ gld${EMULATION_NAME}_before_parse () sections, but before any sizes or addresses have been set. */ static void -gld${EMULATION_NAME}_before_allocation () +gld${EMULATION_NAME}_before_allocation (void) { /* we should be able to set the size of the interworking stub section */ @@ -86,7 +81,7 @@ gld${EMULATION_NAME}_before_allocation () } static void -gld${EMULATION_NAME}_after_open () +gld${EMULATION_NAME}_after_open (void) { LANG_FOR_EACH_INPUT_STATEMENT (is) @@ -98,8 +93,7 @@ gld${EMULATION_NAME}_after_open () } static char * -gld${EMULATION_NAME}_get_script (isfile) - int *isfile; +gld${EMULATION_NAME}_get_script (int *isfile) EOF if test -n "$COMPILE_IN" @@ -110,7 +104,7 @@ then sc="-f stringify.sed" cat >>e${EMULATION_NAME}.c <<EOF -{ +{ *isfile = 0; if (link_info.relocatable && config.build_constructors) @@ -131,7 +125,7 @@ else # Scripts read from the filesystem. cat >>e${EMULATION_NAME}.c <<EOF -{ +{ *isfile = 1; if (link_info.relocatable && config.build_constructors) @@ -151,7 +145,7 @@ fi cat >>e${EMULATION_NAME}.c <<EOF -struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation = +struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation = { gld${EMULATION_NAME}_before_parse, syslib_default, diff --git a/ld/emultempl/beos.em b/ld/emultempl/beos.em index 23b9dc5..619e692 100644 --- a/ld/emultempl/beos.em +++ b/ld/emultempl/beos.em @@ -51,33 +51,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define TARGET_IS_${EMULATION_NAME} -static void gld_${EMULATION_NAME}_set_symbols PARAMS ((void)); -static void gld_${EMULATION_NAME}_after_open PARAMS ((void)); -static void gld_${EMULATION_NAME}_before_parse PARAMS ((void)); -static void gld_${EMULATION_NAME}_before_allocation PARAMS ((void)); -static bfd_boolean gld${EMULATION_NAME}_place_orphan - PARAMS ((lang_input_statement_type *, asection *)); -static char *gld_${EMULATION_NAME}_get_script PARAMS ((int *)); - -static int sort_by_file_name PARAMS ((const PTR, const PTR)); -static int sort_by_section_name PARAMS ((const PTR, const PTR)); -static lang_statement_union_type **sort_sections_1 - PARAMS ((lang_statement_union_type **, lang_statement_union_type *, int, - int (*) PARAMS((const PTR, const PTR)))); -static void sort_sections PARAMS ((lang_statement_union_type *)); - -static void set_pe_name PARAMS ((char *, long int)); -static void set_pe_subsystem PARAMS ((void)); -static void set_pe_value PARAMS ((char *)); -static void set_pe_stack_heap PARAMS ((char *, char *)); - static struct internal_extra_pe_aouthdr pe; static int dll; extern const char *output_filename; static void -gld_${EMULATION_NAME}_before_parse() +gld_${EMULATION_NAME}_before_parse (void) { const bfd_arch_info_type *arch = bfd_scan_arch ("${OUTPUT_ARCH}"); if (arch) @@ -109,17 +89,11 @@ gld_${EMULATION_NAME}_before_parse() #define OPTION_SUBSYSTEM (OPTION_STACK + 1) #define OPTION_HEAP (OPTION_SUBSYSTEM + 1) -static void gld${EMULATION_NAME}_add_options - PARAMS ((int, char **, int, struct option **, int, struct option **)); - static void -gld${EMULATION_NAME}_add_options (ns, shortopts, nl, longopts, nrl, really_longopts) - int ns ATTRIBUTE_UNUSED; - char **shortopts ATTRIBUTE_UNUSED; - int nl; - struct option **longopts; - int nrl ATTRIBUTE_UNUSED; - struct option **really_longopts ATTRIBUTE_UNUSED; +gld${EMULATION_NAME}_add_options + (int ns ATTRIBUTE_UNUSED, char **shortopts ATTRIBUTE_UNUSED, int nl, + struct option **longopts, int nrl ATTRIBUTE_UNUSED, + struct option **really_longopts ATTRIBUTE_UNUSED) { static const struct option xtra_long[] = { /* PE options */ @@ -185,9 +159,7 @@ static definfo init[] = static void -set_pe_name (name, val) - char *name; - long val; +set_pe_name (char *name, long val) { int i; /* Find the name and set it. */ @@ -205,7 +177,7 @@ set_pe_name (name, val) static void -set_pe_subsystem () +set_pe_subsystem (void) { const char *sver; int len; @@ -281,11 +253,8 @@ set_pe_subsystem () } - static void -set_pe_value (name) - char *name; - +set_pe_value (char *name) { char *end; set_pe_name (name, strtoul (optarg, &end, 0)); @@ -298,9 +267,7 @@ set_pe_value (name) } static void -set_pe_stack_heap (resname, comname) - char *resname; - char *comname; +set_pe_stack_heap (char *resname, char *comname) { set_pe_value (resname); if (*optarg == ',') @@ -315,12 +282,8 @@ set_pe_stack_heap (resname, comname) } -static bfd_boolean gld${EMULATION_NAME}_handle_option - PARAMS ((int)); - static bfd_boolean -gld${EMULATION_NAME}_handle_option (optc) - int optc; +gld${EMULATION_NAME}_handle_option (int optc) { switch (optc) { @@ -328,7 +291,7 @@ gld${EMULATION_NAME}_handle_option (optc) return FALSE; 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) { fprintf (stderr, "%s: Can't open base file %s\n", @@ -385,7 +348,7 @@ gld${EMULATION_NAME}_handle_option (optc) read. */ static void -gld_${EMULATION_NAME}_set_symbols() +gld_${EMULATION_NAME}_set_symbols (void) { /* Run through and invent symbols for all the names and insert the defaults. */ @@ -437,7 +400,7 @@ gld_${EMULATION_NAME}_set_symbols() } static void -gld_${EMULATION_NAME}_after_open() +gld_${EMULATION_NAME}_after_open (void) { /* Pass the wacky PE command line options into the output bfd. FIXME: This should be done via a function, rather than by @@ -455,9 +418,7 @@ gld_${EMULATION_NAME}_after_open() /* Callback functions for qsort in sort_sections. */ static int -sort_by_file_name (a, b) - const PTR a; - const PTR b; +sort_by_file_name (const void *a, const void *b) { const lang_statement_union_type *const *ra = a; const lang_statement_union_type *const *rb = b; @@ -512,9 +473,7 @@ return 0; } static int -sort_by_section_name (a, b) - const PTR a; - const PTR b; +sort_by_section_name (const void *a, const void *b) { const lang_statement_union_type *const *ra = a; const lang_statement_union_type *const *rb = b; @@ -539,10 +498,10 @@ sort_by_section_name (a, b) The result is a pointer to the last element's "next" pointer. */ static lang_statement_union_type ** -sort_sections_1 (startptr, next_after, count, sort_func) - lang_statement_union_type **startptr,*next_after; - int count; - int (*sort_func) PARAMS ((const PTR, const PTR)); +sort_sections_1 (lang_statement_union_type **startptr, + lang_statement_union_type *next_after, + int count, + int (*sort_func) (const void *, const void *)) { lang_statement_union_type **vec; lang_statement_union_type *p; @@ -585,8 +544,7 @@ sort_sections_1 (startptr, next_after, count, sort_func) place_orphans routine to implement grouped sections. */ static void -sort_sections (s) - lang_statement_union_type *s; +sort_sections (lang_statement_union_type *s) { for (; s ; s = s->header.next) switch (s->header.type) @@ -673,7 +631,7 @@ sort_sections (s) } static void -gld_${EMULATION_NAME}_before_allocation() +gld_${EMULATION_NAME}_before_allocation (void) { extern lang_statement_list_type *stat_ptr; @@ -730,9 +688,7 @@ gld_${EMULATION_NAME}_before_allocation() /*ARGSUSED*/ static bfd_boolean -gld${EMULATION_NAME}_place_orphan (file, s) - lang_input_statement_type *file; - asection *s; +gld${EMULATION_NAME}_place_orphan (lang_input_statement_type *file, asection *s) { const char *secname; char *output_secname, *ps; @@ -821,8 +777,7 @@ gld${EMULATION_NAME}_place_orphan (file, s) } static char * -gld_${EMULATION_NAME}_get_script(isfile) - int *isfile; +gld_${EMULATION_NAME}_get_script (int *isfile) EOF # Scripts compiled in. # sed commands to quote an ld script as a C string. diff --git a/ld/emultempl/elf32.em b/ld/emultempl/elf32.em index 85ca351..dd9c15b 100644 --- a/ld/emultempl/elf32.em +++ b/ld/emultempl/elf32.em @@ -53,38 +53,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include <ldgram.h> #include "elf/common.h" -static void gld${EMULATION_NAME}_before_parse - PARAMS ((void)); -static void gld${EMULATION_NAME}_vercheck - PARAMS ((lang_input_statement_type *)); -static void gld${EMULATION_NAME}_stat_needed - PARAMS ((lang_input_statement_type *)); -static bfd_boolean gld${EMULATION_NAME}_try_needed - PARAMS ((const char *, int)); -static bfd_boolean gld${EMULATION_NAME}_search_needed - PARAMS ((const char *, const char *, int)); -static void gld${EMULATION_NAME}_check_needed - PARAMS ((lang_input_statement_type *)); -static void gld${EMULATION_NAME}_after_open - PARAMS ((void)); -static void gld${EMULATION_NAME}_find_exp_assignment - PARAMS ((etree_type *)); -static void gld${EMULATION_NAME}_find_statement_assignment - PARAMS ((lang_statement_union_type *)); -static void gld${EMULATION_NAME}_before_allocation - PARAMS ((void)); -static bfd_boolean gld${EMULATION_NAME}_open_dynamic_archive - PARAMS ((const char *, search_dirs_type *, lang_input_statement_type *)); -static lang_output_section_statement_type *output_rel_find - PARAMS ((asection *)); -static asection *output_prev_sec_find - PARAMS ((lang_output_section_statement_type *)); +/* Declare functions used by various EXTRA_EM_FILEs. */ +static void gld${EMULATION_NAME}_before_parse (void); +static void gld${EMULATION_NAME}_after_open (void); +static void gld${EMULATION_NAME}_before_allocation (void); static bfd_boolean gld${EMULATION_NAME}_place_orphan - PARAMS ((lang_input_statement_type *, asection *)); -static void gld${EMULATION_NAME}_finish - PARAMS ((void)); -static char *gld${EMULATION_NAME}_get_script - PARAMS ((int *isfile)); + (lang_input_statement_type *file, asection *s); +static void gld${EMULATION_NAME}_finish (void); EOF @@ -104,7 +79,7 @@ if test x"$LDEMUL_BEFORE_PARSE" != xgld"$EMULATION_NAME"_before_parse; then cat >>e${EMULATION_NAME}.c <<EOF static void -gld${EMULATION_NAME}_before_parse () +gld${EMULATION_NAME}_before_parse (void) { const bfd_arch_info_type *arch = bfd_scan_arch ("${OUTPUT_ARCH}"); if (arch) @@ -152,8 +127,7 @@ static bfd_boolean global_vercheck_failed; a conflicting version. */ static void -gld${EMULATION_NAME}_vercheck (s) - lang_input_statement_type *s; +gld${EMULATION_NAME}_vercheck (lang_input_statement_type *s) { const char *soname; struct bfd_link_needed_list *l; @@ -190,10 +164,10 @@ gld${EMULATION_NAME}_vercheck (s) if (strncmp (soname, l->name, suffix - l->name) == 0) { /* Here we know that S is a dynamic object FOO.SO.VER1, and - the object we are considering needs a dynamic object - FOO.SO.VER2, and VER1 and VER2 are different. This - appears to be a version mismatch, so we tell the caller - to try a different version of this library. */ + the object we are considering needs a dynamic object + FOO.SO.VER2, and VER1 and VER2 are different. This + appears to be a version mismatch, so we tell the caller + to try a different version of this library. */ global_vercheck_failed = TRUE; return; } @@ -205,8 +179,7 @@ gld${EMULATION_NAME}_vercheck (s) the file. */ static void -gld${EMULATION_NAME}_stat_needed (s) - lang_input_statement_type *s; +gld${EMULATION_NAME}_stat_needed (lang_input_statement_type *s) { struct stat st; const char *suffix; @@ -261,9 +234,7 @@ gld${EMULATION_NAME}_stat_needed (s) to skip the check for a conflicting version. */ static bfd_boolean -gld${EMULATION_NAME}_try_needed (name, force) - const char *name; - int force; +gld${EMULATION_NAME}_try_needed (const char *name, int force) { bfd *abfd; const char *soname; @@ -310,16 +281,16 @@ gld${EMULATION_NAME}_try_needed (name, force) { bfd_close (abfd); /* Return FALSE to force the caller to move on to try - another file on the search path. */ + another file on the search path. */ return FALSE; } /* But wait! It gets much worse. On Linux, if a shared - library does not use libc at all, we are supposed to skip - it the first time around in case we encounter a shared - library later on with the same name which does use the - version of libc that we want. This is much too horrible - to use on any system other than Linux. */ + library does not use libc at all, we are supposed to skip + it the first time around in case we encounter a shared + library later on with the same name which does use the + version of libc that we want. This is much too horrible + to use on any system other than Linux. */ EOF case ${target} in @@ -369,7 +340,7 @@ cat >>e${EMULATION_NAME}.c <<EOF if (global_found) { /* Return TRUE to indicate that we found the file, even though - we aren't going to do anything with it. */ + we aren't going to do anything with it. */ return TRUE; } @@ -393,10 +364,7 @@ cat >>e${EMULATION_NAME}.c <<EOF /* Search for a needed file in a path. */ static bfd_boolean -gld${EMULATION_NAME}_search_needed (path, name, force) - const char *path; - const char *name; - int force; +gld${EMULATION_NAME}_search_needed (const char *path, const char *name, int force) { const char *s; size_t len; @@ -445,11 +413,8 @@ if [ "x${USE_LIBPATH}" = xyes ] ; then /* Add the sysroot to every entry in a colon-separated path. */ -static char * gld${EMULATION_NAME}_add_sysroot PARAMS ((const char *)); - static char * -gld${EMULATION_NAME}_add_sysroot (path) - const char *path; +gld${EMULATION_NAME}_add_sysroot (const char *path) { int len, colons, i; char *ret, *p; @@ -472,7 +437,7 @@ gld${EMULATION_NAME}_add_sysroot (path) while (path[i]) if (path[i] == ':') { - *p++ = path[i++]; + *p++ = path[i++]; strcpy (p, ld_sysroot); p = p + strlen (p); } @@ -491,13 +456,8 @@ EOF in which we may find shared libraries. /etc/ld.so.conf is really only meaningful on Linux. */ -static bfd_boolean gld${EMULATION_NAME}_check_ld_so_conf - PARAMS ((const char *, int)); - static bfd_boolean -gld${EMULATION_NAME}_check_ld_so_conf (name, force) - const char *name; - int force; +gld${EMULATION_NAME}_check_ld_so_conf (const char *name, int force) { static bfd_boolean initialized; static char *ld_so_conf; @@ -588,8 +548,7 @@ cat >>e${EMULATION_NAME}.c <<EOF /* See if an input file matches a DT_NEEDED entry by name. */ static void -gld${EMULATION_NAME}_check_needed (s) - lang_input_statement_type *s; +gld${EMULATION_NAME}_check_needed (lang_input_statement_type *s) { if (global_found) return; @@ -638,7 +597,7 @@ cat >>e${EMULATION_NAME}.c <<EOF /* This is called after all the input files have been opened. */ static void -gld${EMULATION_NAME}_after_open () +gld${EMULATION_NAME}_after_open (void) { struct bfd_link_needed_list *needed, *l; @@ -794,8 +753,7 @@ cat >>e${EMULATION_NAME}.c <<EOF /* Look through an expression for an assignment statement. */ static void -gld${EMULATION_NAME}_find_exp_assignment (exp) - etree_type *exp; +gld${EMULATION_NAME}_find_exp_assignment (etree_type *exp) { struct bfd_link_hash_entry *h; @@ -855,8 +813,7 @@ gld${EMULATION_NAME}_find_exp_assignment (exp) symbols which are referred to by dynamic objects. */ static void -gld${EMULATION_NAME}_find_statement_assignment (s) - lang_statement_union_type *s; +gld${EMULATION_NAME}_find_statement_assignment (lang_statement_union_type *s) { if (s->header.type == lang_assignment_statement_enum) gld${EMULATION_NAME}_find_exp_assignment (s->assignment_statement.exp); @@ -883,7 +840,7 @@ cat >>e${EMULATION_NAME}.c <<EOF sections, but before any sizes or addresses have been set. */ static void -gld${EMULATION_NAME}_before_allocation () +gld${EMULATION_NAME}_before_allocation (void) { const char *rpath; asection *sinterp; @@ -899,7 +856,7 @@ gld${EMULATION_NAME}_before_allocation () if (rpath == NULL) rpath = (const char *) getenv ("LD_RUN_PATH"); if (! (bfd_elf${ELFSIZE}_size_dynamic_sections - (output_bfd, command_line.soname, rpath, + (output_bfd, command_line.soname, rpath, command_line.filter_shlib, (const char * const *) command_line.auxiliary_filters, &link_info, &sinterp, lang_elf_version_info))) @@ -964,10 +921,8 @@ cat >>e${EMULATION_NAME}.c <<EOF like hpux). */ static bfd_boolean -gld${EMULATION_NAME}_open_dynamic_archive (arch, search, entry) - const char *arch; - search_dirs_type *search; - lang_input_statement_type *entry; +gld${EMULATION_NAME}_open_dynamic_archive + (const char *arch, search_dirs_type *search, lang_input_statement_type *entry) { const char *filename; char *string; @@ -1043,8 +998,7 @@ cat >>e${EMULATION_NAME}.c <<EOF /* A variant of lang_output_section_find. Used by place_orphan. */ static lang_output_section_statement_type * -output_rel_find (sec) - asection *sec; +output_rel_find (asection *sec) { lang_statement_union_type *u; lang_output_section_statement_type *lookup; @@ -1089,8 +1043,7 @@ output_rel_find (sec) Used by place_orphan. */ static asection * -output_prev_sec_find (os) - lang_output_section_statement_type *os; +output_prev_sec_find (lang_output_section_statement_type *os) { asection *s = (asection *) NULL; lang_statement_union_type *u; @@ -1122,9 +1075,7 @@ struct orphan_save { }; static bfd_boolean -gld${EMULATION_NAME}_place_orphan (file, s) - lang_input_statement_type *file; - asection *s; +gld${EMULATION_NAME}_place_orphan (lang_input_statement_type *file, asection *s) { static struct orphan_save hold_text; static struct orphan_save hold_rodata; @@ -1422,7 +1373,7 @@ if test x"$LDEMUL_FINISH" != xgld"$EMULATION_NAME"_finish; then cat >>e${EMULATION_NAME}.c <<EOF static void -gld${EMULATION_NAME}_finish () +gld${EMULATION_NAME}_finish (void) { if (bfd_elf${ELFSIZE}_discard_info (output_bfd, &link_info)) { @@ -1447,8 +1398,7 @@ if test x"$LDEMUL_GET_SCRIPT" != xgld"$EMULATION_NAME"_get_script; then cat >>e${EMULATION_NAME}.c <<EOF static char * -gld${EMULATION_NAME}_get_script (isfile) - int *isfile; +gld${EMULATION_NAME}_get_script (int *isfile) EOF if test -n "$COMPILE_IN" @@ -1573,17 +1523,10 @@ cat >>e${EMULATION_NAME}.c <<EOF #define OPTION_GROUP (OPTION_ENABLE_NEW_DTAGS + 1) #define OPTION_EH_FRAME_HDR (OPTION_GROUP + 1) -static void gld${EMULATION_NAME}_add_options - PARAMS ((int, char **, int, struct option **, int, struct option **)); - static void -gld${EMULATION_NAME}_add_options (ns, shortopts, nl, longopts, nrl, really_longopts) - int ns; - char **shortopts; - int nl; - struct option **longopts; - int nrl ATTRIBUTE_UNUSED; - struct option **really_longopts ATTRIBUTE_UNUSED; +gld${EMULATION_NAME}_add_options + (int ns, char **shortopts, int nl, struct option **longopts, + int nrl ATTRIBUTE_UNUSED, struct option **really_longopts ATTRIBUTE_UNUSED) { static const char xtra_short[] = "${PARSE_AND_LIST_SHORTOPTS}z:"; static const struct option xtra_long[] = { @@ -1615,12 +1558,8 @@ cat >>e${EMULATION_NAME}.c <<EOF memcpy (*longopts + nl, &xtra_long, sizeof (xtra_long)); } -static bfd_boolean gld${EMULATION_NAME}_handle_option - PARAMS ((int)); - static bfd_boolean -gld${EMULATION_NAME}_handle_option (optc) - int optc; +gld${EMULATION_NAME}_handle_option (int optc) { switch (optc) { @@ -1683,7 +1622,7 @@ cat >>e${EMULATION_NAME}.c <<EOF else if (strcmp (optarg, "nocombreloc") == 0) link_info.combreloc = FALSE; else if (strcmp (optarg, "nocopyreloc") == 0) - link_info.nocopyreloc = TRUE; + link_info.nocopyreloc = TRUE; else if (strcmp (optarg, "execstack") == 0) { link_info.execstack = TRUE; @@ -1716,11 +1655,8 @@ EOF if test x"$LDEMUL_LIST_OPTIONS" != xgld"$EMULATION_NAME"_list_options; then cat >>e${EMULATION_NAME}.c <<EOF -static void gld${EMULATION_NAME}_list_options PARAMS ((FILE * file)); - static void -gld${EMULATION_NAME}_list_options (file) - FILE * file; +gld${EMULATION_NAME}_list_options (FILE * file) { EOF diff --git a/ld/emultempl/generic.em b/ld/emultempl/generic.em index 611a948..c33d86b 100644 --- a/ld/emultempl/generic.em +++ b/ld/emultempl/generic.em @@ -39,9 +39,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "ldfile.h" #include "ldemul.h" -static void gld${EMULATION_NAME}_before_parse PARAMS ((void)); -static char *gld${EMULATION_NAME}_get_script PARAMS ((int *isfile)); - EOF # Import any needed special functions and/or overrides. @@ -54,7 +51,7 @@ if test x"$LDEMUL_BEFORE_PARSE" != xgld"$EMULATION_NAME"_before_parse; then cat >>e${EMULATION_NAME}.c <<EOF static void -gld${EMULATION_NAME}_before_parse() +gld${EMULATION_NAME}_before_parse (void) { #ifndef TARGET_ /* I.e., if not generic. */ ldfile_set_output_arch ("`echo ${ARCH}`"); @@ -68,8 +65,7 @@ if test x"$LDEMUL_GET_SCRIPT" != xgld"$EMULATION_NAME"_get_script; then cat >>e${EMULATION_NAME}.c <<EOF static char * -gld${EMULATION_NAME}_get_script(isfile) - int *isfile; +gld${EMULATION_NAME}_get_script (int *isfile) EOF if test -n "$COMPILE_IN" @@ -80,7 +76,7 @@ then sc="-f stringify.sed" cat >>e${EMULATION_NAME}.c <<EOF -{ +{ *isfile = 0; if (link_info.relocatable && config.build_constructors) @@ -101,7 +97,7 @@ else # Scripts read from the filesystem. cat >>e${EMULATION_NAME}.c <<EOF -{ +{ *isfile = 1; if (link_info.relocatable && config.build_constructors) @@ -121,7 +117,7 @@ fi cat >>e${EMULATION_NAME}.c <<EOF -struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation = +struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation = { ${LDEMUL_BEFORE_PARSE-gld${EMULATION_NAME}_before_parse}, ${LDEMUL_SYSLIB-syslib_default}, diff --git a/ld/emultempl/gld960.em b/ld/emultempl/gld960.em index e9ef7e5..9b93bac 100644 --- a/ld/emultempl/gld960.em +++ b/ld/emultempl/gld960.em @@ -20,7 +20,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. */ -/* +/* * emulate the Intels port of gld */ @@ -39,15 +39,10 @@ the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307 #include "ldfile.h" #include "ldemul.h" -static void gld960_before_parse PARAMS ((void)); -static char *gld960_choose_target PARAMS ((int, char **)); -static void gld960_set_output_arch PARAMS ((void)); -static char *gld960_get_script PARAMS ((int *)); - #ifdef GNU960 static void -gld960_before_parse() +gld960_before_parse (void) { static char *env_variables[] = { "G960LIB", "G960BASE", 0 }; char **p; @@ -67,7 +62,7 @@ gld960_before_parse() #else /* not GNU960 */ -static void gld960_before_parse() +static void gld960_before_parse (void) { char *env ; env = getenv("G960LIB"); @@ -84,15 +79,13 @@ static void gld960_before_parse() static void -gld960_set_output_arch() +gld960_set_output_arch (void) { bfd_set_arch_mach(output_bfd, ldfile_output_architecture, bfd_mach_i960_core); } static char * -gld960_choose_target (argc, argv) - int argc ATTRIBUTE_UNUSED; - char **argv ATTRIBUTE_UNUSED; +gld960_choose_target (int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) { #ifdef GNU960 @@ -113,8 +106,7 @@ gld960_choose_target (argc, argv) } static char * -gld960_get_script(isfile) - int *isfile; +gld960_get_script (int *isfile) EOF if test -n "$COMPILE_IN" @@ -125,7 +117,7 @@ then sc="-f stringify.sed" cat >>e${EMULATION_NAME}.c <<EOF -{ +{ *isfile = 0; if (link_info.relocatable && config.build_constructors) @@ -146,7 +138,7 @@ else # Scripts read from the filesystem. cat >>e${EMULATION_NAME}.c <<EOF -{ +{ *isfile = 1; if (link_info.relocatable && config.build_constructors) @@ -166,7 +158,7 @@ fi cat >>e${EMULATION_NAME}.c <<EOF -struct ld_emulation_xfer_struct ld_gld960_emulation = +struct ld_emulation_xfer_struct ld_gld960_emulation = { gld960_before_parse, syslib_default, diff --git a/ld/emultempl/gld960c.em b/ld/emultempl/gld960c.em index 160eb2a..89e75ae 100644 --- a/ld/emultempl/gld960c.em +++ b/ld/emultempl/gld960c.em @@ -41,15 +41,10 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "ldfile.h" #include "ldemul.h" -static void gld960_before_parse PARAMS ((void)); -static void gld960_set_output_arch PARAMS ((void)); -static char *gld960_choose_target PARAMS ((int, char **)); -static char *gld960_get_script PARAMS ((int *)); - #ifdef GNU960 static void -gld960_before_parse() +gld960_before_parse (void) { static char *env_variables[] = { "G960LIB", "G960BASE", 0 }; char **p; @@ -69,7 +64,7 @@ gld960_before_parse() #else /* not GNU960 */ -static void gld960_before_parse() +static void gld960_before_parse (void) { char *env ; env = getenv("G960LIB"); @@ -87,7 +82,7 @@ static void gld960_before_parse() static void -gld960_set_output_arch() +gld960_set_output_arch (void) { if (ldfile_output_machine_name != NULL && *ldfile_output_machine_name != '\0') @@ -105,9 +100,7 @@ gld960_set_output_arch() } static char * -gld960_choose_target (argc, argv) - int argc ATTRIBUTE_UNUSED; - char **argv ATTRIBUTE_UNUSED; +gld960_choose_target (int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) { #ifdef GNU960 @@ -128,8 +121,7 @@ gld960_choose_target (argc, argv) } static char * -gld960_get_script(isfile) - int *isfile; +gld960_get_script (int *isfile) EOF if test -n "$COMPILE_IN" diff --git a/ld/emultempl/hppaelf.em b/ld/emultempl/hppaelf.em index 456e17c..1ee43ac 100644 --- a/ld/emultempl/hppaelf.em +++ b/ld/emultempl/hppaelf.em @@ -27,14 +27,6 @@ cat >>e${EMULATION_NAME}.c <<EOF #include "ldctor.h" #include "elf32-hppa.h" -static void hppaelf_after_parse PARAMS ((void)); -static void hppaelf_create_output_section_statements PARAMS ((void)); -static asection *hppaelf_add_stub_section - PARAMS ((const char *, asection *)); -static void hppaelf_layout_sections_again PARAMS ((void)); -static void gld${EMULATION_NAME}_finish PARAMS ((void)); -static void build_section_lists PARAMS ((lang_statement_union_type *)); - /* Fake input file for stubs. */ static lang_input_statement_type *stub_file; @@ -56,7 +48,7 @@ static bfd_signed_vma group_size = 1; and adds millicode library to the list of input files. */ static void -hppaelf_after_parse () +hppaelf_after_parse (void) { if (link_info.relocatable) lang_add_unique (".text"); @@ -72,7 +64,7 @@ hppaelf_after_parse () fake input file to hold the stub sections. */ static void -hppaelf_create_output_section_statements () +hppaelf_create_output_section_statements (void) { stub_file = lang_add_input_file ("linker stubs", lang_input_file_is_fake_enum, @@ -99,13 +91,8 @@ struct hook_stub_info /* Traverse the linker tree to find the spot where the stub goes. */ -static bfd_boolean hook_in_stub - PARAMS ((struct hook_stub_info *, lang_statement_union_type **)); - static bfd_boolean -hook_in_stub (info, lp) - struct hook_stub_info *info; - lang_statement_union_type **lp; +hook_in_stub (struct hook_stub_info *info, lang_statement_union_type **lp) { lang_statement_union_type *l; bfd_boolean ret; @@ -177,9 +164,7 @@ hook_in_stub (info, lp) immediately before INPUT_SECTION. */ static asection * -hppaelf_add_stub_section (stub_sec_name, input_section) - const char *stub_sec_name; - asection *input_section; +hppaelf_add_stub_section (const char *stub_sec_name, asection *input_section) { asection *stub_sec; flagword flags; @@ -220,7 +205,7 @@ hppaelf_add_stub_section (stub_sec_name, input_section) /* Another call-back for elf32_hppa_size_stubs. */ static void -hppaelf_layout_sections_again () +hppaelf_layout_sections_again (void) { /* If we have changed sizes of the stub sections, then we need to recalculate all the section offsets. This may mean we need to @@ -243,8 +228,7 @@ hppaelf_layout_sections_again () static void -build_section_lists (statement) - lang_statement_union_type *statement; +build_section_lists (lang_statement_union_type *statement) { if (statement->header.type == lang_input_section_enum && !statement->input_section.ifile->just_syms_flag @@ -261,7 +245,7 @@ build_section_lists (statement) to build linker stubs. */ static void -gld${EMULATION_NAME}_finish () +gld${EMULATION_NAME}_finish (void) { /* bfd_elf32_discard_info just plays with debugging sections, ie. doesn't affect any code, so we can delay resizing the @@ -326,23 +310,16 @@ gld${EMULATION_NAME}_finish () /* Avoid processing the fake stub_file in vercheck, stat_needed and check_needed routines. */ -static void hppa_for_each_input_file_wrapper - PARAMS ((lang_input_statement_type *)); -static void hppa_lang_for_each_input_file - PARAMS ((void (*) (lang_input_statement_type *))); - -static void (*real_func) PARAMS ((lang_input_statement_type *)); +static void (*real_func) (lang_input_statement_type *); -static void hppa_for_each_input_file_wrapper (l) - lang_input_statement_type *l; +static void hppa_for_each_input_file_wrapper (lang_input_statement_type *l) { if (l != stub_file) (*real_func) (l); } static void -hppa_lang_for_each_input_file (func) - void (*func) PARAMS ((lang_input_statement_type *)); +hppa_lang_for_each_input_file (void (*func) (lang_input_statement_type *)) { real_func = func; lang_for_each_input_file (&hppa_for_each_input_file_wrapper); diff --git a/ld/emultempl/linux.em b/ld/emultempl/linux.em index ce7f3b6f..b48549d 100644 --- a/ld/emultempl/linux.em +++ b/ld/emultempl/linux.em @@ -44,18 +44,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "ldfile.h" #include "ldemul.h" -static void gld${EMULATION_NAME}_before_parse PARAMS ((void)); -static bfd_boolean gld${EMULATION_NAME}_open_dynamic_archive - PARAMS ((const char *, search_dirs_type *, lang_input_statement_type *)); -static void gld${EMULATION_NAME}_find_address_statement - PARAMS ((lang_statement_union_type *)); -static void gld${EMULATION_NAME}_create_output_section_statements - PARAMS ((void)); -static void gld${EMULATION_NAME}_before_allocation PARAMS ((void)); -static char *gld${EMULATION_NAME}_get_script PARAMS ((int *isfile)); - static void -gld${EMULATION_NAME}_before_parse() +gld${EMULATION_NAME}_before_parse (void) { const bfd_arch_info_type *arch = bfd_scan_arch ("${OUTPUT_ARCH}"); if (arch) @@ -74,10 +64,8 @@ gld${EMULATION_NAME}_before_parse() dynamic libraries have an extension of .sa. */ static bfd_boolean -gld${EMULATION_NAME}_open_dynamic_archive (arch, search, entry) - const char *arch; - search_dirs_type *search; - lang_input_statement_type *entry; +gld${EMULATION_NAME}_open_dynamic_archive + (const char *arch, search_dirs_type *search, lang_input_statement_type *entry) { char *string; @@ -110,8 +98,7 @@ gld${EMULATION_NAME}_open_dynamic_archive (arch, search, entry) Linux tools. */ static void -gld${EMULATION_NAME}_find_address_statement (s) - lang_statement_union_type *s; +gld${EMULATION_NAME}_find_address_statement (lang_statement_union_type *s) { if (s->header.type == lang_address_statement_enum && strcmp (s->address_statement.section_name, ".text") == 0) @@ -124,7 +111,7 @@ gld${EMULATION_NAME}_find_address_statement (s) /* This is called before opening the input BFD's. */ static void -gld${EMULATION_NAME}_create_output_section_statements () +gld${EMULATION_NAME}_create_output_section_statements (void) { lang_for_each_statement (gld${EMULATION_NAME}_find_address_statement); } @@ -133,7 +120,7 @@ gld${EMULATION_NAME}_create_output_section_statements () sections, but before any sizes or addresses have been set. */ static void -gld${EMULATION_NAME}_before_allocation () +gld${EMULATION_NAME}_before_allocation (void) { if (link_info.relocatable) return; @@ -145,8 +132,7 @@ gld${EMULATION_NAME}_before_allocation () } static char * -gld${EMULATION_NAME}_get_script(isfile) - int *isfile; +gld${EMULATION_NAME}_get_script (int *isfile) EOF if test -n "$COMPILE_IN" diff --git a/ld/emultempl/lnk960.em b/ld/emultempl/lnk960.em index 56facaa..2c294ec 100644 --- a/ld/emultempl/lnk960.em +++ b/ld/emultempl/lnk960.em @@ -47,23 +47,9 @@ static lib_list_type **hll_list_tail = &hll_list; static lib_list_type *syslib_list; static lib_list_type **syslib_list_tail = &syslib_list; -static void append PARAMS ((lib_list_type ***, char *)); -static void lnk960_hll PARAMS ((char *)); -static void lnk960_syslib PARAMS ((char *)); -static void lnk960_before_parse PARAMS ((void)); -static void add_on PARAMS ((lib_list_type *, lang_input_file_enum_type)); -static void lnk960_after_parse PARAMS ((void)); -static void lnk960_before_allocation PARAMS ((void)); -static void lnk960_after_allocation PARAMS ((void)); -static void lnk960_set_output_arch PARAMS ((void)); -static char *lnk960_choose_target PARAMS ((int, char **)); -static char *lnk960_get_script PARAMS ((int *)); - static void -append (list, name) - lib_list_type ***list; - char *name; +append (lib_list_type ***list, char *name) { lib_list_type *element = (lib_list_type *) xmalloc (sizeof (lib_list_type)); @@ -78,8 +64,7 @@ static bfd_boolean had_hll = FALSE; static bfd_boolean had_hll_name = FALSE; static void -lnk960_hll (name) - char *name; +lnk960_hll (char *name) { had_hll = TRUE; if (name != (char *) NULL) @@ -89,9 +74,8 @@ lnk960_hll (name) } } -static void -lnk960_syslib (name) - char *name; +static void +lnk960_syslib (char *name) { append (&syslib_list_tail, name); } @@ -99,8 +83,8 @@ lnk960_syslib (name) #ifdef GNU960 -static void -lnk960_before_parse () +static void +lnk960_before_parse (void) { static char *env_variables[] = { "G960LIB", "G960BASE", 0 }; char **p; @@ -123,8 +107,8 @@ lnk960_before_parse () #else /* not GNU960 */ -static void -lnk960_before_parse () +static void +lnk960_before_parse (void) { char *name = getenv ("I960BASE"); @@ -145,9 +129,7 @@ lnk960_before_parse () static void -add_on (list, search) - lib_list_type *list; - lang_input_file_enum_type search; +add_on (lib_list_type *list, lang_input_file_enum_type search) { while (list) { @@ -155,15 +137,16 @@ add_on (list, search) list = list->next; } } + static void -lnk960_after_parse () +lnk960_after_parse (void) { /* If there has been no arch, default to -KB */ if (ldfile_output_machine_name[0] == 0) ldfile_add_arch ("KB"); /* if there has been no hll list then add our own */ - + if (had_hll && !had_hll_name) { append (&hll_list_tail, "cg"); @@ -171,18 +154,18 @@ lnk960_after_parse () || ldfile_output_machine == bfd_mach_i960_ca) append (&hll_list_tail, "fpg"); } - + add_on (hll_list, lang_input_file_is_l_enum); add_on (syslib_list, lang_input_file_is_search_file_enum); } static void -lnk960_before_allocation () +lnk960_before_allocation (void) { } static void -lnk960_after_allocation () +lnk960_after_allocation (void) { if (!link_info.relocatable) { @@ -197,7 +180,7 @@ lnk960_after_allocation () static struct { unsigned long number; - char *name; + char *name; } machine_table[] = { @@ -227,7 +210,7 @@ machine_table[] = }; static void -lnk960_set_output_arch () +lnk960_set_output_arch (void) { /* Set the output architecture and machine if possible */ unsigned int i; @@ -245,9 +228,7 @@ lnk960_set_output_arch () } static char * -lnk960_choose_target (argc, argv) - int argc ATTRIBUTE_UNUSED; - char **argv ATTRIBUTE_UNUSED; +lnk960_choose_target (int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) { #ifdef GNU960 @@ -268,8 +249,7 @@ lnk960_choose_target (argc, argv) } static char * -lnk960_get_script (isfile) - int *isfile; +lnk960_get_script (int *isfile) EOF if test -n "$COMPILE_IN" @@ -280,7 +260,7 @@ then sc="-f stringify.sed" cat >>e${EMULATION_NAME}.c <<EOF -{ +{ *isfile = 0; if (link_info.relocatable && config.build_constructors) @@ -301,7 +281,7 @@ else # Scripts read from the filesystem. cat >>e${EMULATION_NAME}.c <<EOF -{ +{ *isfile = 1; if (link_info.relocatable && config.build_constructors) @@ -321,7 +301,7 @@ fi cat >>e${EMULATION_NAME}.c <<EOF -struct ld_emulation_xfer_struct ld_lnk960_emulation = +struct ld_emulation_xfer_struct ld_lnk960_emulation = { lnk960_before_parse, lnk960_syslib, diff --git a/ld/emultempl/m68hc1xelf.em b/ld/emultempl/m68hc1xelf.em index ed059a2..82f9b12 100644 --- a/ld/emultempl/m68hc1xelf.em +++ b/ld/emultempl/m68hc1xelf.em @@ -44,12 +44,7 @@ cat >>e${EMULATION_NAME}.c <<EOF #include "ldctor.h" #include "elf32-m68hc1x.h" -static void m68hc11elf_create_output_section_statements PARAMS ((void)); -static asection *m68hc11elf_add_stub_section - PARAMS ((const char *, asection *)); -static void gld${EMULATION_NAME}_finish PARAMS ((void)); -static void m68hc11_elf_${EMULATION_NAME}_before_allocation PARAMS ((void)); - +static asection *m68hc11elf_add_stub_section (const char *, asection *); /* Fake input file for stubs. */ static lang_input_statement_type *stub_file; @@ -64,7 +59,7 @@ static int no_trampoline = 0; static const char* bank_window_name = 0; static void -m68hc11_elf_${EMULATION_NAME}_before_allocation () +m68hc11_elf_${EMULATION_NAME}_before_allocation (void) { lang_memory_region_type* region; int ret; @@ -87,9 +82,9 @@ m68hc11_elf_${EMULATION_NAME}_before_allocation () /* Call into the BFD backend to do the real work. */ if (!elf32_m68hc11_size_stubs (output_bfd, - stub_file->the_bfd, - &link_info, - &m68hc11elf_add_stub_section)) + stub_file->the_bfd, + &link_info, + &m68hc11elf_add_stub_section)) { einfo ("%X%P: can not size stub section: %E\n"); return; @@ -123,7 +118,7 @@ m68hc11_elf_${EMULATION_NAME}_before_allocation () pinfo->bank_size = region->length; pinfo->bank_shift = 0; for (i = pinfo->bank_size; i != 0; i >>= 1) - pinfo->bank_shift++; + pinfo->bank_shift++; pinfo->bank_shift--; pinfo->bank_size = 1L << pinfo->bank_shift; pinfo->bank_mask = (1 << pinfo->bank_shift) - 1; @@ -131,12 +126,12 @@ m68hc11_elf_${EMULATION_NAME}_before_allocation () pinfo->bank_physical_end = region->origin + pinfo->bank_size; if (pinfo->bank_size != region->length) - { - einfo (_("warning: the size of the 'window' memory region " - "is not a power of 2\n")); - einfo (_("warning: its size %d is truncated to %d\n"), - region->length, pinfo->bank_size); - } + { + einfo (_("warning: the size of the 'window' memory region " + "is not a power of 2\n")); + einfo (_("warning: its size %d is truncated to %d\n"), + region->length, pinfo->bank_size); + } } } @@ -144,7 +139,7 @@ m68hc11_elf_${EMULATION_NAME}_before_allocation () fake input file to hold the stub sections. */ static void -m68hc11elf_create_output_section_statements () +m68hc11elf_create_output_section_statements (void) { stub_file = lang_add_input_file ("linker stubs", lang_input_file_is_fake_enum, @@ -152,8 +147,8 @@ m68hc11elf_create_output_section_statements () stub_file->the_bfd = bfd_create ("linker stubs", output_bfd); if (stub_file->the_bfd == NULL || !bfd_set_arch_mach (stub_file->the_bfd, - bfd_get_arch (output_bfd), - bfd_get_mach (output_bfd))) + bfd_get_arch (output_bfd), + bfd_get_mach (output_bfd))) { einfo ("%X%P: can not create BFD %E\n"); return; @@ -171,13 +166,8 @@ struct hook_stub_info /* Traverse the linker tree to find the spot where the stub goes. */ -static bfd_boolean hook_in_stub - PARAMS ((struct hook_stub_info *, lang_statement_union_type **)); - static bfd_boolean -hook_in_stub (info, lp) - struct hook_stub_info *info; - lang_statement_union_type **lp; +hook_in_stub (struct hook_stub_info *info, lang_statement_union_type **lp) { lang_statement_union_type *l; bfd_boolean ret; @@ -213,10 +203,10 @@ hook_in_stub (info, lp) case lang_input_section_enum: if (l->input_section.section == info->input_section - || strcmp (bfd_get_section_name (output_section, - l->input_section.section), - bfd_get_section_name (output_section, - info->input_section)) == 0) + || strcmp (bfd_get_section_name (output_section, + l->input_section.section), + bfd_get_section_name (output_section, + info->input_section)) == 0) { /* We've found our section. Insert the stub immediately before its associated input section. */ @@ -253,9 +243,8 @@ hook_in_stub (info, lp) immediately before INPUT_SECTION. */ static asection * -m68hc11elf_add_stub_section (stub_sec_name, tramp_section) - const char *stub_sec_name; - asection *tramp_section; +m68hc11elf_add_stub_section (const char *stub_sec_name, + asection *tramp_section) { asection *stub_sec; flagword flags; @@ -263,7 +252,7 @@ m68hc11elf_add_stub_section (stub_sec_name, tramp_section) const char *secname; lang_output_section_statement_type *os; struct hook_stub_info info; - + stub_sec = bfd_make_section_anyway (stub_file->the_bfd, stub_sec_name); if (stub_sec == NULL) goto err_ret; @@ -300,18 +289,18 @@ m68hc11elf_add_stub_section (stub_sec_name, tramp_section) to build linker stubs. */ static void -gld${EMULATION_NAME}_finish () +gld${EMULATION_NAME}_finish (void) { /* Now build the linker stubs. */ if (stub_file->the_bfd->sections != NULL) { /* Call again the trampoline analyzer to initialize the trampoline - stubs with the correct symbol addresses. Since there could have - been relaxation, the symbol addresses that were found during - first call may no longer be correct. */ + stubs with the correct symbol addresses. Since there could have + been relaxation, the symbol addresses that were found during + first call may no longer be correct. */ if (!elf32_m68hc11_size_stubs (output_bfd, - stub_file->the_bfd, - &link_info, 0)) + stub_file->the_bfd, + &link_info, 0)) { einfo ("%X%P: can not size stub section: %E\n"); return; @@ -325,23 +314,16 @@ gld${EMULATION_NAME}_finish () /* Avoid processing the fake stub_file in vercheck, stat_needed and check_needed routines. */ -static void m68hc11_for_each_input_file_wrapper - PARAMS ((lang_input_statement_type *)); -static void m68hc11_lang_for_each_input_file - PARAMS ((void (*) (lang_input_statement_type *))); - -static void (*real_func) PARAMS ((lang_input_statement_type *)); +static void (*real_func) (lang_input_statement_type *); -static void m68hc11_for_each_input_file_wrapper (l) - lang_input_statement_type *l; +static void m68hc11_for_each_input_file_wrapper (lang_input_statement_type *l) { if (l != stub_file) (*real_func) (l); } static void -m68hc11_lang_for_each_input_file (func) - void (*func) PARAMS ((lang_input_statement_type *)); +m68hc11_lang_for_each_input_file (void (*func) (lang_input_statement_type *)) { real_func = func; lang_for_each_input_file (&m68hc11_for_each_input_file_wrapper); @@ -355,8 +337,8 @@ EOF # parse_args and list_options functions. # PARSE_AND_LIST_PROLOGUE=' -#define OPTION_NO_TRAMPOLINE 300 -#define OPTION_BANK_WINDOW 301 +#define OPTION_NO_TRAMPOLINE 300 +#define OPTION_BANK_WINDOW 301 ' # The options are repeated below so that no abbreviations are allowed. diff --git a/ld/emultempl/m68kcoff.em b/ld/emultempl/m68kcoff.em index e56c71f..3b92d17 100644 --- a/ld/emultempl/m68kcoff.em +++ b/ld/emultempl/m68kcoff.em @@ -37,14 +37,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "ldemul.h" #include "ldmisc.h" -static void gld${EMULATION_NAME}_before_parse PARAMS ((void)); -static void gld${EMULATION_NAME}_after_open PARAMS ((void)); -static void check_sections PARAMS ((bfd *, asection *, PTR)); -static void gld${EMULATION_NAME}_after_allocation PARAMS ((void)); -static char *gld${EMULATION_NAME}_get_script PARAMS ((int *isfile)); +static void check_sections (bfd *, asection *, void *); static void -gld${EMULATION_NAME}_before_parse () +gld${EMULATION_NAME}_before_parse (void) { #ifndef TARGET_ /* I.e., if not generic. */ ldfile_set_output_arch ("`echo ${ARCH}`"); @@ -58,7 +54,7 @@ gld${EMULATION_NAME}_before_parse () time. */ static void -gld${EMULATION_NAME}_after_open () +gld${EMULATION_NAME}_after_open (void) { bfd *abfd; @@ -111,13 +107,10 @@ gld${EMULATION_NAME}_after_open () relocs. This is called via bfd_map_over_sections. */ static void -check_sections (abfd, sec, datasec) - 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)); @@ -128,7 +121,7 @@ check_sections (abfd, sec, datasec) BFD backend routine to do the work. */ static void -gld${EMULATION_NAME}_after_allocation () +gld${EMULATION_NAME}_after_allocation (void) { bfd *abfd; @@ -164,8 +157,7 @@ gld${EMULATION_NAME}_after_allocation () } static char * -gld${EMULATION_NAME}_get_script(isfile) - int *isfile; +gld${EMULATION_NAME}_get_script (int *isfile) EOF if test -n "$COMPILE_IN" @@ -176,7 +168,7 @@ then sc="-f stringify.sed" cat >>e${EMULATION_NAME}.c <<EOF -{ +{ *isfile = 0; if (link_info.relocatable && config.build_constructors) @@ -197,7 +189,7 @@ else # Scripts read from the filesystem. cat >>e${EMULATION_NAME}.c <<EOF -{ +{ *isfile = 1; if (link_info.relocatable && config.build_constructors) @@ -217,7 +209,7 @@ fi cat >>e${EMULATION_NAME}.c <<EOF -struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation = +struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation = { gld${EMULATION_NAME}_before_parse, syslib_default, diff --git a/ld/emultempl/m68kelf.em b/ld/emultempl/m68kelf.em index 0bc20ef..64d4aa8 100644 --- a/ld/emultempl/m68kelf.em +++ b/ld/emultempl/m68kelf.em @@ -31,16 +31,14 @@ esac cat >>e${EMULATION_NAME}.c <<EOF -static void m68k_elf_after_open PARAMS ((void)); #ifdef SUPPORT_EMBEDDED_RELOCS -static void check_sections PARAMS ((bfd *, asection *, PTR)); +static void check_sections (bfd *, asection *, void *); #endif -static void m68k_elf_after_allocation PARAMS ((void)); /* This function is run after all the input files have been opened. */ static void -m68k_elf_after_open () +m68k_elf_after_open (void) { /* Call the standard elf routine. */ gld${EMULATION_NAME}_after_open (); @@ -106,10 +104,7 @@ m68k_elf_after_open () relocs. This is called via bfd_map_over_sections. */ static void -check_sections (abfd, sec, datasec) - bfd *abfd; - asection *sec; - PTR datasec; +check_sections (bfd *abfd, asection *sec, PTR datasec) { if ((bfd_get_section_flags (abfd, sec) & SEC_DATA) && sec != (asection *) datasec @@ -124,7 +119,7 @@ check_sections (abfd, sec, datasec) been set. */ static void -m68k_elf_after_allocation () +m68k_elf_after_allocation (void) { /* Call the standard elf routine. */ after_allocation_default (); diff --git a/ld/emultempl/mipsecoff.em b/ld/emultempl/mipsecoff.em index 89ca5c6..c0e8093 100644 --- a/ld/emultempl/mipsecoff.em +++ b/ld/emultempl/mipsecoff.em @@ -1,6 +1,6 @@ # This shell script emits a C file. -*- C -*- # It does some substitutions. -if [ -z "$MACHINE" ]; then +if [ -z "$MACHINE" ]; then OUTPUT_ARCH=${ARCH} else OUTPUT_ARCH=${ARCH}:${MACHINE} @@ -44,14 +44,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "ldfile.h" #include "ldemul.h" -static void gld${EMULATION_NAME}_before_parse PARAMS ((void)); -static void gld${EMULATION_NAME}_after_open PARAMS ((void)); -static void check_sections PARAMS ((bfd *, asection *, PTR)); -static void gld${EMULATION_NAME}_after_allocation PARAMS ((void)); -static char *gld${EMULATION_NAME}_get_script PARAMS ((int *isfile)); +static void check_sections (bfd *, asection *, void *); static void -gld${EMULATION_NAME}_before_parse() +gld${EMULATION_NAME}_before_parse (void) { #ifndef TARGET_ /* I.e., if not generic. */ const bfd_arch_info_type *arch = bfd_scan_arch ("${OUTPUT_ARCH}"); @@ -74,7 +70,7 @@ gld${EMULATION_NAME}_before_parse() have been compiled using -membedded-pic. */ static void -gld${EMULATION_NAME}_after_open () +gld${EMULATION_NAME}_after_open (void) { bfd *abfd; @@ -119,7 +115,7 @@ gld${EMULATION_NAME}_after_open () /* 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); } } @@ -127,13 +123,10 @@ gld${EMULATION_NAME}_after_open () relocs. This is called via bfd_map_over_sections. */ static void -check_sections (abfd, sec, sdatasec) - bfd *abfd; - asection *sec; - PTR sdatasec; +check_sections (bfd *abfd, asection *sec, void *sdatasec) { if ((bfd_get_section_flags (abfd, sec) & SEC_CODE) == 0 - && sec != (asection *) sdatasec + && sec != sdatasec && sec->reloc_count != 0) einfo ("%B%X: section %s has relocs; can not use --embedded-relocs\n", abfd, bfd_get_section_name (abfd, sec)); @@ -144,7 +137,7 @@ check_sections (abfd, sec, sdatasec) BFD backend routine to do the work. */ static void -gld${EMULATION_NAME}_after_allocation () +gld${EMULATION_NAME}_after_allocation (void) { bfd *abfd; @@ -180,8 +173,7 @@ gld${EMULATION_NAME}_after_allocation () } static char * -gld${EMULATION_NAME}_get_script(isfile) - int *isfile; +gld${EMULATION_NAME}_get_script (int *isfile) EOF if test -n "$COMPILE_IN" @@ -192,7 +184,7 @@ then sc="-f stringify.sed" cat >>e${EMULATION_NAME}.c <<EOF -{ +{ *isfile = 0; if (link_info.relocatable && config.build_constructors) @@ -213,7 +205,7 @@ else # Scripts read from the filesystem. cat >>e${EMULATION_NAME}.c <<EOF -{ +{ *isfile = 1; if (link_info.relocatable && config.build_constructors) @@ -233,7 +225,7 @@ fi cat >>e${EMULATION_NAME}.c <<EOF -struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation = +struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation = { gld${EMULATION_NAME}_before_parse, syslib_default, diff --git a/ld/emultempl/mipself.em b/ld/emultempl/mipself.em index 944fbe1..a950fb1 100644 --- a/ld/emultempl/mipself.em +++ b/ld/emultempl/mipself.em @@ -1,3 +1,4 @@ +# This shell script emits a C file. -*- C -*- # Copyright 2002, 2003 Free Software Foundation, Inc. # Written by Mitch Lichtenberg <mpl@broadcom.com> and # Chris Demetriou <cgd@broadcom.com> based on m68kelf.em and mipsecoff.em. @@ -17,7 +18,6 @@ # 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. -# This shell script emits a C file. -*- C -*- # This file is sourced from elf32.em, and defines some extra routines for m68k @@ -33,17 +33,14 @@ esac cat >>e${EMULATION_NAME}.c <<EOF -static void mips_elf${ELFSIZE}_after_open PARAMS ((void)); #ifdef SUPPORT_EMBEDDED_RELOCS -static void mips_elf${ELFSIZE}_check_sections PARAMS ((bfd *, asection *, - PTR)); +static void mips_elf${ELFSIZE}_check_sections (bfd *, asection *, void *); #endif -static void mips_elf${ELFSIZE}_after_allocation PARAMS ((void)); /* This function is run after all the input files have been opened. */ static void -mips_elf${ELFSIZE}_after_open() +mips_elf${ELFSIZE}_after_open (void) { /* Call the standard elf routine. */ gld${EMULATION_NAME}_after_open (); @@ -105,7 +102,7 @@ mips_elf${ELFSIZE}_after_open() /* Double check that all other data sections have no relocs, as is required for embedded PIC code. */ bfd_map_over_sections (abfd, mips_elf${ELFSIZE}_check_sections, - (PTR) datasec); + datasec); } } #endif /* SUPPORT_EMBEDDED_RELOCS */ @@ -116,13 +113,10 @@ mips_elf${ELFSIZE}_after_open() relocs. This is called via bfd_map_over_sections. */ static void -mips_elf${ELFSIZE}_check_sections (abfd, sec, sdatasec) - bfd *abfd; - asection *sec; - PTR sdatasec; +mips_elf${ELFSIZE}_check_sections (bfd *abfd, asection *sec, void *sdatasec) { if ((bfd_get_section_flags (abfd, sec) & SEC_DATA) - && sec != (asection *) sdatasec + && sec != sdatasec && sec->reloc_count != 0) einfo ("%B%X: section %s has relocs; cannot use --embedded-relocs\n", abfd, bfd_get_section_name (abfd, sec)); @@ -134,7 +128,7 @@ mips_elf${ELFSIZE}_check_sections (abfd, sec, sdatasec) BFD backend routine to do the work. */ static void -mips_elf${ELFSIZE}_after_allocation () +mips_elf${ELFSIZE}_after_allocation (void) { /* Call the standard elf routine. */ after_allocation_default (); diff --git a/ld/emultempl/mmix-elfnmmo.em b/ld/emultempl/mmix-elfnmmo.em index 3a2b870..3668e51 100644 --- a/ld/emultempl/mmix-elfnmmo.em +++ b/ld/emultempl/mmix-elfnmmo.em @@ -24,13 +24,10 @@ cat >>e${EMULATION_NAME}.c <<EOF #include "elf/mmix.h" -static void mmix_before_allocation PARAMS ((void)); -static void mmix_after_allocation PARAMS ((void)); - /* Set up handling of linker-allocated global registers. */ static void -mmix_before_allocation () +mmix_before_allocation (void) { /* Call the default first. */ gld${EMULATION_NAME}_before_allocation (); @@ -55,7 +52,7 @@ mmix_before_allocation () GREGs. */ static void -mmix_after_allocation () +mmix_after_allocation (void) { asection *sec = bfd_get_section_by_name (output_bfd, MMIX_REG_CONTENTS_SECTION_NAME); diff --git a/ld/emultempl/mmixelf.em b/ld/emultempl/mmixelf.em index 80d2d94..7cdae55 100644 --- a/ld/emultempl/mmixelf.em +++ b/ld/emultempl/mmixelf.em @@ -1,5 +1,5 @@ # This shell script emits a C file. -*- C -*- -# Copyright 2001, 2002 Free Software Foundation, Inc. +# Copyright 2001, 2002, 2003 Free Software Foundation, Inc. # # This file is part of GLD, the Gnu Linker. # @@ -26,10 +26,8 @@ cat >>e${EMULATION_NAME}.c <<EOF #line 29 "${srcdir}/emultempl/elfmmix.em" -static void elfmmix_before_parse PARAMS ((void)); - static void -elfmmix_before_parse () +elfmmix_before_parse (void) { gld${EMULATION_NAME}_before_parse (); diff --git a/ld/emultempl/mmo.em b/ld/emultempl/mmo.em index 84d1197..9e19af1 100644 --- a/ld/emultempl/mmo.em +++ b/ld/emultempl/mmo.em @@ -32,22 +32,13 @@ EOF cat >>e${EMULATION_NAME}.c <<EOF -static bfd_boolean mmo_place_orphan - PARAMS ((lang_input_statement_type *, asection *)); -static asection *output_prev_sec_find - PARAMS ((lang_output_section_statement_type *)); -static void mmo_finish PARAMS ((void)); -static void mmo_wipe_sec_reloc_flag PARAMS ((bfd *, asection *, PTR)); -static void mmo_after_open PARAMS ((void)); - /* Find the last output section before given output statement. Used by place_orphan. */ static asection * -output_prev_sec_find (os) - lang_output_section_statement_type *os; +output_prev_sec_find (lang_output_section_statement_type *os) { - asection *s = (asection *) NULL; + asection *s = NULL; lang_statement_union_type *u; lang_output_section_statement_type *lookup; @@ -85,9 +76,7 @@ struct orphan_save { from elf32.em. */ static bfd_boolean -mmo_place_orphan (file, s) - lang_input_statement_type *file; - asection *s; +mmo_place_orphan (lang_input_statement_type *file, asection *s) { static struct orphan_save hold_text; struct orphan_save *place; @@ -227,10 +216,7 @@ mmo_place_orphan (file, s) paper over the bug similarly. */ static void -mmo_wipe_sec_reloc_flag (abfd, sec, ptr) - bfd *abfd; - asection *sec; - PTR ptr ATTRIBUTE_UNUSED; +mmo_wipe_sec_reloc_flag (bfd *abfd, asection *sec, void *ptr ATTRIBUTE_UNUSED) { bfd_set_section_flags (abfd, sec, bfd_get_section_flags (abfd, sec) & ~SEC_RELOC); @@ -239,7 +225,7 @@ mmo_wipe_sec_reloc_flag (abfd, sec, ptr) /* Iterate with bfd_map_over_sections over mmo_wipe_sec_reloc_flag... */ static void -mmo_finish () +mmo_finish (void) { bfd_map_over_sections (output_bfd, mmo_wipe_sec_reloc_flag, NULL); } @@ -251,7 +237,7 @@ mmo_finish () when all input files are seen, which is equivalent. */ static void -mmo_after_open () +mmo_after_open (void) { /* When there's a mismatch between the output format and the emulation (using weird combinations like "-m mmo --oformat elf64-mmix" for diff --git a/ld/emultempl/needrelax.em b/ld/emultempl/needrelax.em index 5e052c0..65e622b 100644 --- a/ld/emultempl/needrelax.em +++ b/ld/emultempl/needrelax.em @@ -25,10 +25,8 @@ LDEMUL_BEFORE_ALLOCATION=need_relax_${EMULATION_NAME}_before_allocation cat >>e${EMULATION_NAME}.c <<EOF -static void need_relax_${EMULATION_NAME}_before_allocation PARAMS ((void)); - static void -need_relax_${EMULATION_NAME}_before_allocation () +need_relax_${EMULATION_NAME}_before_allocation (void) { /* Call main function; we're just extending it. */ gld${EMULATION_NAME}_before_allocation (); diff --git a/ld/emultempl/netbsd.em b/ld/emultempl/netbsd.em index 891a879..b252515 100644 --- a/ld/emultempl/netbsd.em +++ b/ld/emultempl/netbsd.em @@ -1,9 +1,8 @@ LDEMUL_BEFORE_PARSE=gldnetbsd_before_parse -cat >>e${EMULATION_NAME}.c <<EOF -static void gldnetbsd_before_parse PARAMS ((void)); +cat >>e${EMULATION_NAME}.c <<EOF static void -gldnetbsd_before_parse () +gldnetbsd_before_parse (void) { gld${EMULATION_NAME}_before_parse (); link_info.common_skip_ar_aymbols = bfd_link_common_skip_text; diff --git a/ld/emultempl/pe.em b/ld/emultempl/pe.em index 9197bd0..bed23c3 100644 --- a/ld/emultempl/pe.em +++ b/ld/emultempl/pe.em @@ -103,44 +103,6 @@ cat >>e${EMULATION_NAME}.c <<EOF #define PE_DEF_FILE_ALIGNMENT 0x00000200 #endif -static void gld_${EMULATION_NAME}_set_symbols PARAMS ((void)); -static void gld_${EMULATION_NAME}_after_open PARAMS ((void)); -static void gld_${EMULATION_NAME}_before_parse PARAMS ((void)); -static void gld_${EMULATION_NAME}_after_parse PARAMS ((void)); -static void gld_${EMULATION_NAME}_before_allocation PARAMS ((void)); -static asection *output_prev_sec_find - PARAMS ((lang_output_section_statement_type *)); -static bfd_boolean gld_${EMULATION_NAME}_place_orphan - PARAMS ((lang_input_statement_type *, asection *)); -static char *gld_${EMULATION_NAME}_get_script PARAMS ((int *)); -static void gld_${EMULATION_NAME}_finish PARAMS ((void)); -static bfd_boolean gld_${EMULATION_NAME}_open_dynamic_archive - PARAMS ((const char *, search_dirs_type *, lang_input_statement_type *)); -static void gld${EMULATION_NAME}_add_options - PARAMS ((int, char **, int, struct option **, int, struct option **)); -static bfd_boolean gld${EMULATION_NAME}_handle_option PARAMS ((int)); -static void gld_${EMULATION_NAME}_list_options PARAMS ((FILE *)); -static void set_pe_name PARAMS ((char *, long)); -static void set_pe_subsystem PARAMS ((void)); -static void set_pe_value PARAMS ((char *)); -static void set_pe_stack_heap PARAMS ((char *, char *)); - -#ifdef DLL_SUPPORT -static bfd_boolean pe_undef_cdecl_match - PARAMS ((struct bfd_link_hash_entry *, PTR)); -static void pe_fixup_stdcalls PARAMS ((void)); -static int make_import_fixup PARAMS ((arelent *, asection *)); -static void pe_find_data_imports PARAMS ((void)); -#endif - -static bfd_boolean pr_sym PARAMS ((struct bfd_hash_entry *, PTR)); -static bfd_boolean gld_${EMULATION_NAME}_unrecognized_file - PARAMS ((lang_input_statement_type *)); -static bfd_boolean gld_${EMULATION_NAME}_recognized_file - PARAMS ((lang_input_statement_type *)); -static int gld_${EMULATION_NAME}_find_potential_libraries - PARAMS ((char *, lang_input_statement_type *)); - static struct internal_extra_pe_aouthdr pe; static int dll; @@ -159,7 +121,7 @@ static char *pe_dll_search_prefix = NULL; extern const char *output_filename; static void -gld_${EMULATION_NAME}_before_parse() +gld_${EMULATION_NAME}_before_parse (void) { const bfd_arch_info_type *arch = bfd_scan_arch ("${OUTPUT_ARCH}"); if (arch) @@ -201,8 +163,8 @@ gld_${EMULATION_NAME}_before_parse() #define OPTION_MINOR_OS_VERSION (OPTION_MINOR_IMAGE_VERSION + 1) #define OPTION_MINOR_SUBSYSTEM_VERSION (OPTION_MINOR_OS_VERSION + 1) #define OPTION_SECTION_ALIGNMENT (OPTION_MINOR_SUBSYSTEM_VERSION + 1) -#define OPTION_STACK (OPTION_SECTION_ALIGNMENT + 1) -#define OPTION_SUBSYSTEM (OPTION_STACK + 1) +#define OPTION_STACK (OPTION_SECTION_ALIGNMENT + 1) +#define OPTION_SUBSYSTEM (OPTION_STACK + 1) #define OPTION_HEAP (OPTION_SUBSYSTEM + 1) #define OPTION_SUPPORT_OLD_CODE (OPTION_HEAP + 1) #define OPTION_OUT_DEF (OPTION_SUPPORT_OLD_CODE + 1) @@ -230,13 +192,10 @@ gld_${EMULATION_NAME}_before_parse() (OPTION_DLL_ENABLE_RUNTIME_PSEUDO_RELOC + 1) static void -gld${EMULATION_NAME}_add_options (ns, shortopts, nl, longopts, nrl, really_longopts) - int ns ATTRIBUTE_UNUSED; - char **shortopts ATTRIBUTE_UNUSED; - int nl; - struct option **longopts; - int nrl ATTRIBUTE_UNUSED; - struct option **really_longopts ATTRIBUTE_UNUSED; +gld${EMULATION_NAME}_add_options + (int ns ATTRIBUTE_UNUSED, char **shortopts ATTRIBUTE_UNUSED, int nl, + struct option **longopts, int nrl ATTRIBUTE_UNUSED, + struct option **really_longopts ATTRIBUTE_UNUSED) { static const struct option xtra_long[] = { /* PE options */ @@ -336,8 +295,7 @@ static definfo init[] = static void -gld_${EMULATION_NAME}_list_options (file) - FILE * file; +gld_${EMULATION_NAME}_list_options (FILE *file) { fprintf (file, _(" --base_file <basefile> Generate a base file for relocatable DLLs\n")); fprintf (file, _(" --dll Set image base to the default for DLLs\n")); @@ -389,9 +347,7 @@ gld_${EMULATION_NAME}_list_options (file) static void -set_pe_name (name, val) - char *name; - long val; +set_pe_name (char *name, long val) { int i; @@ -410,7 +366,7 @@ set_pe_name (name, val) static void -set_pe_subsystem () +set_pe_subsystem (void) { const char *sver; int len; @@ -494,9 +450,7 @@ set_pe_subsystem () static void -set_pe_value (name) - char *name; - +set_pe_value (char *name) { char *end; @@ -510,9 +464,7 @@ set_pe_value (name) static void -set_pe_stack_heap (resname, comname) - char *resname; - char *comname; +set_pe_stack_heap (char *resname, char *comname) { set_pe_value (resname); @@ -527,8 +479,7 @@ set_pe_stack_heap (resname, comname) static bfd_boolean -gld${EMULATION_NAME}_handle_option (optc) - int optc; +gld${EMULATION_NAME}_handle_option (int optc) { switch (optc) { @@ -536,7 +487,7 @@ gld${EMULATION_NAME}_handle_option (optc) return FALSE; 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 */ @@ -697,7 +648,7 @@ compute_dll_image_base (const char *ofile) read. */ static void -gld_${EMULATION_NAME}_set_symbols () +gld_${EMULATION_NAME}_set_symbols (void) { /* Run through and invent symbols for all the names and insert the defaults. */ @@ -761,7 +712,7 @@ gld_${EMULATION_NAME}_set_symbols () have been read. */ static void -gld_${EMULATION_NAME}_after_parse () +gld_${EMULATION_NAME}_after_parse (void) { /* The Windows libraries are designed for the linker to treat the entry point as an undefined symbol. Otherwise, the .obj that @@ -791,13 +742,12 @@ char * pe_data_import_dll; static struct bfd_link_hash_entry *pe_undef_found_sym; static bfd_boolean -pe_undef_cdecl_match (h, string) - struct bfd_link_hash_entry *h; - PTR string; +pe_undef_cdecl_match (struct bfd_link_hash_entry *h, void *inf) { int sl; + char *string = inf; - sl = strlen (string); /* Silence compiler warning. */ + sl = strlen (string); if (h->type == bfd_link_hash_defined && strncmp (h->root.string, string, sl) == 0 && h->root.string[sl] == '@') @@ -809,7 +759,7 @@ pe_undef_cdecl_match (h, string) } static void -pe_fixup_stdcalls () +pe_fixup_stdcalls (void) { static int gave_warning_message = 0; struct bfd_link_hash_entry *undef, *sym; @@ -858,7 +808,7 @@ pe_fixup_stdcalls () symbols - which means scanning the whole symbol table. */ pe_undef_found_sym = 0; bfd_link_hash_traverse (link_info.hash, pe_undef_cdecl_match, - (PTR) undef->root.string); + (char *) undef->root.string); sym = pe_undef_found_sym; if (sym) { @@ -883,9 +833,7 @@ pe_fixup_stdcalls () } static int -make_import_fixup (rel, s) - arelent *rel; - asection *s; +make_import_fixup (arelent *rel, asection *s) { struct symbol_cache_entry *sym = *rel->sym_ptr_ptr; int addend = 0; @@ -904,7 +852,7 @@ make_import_fixup (rel, s) } static void -pe_find_data_imports () +pe_find_data_imports (void) { struct bfd_link_hash_entry *undef, *sym; @@ -971,19 +919,17 @@ pe_find_data_imports () #endif /* DLL_SUPPORT */ static bfd_boolean -pr_sym (h, string) - struct bfd_hash_entry *h; - PTR string ATTRIBUTE_UNUSED; +pr_sym (struct bfd_hash_entry *h, void *inf ATTRIBUTE_UNUSED) { if (pe_dll_extra_pe_debug) - printf ("+%s\n",h->string); + printf ("+%s\n", h->string); return TRUE; } static void -gld_${EMULATION_NAME}_after_open () +gld_${EMULATION_NAME}_after_open (void) { if (pe_dll_extra_pe_debug) { @@ -994,7 +940,7 @@ gld_${EMULATION_NAME}_after_open () for (sym = link_info.hash->undefs; sym; sym=sym->next) printf ("-%s\n", sym->root.string); - bfd_hash_traverse (&link_info.hash->table, pr_sym,NULL); + bfd_hash_traverse (&link_info.hash->table, pr_sym, NULL); for (a = link_info.input_bfds; a; a = a->link_next) printf ("*%s\n",a->filename); @@ -1229,7 +1175,7 @@ gld_${EMULATION_NAME}_after_open () } static void -gld_${EMULATION_NAME}_before_allocation () +gld_${EMULATION_NAME}_before_allocation (void) { #ifdef TARGET_IS_ppcpe /* Here we rummage through the found bfds to collect toc information. */ @@ -1278,7 +1224,7 @@ gld_${EMULATION_NAME}_before_allocation () check here for .DEF files and pull them in automatically. */ static int -saw_option (char * option) +saw_option (char *option) { int i; @@ -1290,8 +1236,7 @@ saw_option (char * option) #endif /* DLL_SUPPORT */ static bfd_boolean -gld_${EMULATION_NAME}_unrecognized_file (entry) - lang_input_statement_type *entry ATTRIBUTE_UNUSED; +gld_${EMULATION_NAME}_unrecognized_file (lang_input_statement_type *entry ATTRIBUTE_UNUSED) { #ifdef DLL_SUPPORT const char *ext = entry->filename + strlen (entry->filename) - 4; @@ -1380,8 +1325,7 @@ gld_${EMULATION_NAME}_unrecognized_file (entry) } static bfd_boolean -gld_${EMULATION_NAME}_recognized_file (entry) - lang_input_statement_type *entry ATTRIBUTE_UNUSED; +gld_${EMULATION_NAME}_recognized_file (lang_input_statement_type *entry ATTRIBUTE_UNUSED) { #ifdef DLL_SUPPORT #ifdef TARGET_IS_i386pe @@ -1414,7 +1358,7 @@ gld_${EMULATION_NAME}_recognized_file (entry) } static void -gld_${EMULATION_NAME}_finish () +gld_${EMULATION_NAME}_finish (void) { #if defined(TARGET_IS_armpe) || defined(TARGET_IS_arm_epoc_pe) struct bfd_link_hash_entry * h; @@ -1498,8 +1442,7 @@ gld_${EMULATION_NAME}_finish () Used by place_orphan. */ static asection * -output_prev_sec_find (os) - lang_output_section_statement_type *os; +output_prev_sec_find (lang_output_section_statement_type *os) { asection *s = (asection *) NULL; lang_statement_union_type *u; @@ -1541,9 +1484,7 @@ struct orphan_save }; static bfd_boolean -gld_${EMULATION_NAME}_place_orphan (file, s) - lang_input_statement_type *file; - asection *s; +gld_${EMULATION_NAME}_place_orphan (lang_input_statement_type *file, asection *s) { const char *secname; char *hold_section_name; @@ -1824,10 +1765,9 @@ gld_${EMULATION_NAME}_place_orphan (file, s) } static bfd_boolean -gld_${EMULATION_NAME}_open_dynamic_archive (arch, search, entry) - const char * arch ATTRIBUTE_UNUSED; - search_dirs_type * search; - lang_input_statement_type * entry; +gld_${EMULATION_NAME}_open_dynamic_archive + (const char *arch ATTRIBUTE_UNUSED, search_dirs_type *search, + lang_input_statement_type *entry) { const char * filename; char * string; @@ -1915,16 +1855,14 @@ gld_${EMULATION_NAME}_open_dynamic_archive (arch, search, entry) } static int -gld_${EMULATION_NAME}_find_potential_libraries (name, entry) - char * name; - lang_input_statement_type * entry; +gld_${EMULATION_NAME}_find_potential_libraries + (char *name, lang_input_statement_type *entry) { return ldfile_open_file_search (name, entry, "", ".lib"); } static char * -gld_${EMULATION_NAME}_get_script (isfile) - int *isfile; +gld_${EMULATION_NAME}_get_script (int *isfile) EOF # Scripts compiled in. # sed commands to quote an ld script as a C string. diff --git a/ld/emultempl/sh64elf.em b/ld/emultempl/sh64elf.em index 174850f..3c348fd 100644 --- a/ld/emultempl/sh64elf.em +++ b/ld/emultempl/sh64elf.em @@ -33,9 +33,6 @@ cat >>e${EMULATION_NAME}.c <<EOF #include "elf/sh.h" #include "elf32-sh64.h" -static void sh64_elf_${EMULATION_NAME}_before_allocation PARAMS ((void)); -static void sh64_elf_${EMULATION_NAME}_after_allocation PARAMS ((void)); - /* Check if we need a .cranges section and create it if it's not in any input file. It might seem better to always create it and if unneeded, discard it, but I don't find a simple way to discard it totally from @@ -47,7 +44,7 @@ static void sh64_elf_${EMULATION_NAME}_after_allocation PARAMS ((void)); they will be linked. */ static void -sh64_elf_${EMULATION_NAME}_before_allocation () +sh64_elf_${EMULATION_NAME}_before_allocation (void) { asection *cranges; asection *osec; @@ -240,7 +237,7 @@ sh64_elf_${EMULATION_NAME}_before_allocation () /* Size up and extend the .cranges section, merging generated entries. */ static void -sh64_elf_${EMULATION_NAME}_after_allocation () +sh64_elf_${EMULATION_NAME}_after_allocation (void) { bfd_vma new_cranges = 0; bfd_vma cranges_growth = 0; @@ -384,8 +381,7 @@ sh64_elf_${EMULATION_NAME}_after_allocation () /* Make sure we have .cranges in memory even if there were only assembler-generated .cranges. */ cranges_growth = new_cranges * SH64_CRANGE_SIZE; - cranges->contents - = (bfd_byte *) xcalloc (cranges->_raw_size + cranges_growth, 1); + cranges->contents = xcalloc (cranges->_raw_size + cranges_growth, 1); bfd_set_section_flags (cranges->owner, cranges, bfd_get_section_flags (cranges->owner, cranges) | SEC_IN_MEMORY); @@ -507,8 +503,7 @@ sh64_elf_${EMULATION_NAME}_after_allocation () - cranges->contents); cr_addr_order->size = 4; cr_addr_order->u.reloc.p - = ((struct bfd_link_order_reloc *) - xmalloc (sizeof (struct bfd_link_order_reloc))); + = xmalloc (sizeof (struct bfd_link_order_reloc)); cr_addr_order->u.reloc.p->reloc = BFD_RELOC_32; cr_addr_order->u.reloc.p->u.section = osec; @@ -540,7 +535,7 @@ sh64_elf_${EMULATION_NAME}_after_allocation () bfd_put_32 (output_bfd, cr_size, crangesp + SH64_CRANGE_CR_SIZE_OFFSET); - bfd_put_16 (output_bfd, (bfd_vma) cr_type, + bfd_put_16 (output_bfd, cr_type, crangesp + SH64_CRANGE_CR_TYPE_OFFSET); last_cr_type = cr_type; diff --git a/ld/emultempl/sunos.em b/ld/emultempl/sunos.em index 2f75b77..912d2f3 100644 --- a/ld/emultempl/sunos.em +++ b/ld/emultempl/sunos.em @@ -61,33 +61,27 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ # endif #endif -static void gld${EMULATION_NAME}_before_parse PARAMS ((void)); -static void gld${EMULATION_NAME}_set_symbols PARAMS ((void)); -static void gld${EMULATION_NAME}_create_output_section_statements - PARAMS ((void)); static void gld${EMULATION_NAME}_find_so - PARAMS ((lang_input_statement_type *)); + (lang_input_statement_type *); static char *gld${EMULATION_NAME}_search_dir - PARAMS ((const char *, const char *, bfd_boolean *)); -static void gld${EMULATION_NAME}_after_open PARAMS ((void)); + (const char *, const char *, bfd_boolean *); static void gld${EMULATION_NAME}_check_needed - PARAMS ((lang_input_statement_type *)); + (lang_input_statement_type *); static bfd_boolean gld${EMULATION_NAME}_search_needed - PARAMS ((const char *, const char *)); + (const char *, const char *); static bfd_boolean gld${EMULATION_NAME}_try_needed - PARAMS ((const char *, const char *)); -static void gld${EMULATION_NAME}_before_allocation PARAMS ((void)); + (const char *, const char *); static void gld${EMULATION_NAME}_find_assignment - PARAMS ((lang_statement_union_type *)); -static void gld${EMULATION_NAME}_find_exp_assignment PARAMS ((etree_type *)); + (lang_statement_union_type *); +static void gld${EMULATION_NAME}_find_exp_assignment + (etree_type *); static void gld${EMULATION_NAME}_count_need - PARAMS ((lang_input_statement_type *)); + (lang_input_statement_type *); static void gld${EMULATION_NAME}_set_need - PARAMS ((lang_input_statement_type *)); -static char *gld${EMULATION_NAME}_get_script PARAMS ((int *isfile)); + (lang_input_statement_type *); static void -gld${EMULATION_NAME}_before_parse() +gld${EMULATION_NAME}_before_parse (void) { const bfd_arch_info_type *arch = bfd_scan_arch ("${OUTPUT_ARCH}"); if (arch) @@ -108,7 +102,7 @@ gld${EMULATION_NAME}_before_parse() list. */ static void -gld${EMULATION_NAME}_set_symbols () +gld${EMULATION_NAME}_set_symbols (void) { EOF if [ "x${host}" = "x${target}" ] ; then @@ -154,7 +148,7 @@ cat >>e${EMULATION_NAME}.c <<EOF search it after including the .so file. */ static void -gld${EMULATION_NAME}_create_output_section_statements () +gld${EMULATION_NAME}_create_output_section_statements (void) { lang_for_each_input_file (gld${EMULATION_NAME}_find_so); } @@ -162,8 +156,7 @@ gld${EMULATION_NAME}_create_output_section_statements () /* Search the directory for a .so file for each library search. */ static void -gld${EMULATION_NAME}_find_so (inp) - lang_input_statement_type *inp; +gld${EMULATION_NAME}_find_so (lang_input_statement_type *inp) { search_dirs_type *search; char *found = NULL; @@ -234,10 +227,8 @@ gld${EMULATION_NAME}_find_so (inp) /* Search a directory for a .so file. */ static char * -gld${EMULATION_NAME}_search_dir (dirname, filename, found_static) - const char *dirname; - const char *filename; - bfd_boolean *found_static; +gld${EMULATION_NAME}_search_dir + (const char *dirname, const char *filename, bfd_boolean *found_static) { int force_maj, force_min; const char *dot; @@ -302,9 +293,9 @@ gld${EMULATION_NAME}_search_dir (dirname, filename, found_static) } /* We accept libfoo.so without a version number, even though the - native linker does not. This is more convenient for packages - which just generate .so files for shared libraries, as on ELF - systems. */ + native linker does not. This is more convenient for packages + which just generate .so files for shared libraries, as on ELF + systems. */ if (strncmp (entry->d_name + 3 + len, ".so", 3) != 0) continue; if (entry->d_name[6 + len] == '\0') @@ -378,7 +369,7 @@ static bfd_boolean global_found; /* This is called after all the input files have been opened. */ static void -gld${EMULATION_NAME}_after_open () +gld${EMULATION_NAME}_after_open (void) { struct bfd_link_needed_list *needed, *l; @@ -514,9 +505,7 @@ cat >>e${EMULATION_NAME}.c <<EOF /* Search for a needed file in a path. */ static bfd_boolean -gld${EMULATION_NAME}_search_needed (path, name) - const char *path; - const char *name; +gld${EMULATION_NAME}_search_needed (const char *path, const char *name) { const char *s; @@ -559,9 +548,7 @@ gld${EMULATION_NAME}_search_needed (path, name) dynamic object. */ static bfd_boolean -gld${EMULATION_NAME}_try_needed (dir, name) - const char *dir; - const char *name; +gld${EMULATION_NAME}_try_needed (const char *dir, const char *name) { char *file; char *alc; @@ -603,8 +590,7 @@ gld${EMULATION_NAME}_try_needed (dir, name) dynamic object more than once. */ static void -gld${EMULATION_NAME}_check_needed (s) - lang_input_statement_type *s; +gld${EMULATION_NAME}_check_needed (lang_input_statement_type *s) { if (s->filename == NULL) return; @@ -679,7 +665,7 @@ static bfd_byte *need_pnames; sections, but before any sizes or addresses have been set. */ static void -gld${EMULATION_NAME}_before_allocation () +gld${EMULATION_NAME}_before_allocation (void) { struct bfd_link_hash_entry *hdyn = NULL; asection *sneed; @@ -718,7 +704,7 @@ gld${EMULATION_NAME}_before_allocation () lang_output_section_statement_type *os; /* Set the .text section to start at 0x20, not 0x2020. FIXME: - This is too magical. */ + This is too magical. */ os = lang_output_section_statement_lookup (".text"); if (os->addr_tree == NULL) os->addr_tree = exp_intop (0x20); @@ -842,8 +828,7 @@ gld${EMULATION_NAME}_before_allocation () symbols which are referred to by dynamic objects. */ static void -gld${EMULATION_NAME}_find_assignment (s) - lang_statement_union_type *s; +gld${EMULATION_NAME}_find_assignment (lang_statement_union_type *s) { if (s->header.type == lang_assignment_statement_enum && (find_assign == NULL || ! found_assign)) @@ -853,8 +838,7 @@ gld${EMULATION_NAME}_find_assignment (s) /* Look through an expression for an assignment statement. */ static void -gld${EMULATION_NAME}_find_exp_assignment (exp) - etree_type *exp; +gld${EMULATION_NAME}_find_exp_assignment (etree_type *exp) { switch (exp->type.node_class) { @@ -902,8 +886,7 @@ gld${EMULATION_NAME}_find_exp_assignment (exp) for more information. */ static void -gld${EMULATION_NAME}_count_need (inp) - lang_input_statement_type *inp; +gld${EMULATION_NAME}_count_need (lang_input_statement_type *inp) { if (inp->the_bfd != NULL && (inp->the_bfd->flags & DYNAMIC) != 0) @@ -924,8 +907,7 @@ gld${EMULATION_NAME}_count_need (inp) /* Fill in the contents of the .need section. */ static void -gld${EMULATION_NAME}_set_need (inp) - lang_input_statement_type *inp; +gld${EMULATION_NAME}_set_need (lang_input_statement_type *inp) { if (inp->the_bfd != NULL && (inp->the_bfd->flags & DYNAMIC) != 0) @@ -974,8 +956,7 @@ gld${EMULATION_NAME}_set_need (inp) } static char * -gld${EMULATION_NAME}_get_script(isfile) - int *isfile; +gld${EMULATION_NAME}_get_script (int *isfile) EOF if test -n "$COMPILE_IN" diff --git a/ld/emultempl/ticoff.em b/ld/emultempl/ticoff.em index aca5409..448fea8 100644 --- a/ld/emultempl/ticoff.em +++ b/ld/emultempl/ticoff.em @@ -39,24 +39,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ static int coff_version; -static void gld_${EMULATION_NAME}_before_parse PARAMS ((void)); -static char *gld_${EMULATION_NAME}_get_script PARAMS ((int *)); -static void gld${EMULATION_NAME}_add_options - PARAMS ((int, char **, int, struct option **, int, struct option **)); -static bfd_boolean gld${EMULATION_NAME}_handle_option PARAMS ((int)); -static void gld_${EMULATION_NAME}_list_options PARAMS ((FILE *)); - /* TI COFF extra command line options */ #define OPTION_COFF_FORMAT (300 + 1) static void -gld${EMULATION_NAME}_add_options (ns, shortopts, nl, longopts, nrl, really_longopts) - int ns ATTRIBUTE_UNUSED; - char **shortopts ATTRIBUTE_UNUSED; - int nl; - struct option **longopts; - int nrl ATTRIBUTE_UNUSED; - struct option **really_longopts ATTRIBUTE_UNUSED; +gld${EMULATION_NAME}_add_options + (int ns ATTRIBUTE_UNUSED, char **shortopts ATTRIBUTE_UNUSED, int nl, + struct option **longopts, int nrl ATTRIBUTE_UNUSED, + struct option **really_longopts ATTRIBUTE_UNUSED) { static const struct option xtra_long[] = { /* TI COFF options */ @@ -70,15 +60,13 @@ gld${EMULATION_NAME}_add_options (ns, shortopts, nl, longopts, nrl, really_longo } static void -gld_${EMULATION_NAME}_list_options (file) - FILE * file; +gld_${EMULATION_NAME}_list_options (FILE * file) { fprintf (file, _(" --format 0|1|2 Specify which COFF version to use")); } static bfd_boolean -gld${EMULATION_NAME}_handle_option (optc) - int optc; +gld${EMULATION_NAME}_handle_option (int optc) { switch (optc) { @@ -106,7 +94,7 @@ gld${EMULATION_NAME}_handle_option (optc) } static void -gld_${EMULATION_NAME}_before_parse() +gld_${EMULATION_NAME}_before_parse(void) { #ifndef TARGET_ /* I.e., if not generic. */ ldfile_set_output_arch ("`echo ${ARCH}`"); @@ -114,8 +102,7 @@ gld_${EMULATION_NAME}_before_parse() } static char * -gld_${EMULATION_NAME}_get_script (isfile) - int *isfile; +gld_${EMULATION_NAME}_get_script (int *isfile) EOF if test -n "$COMPILE_IN" then diff --git a/ld/emultempl/vanilla.em b/ld/emultempl/vanilla.em index 8d4f6d4..2141083 100644 --- a/ld/emultempl/vanilla.em +++ b/ld/emultempl/vanilla.em @@ -35,17 +35,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "ldfile.h" #include "ldemul.h" -static void vanilla_before_parse PARAMS ((void)); -static void vanilla_set_output_arch PARAMS ((void)); -static char *vanilla_get_script PARAMS ((int *)); - - -static void vanilla_before_parse() +static void vanilla_before_parse (void) { } static void -vanilla_set_output_arch() +vanilla_set_output_arch (void) { /* Set the output architecture and machine if possible */ unsigned long machine = 0; @@ -53,14 +48,13 @@ vanilla_set_output_arch() } static char * -vanilla_get_script(isfile) - int *isfile; +vanilla_get_script (int *isfile) { *isfile = 0; return ""; } -struct ld_emulation_xfer_struct ld_vanilla_emulation = +struct ld_emulation_xfer_struct ld_vanilla_emulation = { vanilla_before_parse, syslib_default, diff --git a/ld/emultempl/xtensaelf.em b/ld/emultempl/xtensaelf.em index bc91365..8762920 100644 --- a/ld/emultempl/xtensaelf.em +++ b/ld/emultempl/xtensaelf.em @@ -26,22 +26,8 @@ cat >>e${EMULATION_NAME}.c <<EOF #include <xtensa-config.h> -static char *elf_xtensa_choose_target - PARAMS ((int, char **)); -static bfd_boolean elf_xtensa_place_orphan - PARAMS ((lang_input_statement_type *, asection *)); -static void elf_xtensa_before_parse - PARAMS ((void)); -static void elf_xtensa_before_allocation - PARAMS ((void)); -static void xtensa_wild_group_interleave - PARAMS ((lang_statement_union_type *)); -static void xtensa_wild_group_interleave_callback - PARAMS ((lang_statement_union_type *)); -static void xtensa_colocate_output_literals - PARAMS ((lang_statement_union_type *)); -static void xtensa_colocate_output_literals_callback - PARAMS ((lang_statement_union_type *)); +static void xtensa_wild_group_interleave (lang_statement_union_type *); +static void xtensa_colocate_output_literals (lang_statement_union_type *); /* Flag for the emulation-specific "--no-relax" option. */ @@ -58,9 +44,8 @@ static bfd_boolean xtensa_use_literal_pages = FALSE; static char * -elf_xtensa_choose_target (argc, argv) - int argc ATTRIBUTE_UNUSED; - char **argv ATTRIBUTE_UNUSED; +elf_xtensa_choose_target (int argc ATTRIBUTE_UNUSED, + char **argv ATTRIBUTE_UNUSED) { if (XCHAL_HAVE_BE) return "${BIG_OUTPUT_FORMAT}"; @@ -70,9 +55,7 @@ elf_xtensa_choose_target (argc, argv) static bfd_boolean -elf_xtensa_place_orphan (file, s) - lang_input_statement_type *file; - asection *s; +elf_xtensa_place_orphan (lang_input_statement_type *file, asection *s) { /* Early exit for relocatable links. */ if (link_info.relocatable) @@ -83,7 +66,7 @@ elf_xtensa_place_orphan (file, s) static void -elf_xtensa_before_parse () +elf_xtensa_before_parse (void) { /* Just call the default hook.... Tensilica's version of this function does some other work that isn't relevant here. */ @@ -94,8 +77,8 @@ elf_xtensa_before_parse () /* This is called after the sections have been attached to output sections, but before any sizes or addresses have been set. */ -void -elf_xtensa_before_allocation () +static void +elf_xtensa_before_allocation (void) { bfd *in_bfd; bfd_boolean is_big_endian = XCHAL_HAVE_BE; @@ -143,7 +126,7 @@ elf_xtensa_before_allocation () gld${EMULATION_NAME}_before_allocation (); xtensa_wild_group_interleave (stat_ptr->head); - if (command_line.relax) + if (command_line.relax) xtensa_colocate_output_literals (stat_ptr->head); /* TBD: We need to force the page alignments to here and only do @@ -184,64 +167,29 @@ struct reloc_deps_graph_t }; static void xtensa_layout_wild - PARAMS ((const reloc_deps_graph *, lang_wild_statement_type *)); + (const reloc_deps_graph *, lang_wild_statement_type *); -typedef void (*deps_callback_t) - PARAMS ((asection *, /* src_sec */ - bfd_vma, /* src_offset */ - asection *, /* target_sec */ - bfd_vma, /* target_offset */ - PTR)); /* closure */ +typedef void (*deps_callback_t) (asection *, /* src_sec */ + bfd_vma, /* src_offset */ + asection *, /* target_sec */ + bfd_vma, /* target_offset */ + void *); /* closure */ -static void build_deps_graph_callback - PARAMS ((asection *, bfd_vma, asection *, bfd_vma, PTR)); extern bfd_boolean xtensa_callback_required_dependence - PARAMS ((bfd *, asection *, struct bfd_link_info *, - deps_callback_t, PTR)); + (bfd *, asection *, struct bfd_link_info *, deps_callback_t, void *); static void xtensa_ldlang_clear_addresses - PARAMS ((lang_statement_union_type *)); + (lang_statement_union_type *); static bfd_boolean ld_local_file_relocations_fit - PARAMS ((lang_statement_union_type *, const reloc_deps_graph *)); + (lang_statement_union_type *, const reloc_deps_graph *); static bfd_vma ld_assign_relative_paged_dot - PARAMS ((bfd_vma, lang_statement_union_type *, - const reloc_deps_graph *, bfd_boolean)); + (bfd_vma, lang_statement_union_type *, const reloc_deps_graph *, + bfd_boolean); static bfd_vma ld_xtensa_insert_page_offsets - PARAMS ((bfd_vma, lang_statement_union_type *, reloc_deps_graph *, - bfd_boolean)); -static void lang_for_each_statement_worker - PARAMS ((void (*) (lang_statement_union_type *), - lang_statement_union_type *)); -static void xtensa_move_dependencies_to_front - PARAMS ((reloc_deps_graph *, lang_wild_statement_type *)); -static reloc_deps_graph *ld_build_required_section_dependence - PARAMS ((lang_statement_union_type *)); -static bfd_boolean section_is_source - PARAMS ((const reloc_deps_graph *, lang_statement_union_type *)); -static bfd_boolean section_is_target - PARAMS ((const reloc_deps_graph *, lang_statement_union_type *)); -static bfd_boolean section_is_source_or_target - PARAMS ((const reloc_deps_graph *, lang_statement_union_type *)); -static bfd_boolean deps_has_sec_edge - PARAMS ((const reloc_deps_graph *, asection *, asection *)); -static bfd_boolean deps_has_edge - PARAMS ((const reloc_deps_graph *, lang_statement_union_type *, - lang_statement_union_type *)); -static void add_deps_edge - PARAMS ((reloc_deps_graph *, asection *, asection *)); + (bfd_vma, lang_statement_union_type *, reloc_deps_graph *, bfd_boolean); #if EXTRA_VALIDATION static size_t ld_count_children - PARAMS ((lang_statement_union_type *)); + (lang_statement_union_type *); #endif -static void free_reloc_deps_graph - PARAMS ((reloc_deps_graph *)); -static void xtensa_colocate_literals - PARAMS ((reloc_deps_graph *, lang_statement_union_type *)); -static reloc_deps_section *xtensa_get_section_deps - PARAMS ((const reloc_deps_graph *, asection *)); -static void xtensa_set_section_deps - PARAMS ((const reloc_deps_graph *, asection *, reloc_deps_section *)); -static void xtensa_append_section_deps - PARAMS ((reloc_deps_graph *, asection *)); extern lang_statement_list_type constructor_list; @@ -250,99 +198,94 @@ extern lang_statement_list_type constructor_list; there statically. */ 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) { func (s); switch (s->header.type) - { - case lang_constructors_statement_enum: - lang_for_each_statement_worker (func, constructor_list.head); - break; - case lang_output_section_statement_enum: - lang_for_each_statement_worker - (func, - s->output_section_statement.children.head); - break; - case lang_wild_statement_enum: - lang_for_each_statement_worker - (func, - s->wild_statement.children.head); - break; - case lang_group_statement_enum: - lang_for_each_statement_worker (func, - s->group_statement.children.head); - break; - case lang_data_statement_enum: - case lang_reloc_statement_enum: - case lang_object_symbols_statement_enum: - case lang_output_statement_enum: - case lang_target_statement_enum: - case lang_input_section_enum: - case lang_input_statement_enum: - case lang_assignment_statement_enum: - case lang_padding_statement_enum: - case lang_address_statement_enum: - case lang_fill_statement_enum: - break; - default: - FAIL (); - break; - } + { + case lang_constructors_statement_enum: + lang_for_each_statement_worker (func, constructor_list.head); + break; + case lang_output_section_statement_enum: + lang_for_each_statement_worker + (func, + s->output_section_statement.children.head); + break; + case lang_wild_statement_enum: + lang_for_each_statement_worker + (func, + s->wild_statement.children.head); + break; + case lang_group_statement_enum: + lang_for_each_statement_worker (func, + s->group_statement.children.head); + break; + case lang_data_statement_enum: + case lang_reloc_statement_enum: + case lang_object_symbols_statement_enum: + case lang_output_statement_enum: + case lang_target_statement_enum: + case lang_input_section_enum: + case lang_input_statement_enum: + case lang_assignment_statement_enum: + case lang_padding_statement_enum: + case lang_address_statement_enum: + case lang_fill_statement_enum: + break; + default: + FAIL (); + break; + } } } /* End of verbatim code from ldlang.c. */ -reloc_deps_section * -xtensa_get_section_deps (deps, sec) - const reloc_deps_graph *deps ATTRIBUTE_UNUSED; - asection *sec; +static reloc_deps_section * +xtensa_get_section_deps (const reloc_deps_graph *deps ATTRIBUTE_UNUSED, + asection *sec) { /* We have a separate function for this so that we could in the future keep a completely independent structure that maps a section to its dependence edges. For now, we place these in the sec->userdata field. */ - reloc_deps_section *sec_deps = (reloc_deps_section *) sec->userdata; + reloc_deps_section *sec_deps = sec->userdata; return sec_deps; } -void -xtensa_set_section_deps (deps, sec, deps_section) - const reloc_deps_graph *deps ATTRIBUTE_UNUSED; - asection *sec; - reloc_deps_section *deps_section; +static void +xtensa_set_section_deps (const reloc_deps_graph *deps ATTRIBUTE_UNUSED, + asection *sec, + reloc_deps_section *deps_section) { - sec->userdata = (void *) deps_section; + sec->userdata = deps_section; } /* This is used to keep a list of all of the sections participating in the graph so we can clean them up quickly. */ -static void -xtensa_append_section_deps (deps, sec) - reloc_deps_graph *deps; - asection *sec; +static void +xtensa_append_section_deps (reloc_deps_graph *deps, asection *sec) { if (deps->size <= deps->count) { asection **new_sections; size_t i; size_t new_size; - + new_size = deps->size * 2; if (new_size == 0) new_size = 20; - - new_sections = (asection**) xmalloc (sizeof (asection*) * new_size); - memset (new_sections, 0, sizeof (asection*) * new_size); - for (i = 0; i < deps->count; i++) + + new_sections = xmalloc (sizeof (asection *) * new_size); + memset (new_sections, 0, sizeof (asection *) * new_size); + for (i = 0; i < deps->count; i++) { new_sections[i] = deps->sections[i]; } @@ -356,9 +299,8 @@ xtensa_append_section_deps (deps, sec) } -static void -free_reloc_deps_graph (deps) - reloc_deps_graph *deps; +static void +free_reloc_deps_graph (reloc_deps_graph *deps) { size_t i; for (i = 0; i < deps->count; i++) @@ -366,7 +308,7 @@ free_reloc_deps_graph (deps) asection *sec = deps->sections[i]; reloc_deps_section *sec_deps; sec_deps = xtensa_get_section_deps (deps, sec); - if (sec_deps) + if (sec_deps) { reloc_deps_e *next; while (sec_deps->succs != NULL) @@ -375,7 +317,7 @@ free_reloc_deps_graph (deps) free (sec_deps->succs); sec_deps->succs = next; } - + while (sec_deps->preds != NULL) { next = sec_deps->preds->next; @@ -393,10 +335,9 @@ free_reloc_deps_graph (deps) } -bfd_boolean -section_is_source (deps, s) - const reloc_deps_graph *deps ATTRIBUTE_UNUSED; - lang_statement_union_type *s; +static bfd_boolean +section_is_source (const reloc_deps_graph *deps ATTRIBUTE_UNUSED, + lang_statement_union_type *s) { asection *sec; const reloc_deps_section *sec_deps; @@ -406,14 +347,13 @@ section_is_source (deps, s) sec = s->input_section.section; sec_deps = xtensa_get_section_deps (deps, sec); - return (sec_deps && sec_deps->succs != NULL); + return sec_deps && sec_deps->succs != NULL; } -bfd_boolean -section_is_target (deps, s) - const reloc_deps_graph *deps ATTRIBUTE_UNUSED; - lang_statement_union_type *s; +static bfd_boolean +section_is_target (const reloc_deps_graph *deps ATTRIBUTE_UNUSED, + lang_statement_union_type *s) { asection *sec; const reloc_deps_section *sec_deps; @@ -423,13 +363,12 @@ section_is_target (deps, s) sec = s->input_section.section; sec_deps = xtensa_get_section_deps (deps, sec); - return (sec_deps && sec_deps->preds != NULL); + return sec_deps && sec_deps->preds != NULL; } -bfd_boolean -section_is_source_or_target (deps, s) - const reloc_deps_graph *deps ATTRIBUTE_UNUSED; - lang_statement_union_type *s; +static bfd_boolean +section_is_source_or_target (const reloc_deps_graph *deps ATTRIBUTE_UNUSED, + lang_statement_union_type *s) { return (section_is_source (deps, s) || section_is_target (deps, s)); @@ -449,19 +388,14 @@ struct xtensa_ld_iter_t struct xtensa_ld_iter_stack_t { xtensa_ld_iter iterloc; /* List that hold it. */ - + xtensa_ld_iter_stack *next; /* Next in the stack. */ xtensa_ld_iter_stack *prev; /* Back pointer for stack. */ }; -static void ld_xtensa_move_section_after - PARAMS ((xtensa_ld_iter *, xtensa_ld_iter *)); - -void -ld_xtensa_move_section_after (to, current) - xtensa_ld_iter *to; - xtensa_ld_iter *current; +static void +ld_xtensa_move_section_after (xtensa_ld_iter *to, xtensa_ld_iter *current) { lang_statement_union_type *to_next; lang_statement_union_type *current_next; @@ -474,7 +408,7 @@ ld_xtensa_move_section_after (to, current) if (to == current) return; - + #if EXTRA_VALIDATION old_to_count = ld_count_children (to->parent); old_current_count = ld_count_children (current->parent); @@ -482,9 +416,9 @@ ld_xtensa_move_section_after (to, current) to_next = *(to->loc); current_next = (*current->loc)->header.next; - + *(to->loc) = *(current->loc); - + *(current->loc) = current_next; (*(to->loc))->header.next = to_next; @@ -502,7 +436,7 @@ ld_xtensa_move_section_after (to, current) new_to_count = ld_count_children (to->parent); new_current_count = ld_count_children (current->parent); - ASSERT ((old_to_count + old_current_count) + ASSERT ((old_to_count + old_current_count) == (new_to_count + new_current_count)); #endif } @@ -511,41 +445,21 @@ ld_xtensa_move_section_after (to, current) /* Can only be called with lang_statements that have lists. Returns false if the list is empty. */ -static bfd_boolean iter_stack_empty - PARAMS ((xtensa_ld_iter_stack **)); -static bfd_boolean iter_stack_push - PARAMS ((xtensa_ld_iter_stack **, lang_statement_union_type *)); -static void iter_stack_pop - PARAMS ((xtensa_ld_iter_stack **)); -static void iter_stack_update - PARAMS ((xtensa_ld_iter_stack **)); -static void iter_stack_next - PARAMS ((xtensa_ld_iter_stack **)); -static lang_statement_union_type *iter_stack_current - PARAMS ((xtensa_ld_iter_stack **)); -static void iter_stack_create - PARAMS ((xtensa_ld_iter_stack **, lang_statement_union_type *)); -static void iter_stack_copy_current - PARAMS ((xtensa_ld_iter_stack **, xtensa_ld_iter *)); - - -static bfd_boolean -iter_stack_empty (stack_p) - xtensa_ld_iter_stack **stack_p; +static bfd_boolean +iter_stack_empty (xtensa_ld_iter_stack **stack_p) { - return (*stack_p == NULL); + return *stack_p == NULL; } static bfd_boolean -iter_stack_push (stack_p, parent) - xtensa_ld_iter_stack **stack_p; - lang_statement_union_type *parent; +iter_stack_push (xtensa_ld_iter_stack **stack_p, + lang_statement_union_type *parent) { xtensa_ld_iter_stack *stack; lang_statement_list_type *l = NULL; - switch (parent->header.type) + switch (parent->header.type) { case lang_output_section_statement_enum: l = &parent->output_section_statement.children; @@ -562,10 +476,10 @@ iter_stack_push (stack_p, parent) } /* Empty. do not push. */ - if (l->tail == &l->head) + if (l->tail == &l->head) return FALSE; - stack = (xtensa_ld_iter_stack *) xmalloc (sizeof (xtensa_ld_iter_stack)); + stack = xmalloc (sizeof (xtensa_ld_iter_stack)); memset (stack, 0, sizeof (xtensa_ld_iter_stack)); stack->iterloc.parent = parent; stack->iterloc.l = l; @@ -573,28 +487,27 @@ iter_stack_push (stack_p, parent) stack->next = *stack_p; stack->prev = NULL; - if (*stack_p != NULL) + if (*stack_p != NULL) (*stack_p)->prev = stack; *stack_p = stack; return TRUE; } -static void -iter_stack_pop (stack_p) - xtensa_ld_iter_stack **stack_p; +static void +iter_stack_pop (xtensa_ld_iter_stack **stack_p) { xtensa_ld_iter_stack *stack; stack = *stack_p; - if (stack == NULL) + if (stack == NULL) { ASSERT (stack != NULL); return; } - if (stack->next != NULL) + if (stack->next != NULL) stack->next->prev = NULL; *stack_p = stack->next; @@ -607,11 +520,10 @@ iter_stack_pop (stack_p) accordingly. */ static void -iter_stack_update (stack_p) - xtensa_ld_iter_stack **stack_p; +iter_stack_update (xtensa_ld_iter_stack **stack_p) { if (!iter_stack_empty (stack_p) - && (*(*stack_p)->iterloc.loc) == NULL) + && (*(*stack_p)->iterloc.loc) == NULL) { iter_stack_pop (stack_p); @@ -626,9 +538,8 @@ iter_stack_update (stack_p) } -static void -iter_stack_next (stack_p) - xtensa_ld_iter_stack **stack_p; +static void +iter_stack_next (xtensa_ld_iter_stack **stack_p) { xtensa_ld_iter_stack *stack; lang_statement_union_type *current; @@ -636,9 +547,9 @@ iter_stack_next (stack_p) current = *stack->iterloc.loc; /* If we are on the first element. */ - if (current != NULL) + if (current != NULL) { - switch (current->header.type) + switch (current->header.type) { case lang_output_section_statement_enum: case lang_wild_statement_enum: @@ -664,8 +575,7 @@ iter_stack_next (stack_p) static lang_statement_union_type * -iter_stack_current (stack_p) - xtensa_ld_iter_stack **stack_p; +iter_stack_current (xtensa_ld_iter_stack **stack_p) { return *((*stack_p)->iterloc.loc); } @@ -673,28 +583,25 @@ iter_stack_current (stack_p) /* The iter stack is a preorder. */ -static void -iter_stack_create (stack_p, parent) - xtensa_ld_iter_stack **stack_p; - lang_statement_union_type *parent; +static void +iter_stack_create (xtensa_ld_iter_stack **stack_p, + lang_statement_union_type *parent) { iter_stack_push (stack_p, parent); } -static void -iter_stack_copy_current (stack_p, front) - xtensa_ld_iter_stack **stack_p; - xtensa_ld_iter *front; +static void +iter_stack_copy_current (xtensa_ld_iter_stack **stack_p, + xtensa_ld_iter *front) { *front = (*stack_p)->iterloc; } -void -xtensa_colocate_literals (deps, statement) - reloc_deps_graph *deps; - lang_statement_union_type *statement; +static void +xtensa_colocate_literals (reloc_deps_graph *deps, + lang_statement_union_type *statement) { /* Keep a stack of pointers to control iteration through the contours. */ xtensa_ld_iter_stack *stack = NULL; @@ -719,15 +626,15 @@ xtensa_colocate_literals (deps, statement) lang_for_each_statement_worker (xtensa_ldlang_clear_addresses, statement); #endif - + iter_stack_create (stack_p, statement); - while (!iter_stack_empty (stack_p)) + while (!iter_stack_empty (stack_p)) { bfd_boolean skip_increment = FALSE; lang_statement_union_type *l = iter_stack_current (stack_p); - - switch (l->header.type) + + switch (l->header.type) { case lang_assignment_statement_enum: /* Any assignment statement should block reordering across it. */ @@ -740,12 +647,12 @@ xtensa_colocate_literals (deps, statement) { in_literals = (section_is_target (deps, l) && !section_is_source (deps, l)); - if (in_literals) + if (in_literals) { front_p = &front; iter_stack_copy_current (stack_p, front_p); } - } + } else { bfd_boolean is_target; @@ -762,15 +669,15 @@ xtensa_colocate_literals (deps, statement) } else { - if (is_target) + if (is_target) { /* Try to insert in place. */ ld_xtensa_move_section_after (front_p, current_p); - ld_assign_relative_paged_dot (0x100000, + ld_assign_relative_paged_dot (0x100000, statement, deps, xtensa_use_literal_pages); - + /* We use this code because it's already written. */ if (!ld_local_file_relocations_fit (statement, deps)) { @@ -779,7 +686,7 @@ xtensa_colocate_literals (deps, statement) /* Reset the literal placement. */ iter_stack_copy_current (stack_p, front_p); } - else + else { /* Move front pointer up by one. */ front_p->loc = &(*front_p->loc)->header.next; @@ -801,15 +708,14 @@ xtensa_colocate_literals (deps, statement) /* Be careful to update the stack_p if it now is a null. */ iter_stack_update (stack_p); } - + lang_for_each_statement_worker (xtensa_ldlang_clear_addresses, statement); } -void -xtensa_move_dependencies_to_front (deps, w) - reloc_deps_graph *deps; - lang_wild_statement_type *w; +static void +xtensa_move_dependencies_to_front (reloc_deps_graph *deps, + lang_wild_statement_type *w) { /* Keep a front pointer and a current pointer. */ lang_statement_union_type **front; @@ -825,7 +731,7 @@ xtensa_move_dependencies_to_front (deps, w) return; current = &(*front)->header.next; - while (*current != NULL) + while (*current != NULL) { if (section_is_source_or_target (deps, *current)) { @@ -853,10 +759,9 @@ xtensa_move_dependencies_to_front (deps, w) static bfd_boolean -deps_has_sec_edge (deps, src, tgt) - const reloc_deps_graph *deps; - asection *src; - asection *tgt; +deps_has_sec_edge (const reloc_deps_graph *deps, + asection *src, + asection *tgt) { const reloc_deps_section *sec_deps; const reloc_deps_e *sec_deps_e; @@ -864,13 +769,13 @@ deps_has_sec_edge (deps, src, tgt) sec_deps = xtensa_get_section_deps (deps, src); if (sec_deps == NULL) return FALSE; - + for (sec_deps_e = sec_deps->succs; - sec_deps_e != NULL; + sec_deps_e != NULL; sec_deps_e = sec_deps_e->next) { ASSERT (sec_deps_e->src == src); - if (sec_deps_e->tgt == tgt) + if (sec_deps_e->tgt == tgt) return TRUE; } return FALSE; @@ -878,10 +783,9 @@ deps_has_sec_edge (deps, src, tgt) static bfd_boolean -deps_has_edge (deps, src, tgt) - const reloc_deps_graph *deps; - lang_statement_union_type *src; - lang_statement_union_type *tgt; +deps_has_edge (const reloc_deps_graph *deps, + lang_statement_union_type *src, + lang_statement_union_type *tgt) { if (!section_is_source (deps, src)) return FALSE; @@ -892,17 +796,16 @@ deps_has_edge (deps, src, tgt) return FALSE; if (tgt->header.type != lang_input_section_enum) return FALSE; - + return deps_has_sec_edge (deps, src->input_section.section, tgt->input_section.section); } static void -add_deps_edge (deps, src_sec, tgt_sec) - reloc_deps_graph *deps; - asection *src_sec; - asection *tgt_sec; +add_deps_edge (reloc_deps_graph *deps, + asection *src_sec, + asection *tgt_sec) { reloc_deps_section *src_sec_deps; reloc_deps_section *tgt_sec_deps; @@ -912,13 +815,12 @@ add_deps_edge (deps, src_sec, tgt_sec) if (deps_has_sec_edge (deps, src_sec, tgt_sec)) return; - + src_sec_deps = xtensa_get_section_deps (deps, src_sec); if (src_sec_deps == NULL) { /* Add a section. */ - src_sec_deps = (reloc_deps_section *) - xmalloc (sizeof (reloc_deps_section)); + src_sec_deps = xmalloc (sizeof (reloc_deps_section)); memset (src_sec_deps, 0, sizeof (reloc_deps_section)); src_sec_deps->is_only_literal = 0; src_sec_deps->preds = NULL; @@ -931,8 +833,7 @@ add_deps_edge (deps, src_sec, tgt_sec) if (tgt_sec_deps == NULL) { /* Add a section. */ - tgt_sec_deps = (reloc_deps_section *) - xmalloc (sizeof (reloc_deps_section)); + tgt_sec_deps = xmalloc (sizeof (reloc_deps_section)); memset (tgt_sec_deps, 0, sizeof (reloc_deps_section)); tgt_sec_deps->is_only_literal = 0; tgt_sec_deps->preds = NULL; @@ -942,14 +843,14 @@ add_deps_edge (deps, src_sec, tgt_sec) } /* Add the edges. */ - src_edge = (reloc_deps_e *) xmalloc (sizeof (reloc_deps_e)); + src_edge = xmalloc (sizeof (reloc_deps_e)); memset (src_edge, 0, sizeof (reloc_deps_e)); src_edge->src = src_sec; src_edge->tgt = tgt_sec; src_edge->next = src_sec_deps->succs; src_sec_deps->succs = src_edge; - tgt_edge = (reloc_deps_e *) xmalloc (sizeof (reloc_deps_e)); + tgt_edge = xmalloc (sizeof (reloc_deps_e)); memset (tgt_edge, 0, sizeof (reloc_deps_e)); tgt_edge->src = src_sec; tgt_edge->tgt = tgt_sec; @@ -958,17 +859,14 @@ add_deps_edge (deps, src_sec, tgt_sec) } -void -build_deps_graph_callback (src_sec, src_offset, - target_sec, target_offset, closure) - asection *src_sec; - bfd_vma src_offset ATTRIBUTE_UNUSED; - asection *target_sec; - bfd_vma target_offset ATTRIBUTE_UNUSED; - PTR closure; +static void +build_deps_graph_callback (asection *src_sec, + bfd_vma src_offset ATTRIBUTE_UNUSED, + asection *target_sec, + bfd_vma target_offset ATTRIBUTE_UNUSED, + void *closure) { - reloc_deps_graph *deps; - deps = (reloc_deps_graph*) closure; + reloc_deps_graph *deps = closure; /* If the target is defined. */ if (target_sec != NULL) @@ -976,21 +874,20 @@ build_deps_graph_callback (src_sec, src_offset, } -reloc_deps_graph * -ld_build_required_section_dependence (s) - lang_statement_union_type *s; +static reloc_deps_graph * +ld_build_required_section_dependence (lang_statement_union_type *s) { reloc_deps_graph *deps; xtensa_ld_iter_stack *stack = NULL; - deps = (reloc_deps_graph*) xmalloc (sizeof (reloc_deps_graph)); + deps = xmalloc (sizeof (reloc_deps_graph)); deps->sections = NULL; deps->count = 0; deps->size = 0; - + for (iter_stack_create (&stack, s); !iter_stack_empty (&stack); - iter_stack_next (&stack)) + iter_stack_next (&stack)) { lang_statement_union_type *l = iter_stack_current (&stack); @@ -1003,7 +900,7 @@ ld_build_required_section_dependence (s) &link_info, /* Use the same closure. */ build_deps_graph_callback, - (PTR) deps); + deps); } } return deps; @@ -1011,15 +908,14 @@ ld_build_required_section_dependence (s) #if EXTRA_VALIDATION -size_t -ld_count_children (s) - lang_statement_union_type *s; +static size_t +ld_count_children (lang_statement_union_type *s) { size_t count = 0; xtensa_ld_iter_stack *stack = NULL; for (iter_stack_create (&stack, s); !iter_stack_empty (&stack); - iter_stack_next (&stack)) + iter_stack_next (&stack)) { lang_statement_union_type *l = iter_stack_current (&stack); ASSERT (l != NULL); @@ -1030,9 +926,8 @@ ld_count_children (s) #endif /* EXTRA_VALIDATION */ -void -xtensa_wild_group_interleave_callback (statement) - lang_statement_union_type * statement; +static void +xtensa_wild_group_interleave_callback (lang_statement_union_type *statement) { lang_wild_statement_type *w; reloc_deps_graph *deps; @@ -1069,13 +964,13 @@ xtensa_wild_group_interleave_callback (statement) break; } } - } + } /* Special case until the NOREORDER linker directive is supported: - *(.init) output sections and *(.fini) specs may NOT be reordered. */ + *(.init) output sections and *(.fini) specs may NOT be reordered. */ /* Check for sorting in a section list wildcard spec as well. */ - if (!no_reorder) + if (!no_reorder) { struct wildcard_list *l; for (l = w->section_list; l != NULL; l = l->next) @@ -1095,7 +990,7 @@ xtensa_wild_group_interleave_callback (statement) #endif /* It is now officially a target. Build the graph of source - section -> target section (kept as a list of edges). */ + section -> target section (kept as a list of edges). */ deps = ld_build_required_section_dependence (statement); /* If this wildcard does not reorder.... */ @@ -1124,18 +1019,16 @@ xtensa_wild_group_interleave_callback (statement) } -void -xtensa_wild_group_interleave (s) - lang_statement_union_type *s; +static void +xtensa_wild_group_interleave (lang_statement_union_type *s) { lang_for_each_statement_worker (xtensa_wild_group_interleave_callback, s); } -void -xtensa_layout_wild (deps, w) - const reloc_deps_graph *deps; - lang_wild_statement_type *w; +static void +xtensa_layout_wild (const reloc_deps_graph *deps, + lang_wild_statement_type *w) { /* If it does not fit initially, we need to do this step. Move all of the wild literal sections to a new list, then move each of @@ -1145,7 +1038,7 @@ xtensa_layout_wild (deps, w) size_t old_count, new_count; size_t ct1, ct2; #endif - + lang_wild_statement_type literal_wild; literal_wild.header.next = NULL; literal_wild.header.type = lang_wild_statement_enum; @@ -1167,7 +1060,7 @@ xtensa_layout_wild (deps, w) if (l->header.type == lang_input_section_enum) { if (section_is_target (deps, l) - && ! section_is_source (deps, l)) + && ! section_is_source (deps, l)) { /* Detach. */ *s_p = l->header.next; @@ -1179,7 +1072,7 @@ xtensa_layout_wild (deps, w) *literal_wild.children.tail = l; literal_wild.children.tail = &l->header.next; continue; - } + } } s_p = &(*s_p)->header.next; } @@ -1187,10 +1080,10 @@ xtensa_layout_wild (deps, w) #if EXTRA_VALIDATION ct1 = ld_count_children ((lang_statement_union_type*) w); ct2 = ld_count_children ((lang_statement_union_type*) &literal_wild); - + ASSERT (old_count == (ct1 + ct2)); #endif - + /* Now place them back in front of their dependent sections. */ while (literal_wild.children.head != NULL) @@ -1205,12 +1098,12 @@ xtensa_layout_wild (deps, w) /* Detach. */ literal_wild.children.head = lit->header.next; - if (literal_wild.children.head == NULL) + if (literal_wild.children.head == NULL) literal_wild.children.tail = &literal_wild.children.head; lit->header.next = NULL; /* Find a spot to place it. */ - for (s_p = &w->children.head; *s_p != NULL; s_p = &(*s_p)->header.next) + for (s_p = &w->children.head; *s_p != NULL; s_p = &(*s_p)->header.next) { lang_statement_union_type *src = *s_p; if (deps_has_edge (deps, src, lit)) @@ -1222,7 +1115,7 @@ xtensa_layout_wild (deps, w) break; } } - + if (!placed) { /* Put it at the end. */ @@ -1238,9 +1131,8 @@ xtensa_layout_wild (deps, w) } -void -xtensa_colocate_output_literals_callback (statement) - lang_statement_union_type * statement; +static void +xtensa_colocate_output_literals_callback (lang_statement_union_type *statement) { lang_output_section_statement_type *os; reloc_deps_graph *deps; @@ -1271,7 +1163,7 @@ xtensa_colocate_output_literals_callback (statement) #endif /* It is now officially a target. Build the graph of source - section -> target section (kept as a list of edges). */ + section -> target section (kept as a list of edges). */ deps = ld_build_required_section_dependence (statement); @@ -1290,7 +1182,7 @@ xtensa_colocate_output_literals_callback (statement) /* Insert align/offset assignment statement. */ if (xtensa_use_literal_pages) { - ld_xtensa_insert_page_offsets ((bfd_vma) 0, statement, deps, + ld_xtensa_insert_page_offsets (0, statement, deps, xtensa_use_literal_pages); lang_for_each_statement_worker (xtensa_ldlang_clear_addresses, statement); @@ -1302,21 +1194,19 @@ xtensa_colocate_output_literals_callback (statement) } -void -xtensa_colocate_output_literals (s) - lang_statement_union_type *s; +static void +xtensa_colocate_output_literals (lang_statement_union_type *s) { lang_for_each_statement_worker (xtensa_colocate_output_literals_callback, s); } -void -xtensa_ldlang_clear_addresses (statement) - lang_statement_union_type * statement; +static void +xtensa_ldlang_clear_addresses (lang_statement_union_type *statement) { switch (statement->header.type) { - case lang_input_section_enum: + case lang_input_section_enum: { asection *bfd_section = statement->input_section.section; bfd_section->output_offset = 0; @@ -1328,16 +1218,15 @@ xtensa_ldlang_clear_addresses (statement) } -bfd_vma -ld_assign_relative_paged_dot (dot, s, deps, lit_align) - bfd_vma dot; - lang_statement_union_type *s; - const reloc_deps_graph *deps ATTRIBUTE_UNUSED; - bfd_boolean lit_align; +static bfd_vma +ld_assign_relative_paged_dot (bfd_vma dot, + lang_statement_union_type *s, + const reloc_deps_graph *deps ATTRIBUTE_UNUSED, + bfd_boolean lit_align) { /* Walk through all of the input statements in this wild statement assign dot to all of them. */ - + xtensa_ld_iter_stack *stack = NULL; xtensa_ld_iter_stack **stack_p = &stack; @@ -1346,18 +1235,18 @@ ld_assign_relative_paged_dot (dot, s, deps, lit_align) for (iter_stack_create (stack_p, s); !iter_stack_empty (stack_p); - iter_stack_next (stack_p)) + iter_stack_next (stack_p)) { lang_statement_union_type *l = iter_stack_current (stack_p); - - switch (l->header.type) + + switch (l->header.type) { case lang_input_section_enum: { asection *section = l->input_section.section; size_t align_pow = section->alignment_power; bfd_boolean do_xtensa_alignment = FALSE; - + if (lit_align) { bfd_boolean sec_is_target = section_is_target (deps, l); @@ -1371,7 +1260,7 @@ ld_assign_relative_paged_dot (dot, s, deps, lit_align) do_xtensa_alignment = TRUE; } first_section = FALSE; - if (section->_raw_size != 0) + if (section->_raw_size != 0) in_literals = (sec_is_target && !sec_is_source); } @@ -1397,18 +1286,17 @@ ld_assign_relative_paged_dot (dot, s, deps, lit_align) } -bfd_boolean -ld_local_file_relocations_fit (statement, deps) - lang_statement_union_type *statement; - const reloc_deps_graph *deps ATTRIBUTE_UNUSED; +static bfd_boolean +ld_local_file_relocations_fit (lang_statement_union_type *statement, + const reloc_deps_graph *deps ATTRIBUTE_UNUSED) { /* Walk over all of the dependencies that we identified and make sure that IF the source and target are here (addr != 0): 1) target addr < source addr - 2) (roundup(source + source_size, 4) - rounddown(target, 4)) + 2) (roundup(source + source_size, 4) - rounddown(target, 4)) < (256K - (1 << bad align)) Need a worst-case proof.... */ - + xtensa_ld_iter_stack *stack = NULL; xtensa_ld_iter_stack **stack_p = &stack; size_t max_align_power = 0; @@ -1419,10 +1307,10 @@ ld_local_file_relocations_fit (statement, deps) /* Find the worst-case alignment requirement for this set of statements. */ for (iter_stack_create (stack_p, statement); !iter_stack_empty (stack_p); - iter_stack_next (stack_p)) + iter_stack_next (stack_p)) { lang_statement_union_type *l = iter_stack_current (stack_p); - if (l->header.type == lang_input_section_enum) + if (l->header.type == lang_input_section_enum) { lang_input_section_type *input = &l->input_section; asection *section = input->section; @@ -1435,21 +1323,21 @@ ld_local_file_relocations_fit (statement, deps) for (i = 0; i < deps->count; i++) { asection *sec = deps->sections[i]; - const reloc_deps_section *deps_section = + const reloc_deps_section *deps_section = xtensa_get_section_deps (deps, sec); if (deps_section) { /* We choose to walk through the successors. */ for (e = deps_section->succs; e != NULL; e = e->next) { - if ((e->src != e->tgt) + if (e->src != e->tgt && e->src->output_section == e->tgt->output_section && e->src->output_offset != 0 && e->tgt->output_offset != 0) { - bfd_vma l32r_addr = + bfd_vma l32r_addr = align_power (e->src->output_offset + e->src->_raw_size, 2); - bfd_vma target_addr = e->tgt->output_offset & (~3); + bfd_vma target_addr = e->tgt->output_offset & ~3; if (l32r_addr < target_addr) { fprintf (stderr, "Warning: " @@ -1457,7 +1345,7 @@ ld_local_file_relocations_fit (statement, deps) return FALSE; } - if ((l32r_addr - target_addr) > (256*1024 - align_penalty)) + if (l32r_addr - target_addr > 256 * 1024 - align_penalty) return FALSE; } } @@ -1468,35 +1356,34 @@ ld_local_file_relocations_fit (statement, deps) } -bfd_vma -ld_xtensa_insert_page_offsets (dot, s, deps, lit_align) - bfd_vma dot; - lang_statement_union_type *s; - reloc_deps_graph *deps; - bfd_boolean lit_align; +static bfd_vma +ld_xtensa_insert_page_offsets (bfd_vma dot, + lang_statement_union_type *s, + reloc_deps_graph *deps, + bfd_boolean lit_align) { xtensa_ld_iter_stack *stack = NULL; xtensa_ld_iter_stack **stack_p = &stack; bfd_boolean first_section = FALSE; bfd_boolean in_literals = FALSE; - + if (!lit_align) return FALSE; for (iter_stack_create (stack_p, s); !iter_stack_empty (stack_p); - iter_stack_next (stack_p)) + iter_stack_next (stack_p)) { lang_statement_union_type *l = iter_stack_current (stack_p); - switch (l->header.type) - { + switch (l->header.type) + { case lang_input_section_enum: { asection *section = l->input_section.section; bfd_boolean do_xtensa_alignment = FALSE; - + if (lit_align) { if (section->_raw_size != 0 @@ -1507,7 +1394,7 @@ ld_xtensa_insert_page_offsets (dot, s, deps, lit_align) do_xtensa_alignment = TRUE; } first_section = FALSE; - if (section->_raw_size != 0) + if (section->_raw_size != 0) { in_literals = (section_is_target (deps, l) && !section_is_source (deps, l)); @@ -1527,7 +1414,7 @@ ld_xtensa_insert_page_offsets (dot, s, deps, lit_align) lang_statement_union_type *assign_union; lang_statement_list_type tmplist; lang_statement_list_type *old_stat_ptr = stat_ptr; - + /* There is hidden state in "lang_add_assignment". It appends the new assignment statement to the stat_ptr list. Thus, we swap it before and after the call. */ @@ -1544,12 +1431,12 @@ ld_xtensa_insert_page_offsets (dot, s, deps, lit_align) assign_union->header.next = l; *(*stack_p)->iterloc.loc = assign_union; iter_stack_next (stack_p); - } - } - break; - default: - break; - } + } + } + break; + default: + break; + } } return dot; } |