diff options
author | Ken Raeburn <raeburn@cygnus> | 1995-07-07 22:49:42 +0000 |
---|---|---|
committer | Ken Raeburn <raeburn@cygnus> | 1995-07-07 22:49:42 +0000 |
commit | 943fbd5bd520934ca3a26abb2d5cfbdd2a7659ec (patch) | |
tree | b240b5f343d4689d462e4b642626afbefc87c9f0 /ld | |
parent | c71a604ae102994ad081cb57be24586126048ba6 (diff) | |
download | gdb-943fbd5bd520934ca3a26abb2d5cfbdd2a7659ec.zip gdb-943fbd5bd520934ca3a26abb2d5cfbdd2a7659ec.tar.gz gdb-943fbd5bd520934ca3a26abb2d5cfbdd2a7659ec.tar.bz2 |
fsf address update, but not in COPYING files
Diffstat (limited to 'ld')
-rw-r--r-- | ld/Makefile.in | 14 | ||||
-rw-r--r-- | ld/config.h | 2 | ||||
-rw-r--r-- | ld/emultempl/armpe.em | 4 | ||||
-rw-r--r-- | ld/emultempl/elf32.em | 2 | ||||
-rw-r--r-- | ld/emultempl/i386pe.em | 2 | ||||
-rw-r--r-- | ld/emultempl/m88kbcs.em | 2 | ||||
-rw-r--r-- | ld/emultempl/sunos.em | 28 | ||||
-rw-r--r-- | ld/ld.h | 16 | ||||
-rw-r--r-- | ld/ldfile.c | 186 | ||||
-rw-r--r-- | ld/ldlang.c | 5 | ||||
-rw-r--r-- | ld/ldlang.h | 39 | ||||
-rw-r--r-- | ld/ldmain.c | 2 | ||||
-rw-r--r-- | ld/lexsup.c | 2 | ||||
-rw-r--r-- | ld/mpw-emipsidt.c | 2 | ||||
-rw-r--r-- | ld/mpw-esh.c | 2 | ||||
-rw-r--r-- | ld/mpw-make.in | 2 | ||||
-rw-r--r-- | ld/testsuite/config/default.exp | 6 | ||||
-rw-r--r-- | ld/testsuite/ld-bootstrap/bootstrap.exp | 81 | ||||
-rw-r--r-- | ld/testsuite/ld-cdtest/cdtest.exp | 94 | ||||
-rw-r--r-- | ld/testsuite/ld-empic/empic.exp | 2 | ||||
-rw-r--r-- | ld/testsuite/ld-shared/shared.exp | 165 | ||||
-rw-r--r-- | ld/testsuite/ld-versados/versados.exp | 2 |
22 files changed, 457 insertions, 203 deletions
diff --git a/ld/Makefile.in b/ld/Makefile.in index 17fbf51..a3cb97d 100644 --- a/ld/Makefile.in +++ b/ld/Makefile.in @@ -15,7 +15,7 @@ # # 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., 675 Mass Ave, Cambridge, MA 02139, USA. +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. srcdir = . @@ -196,7 +196,7 @@ LIBIBERTY = ../libiberty/libiberty.a ALL_EMULATIONS = ea29k.o ealpha.o earmaoutl.o earmoutb.o \ ecoff_sparc.o eebmon29k.o \ - eelf32_sparc.o eelf32bmip.o eelf32lmip.o eelf32ppc.o eelf32ppcle.o \ + eelf32_sparc.o eelf32bmip.o eelf32lmip.o eelf32ppc.o eelf32lppc.o \ eelf64_sparc.o eelf_i386.o egld960.o ego32.o eh8300.o \ eh8300h.o eh8500.o eh8500b.o eh8500c.o eh8500m.o eh8500s.o \ ehp300bsd.o ehp3hpux.o ehppaelf.o ei386aout.o ei386bsd.o \ @@ -319,6 +319,12 @@ ei386go32.c: $(srcdir)/emulparams/i386go32.sh \ ei386mach.c: $(srcdir)/emulparams/i386mach.sh \ $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS} ${GENSCRIPTS} i386mach +ei386moss.c: $(srcdir)/emulparams/i386moss.sh \ + $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} + ${GENSCRIPTS} i386moss +ei386msdos.c: $(srcdir)/emulparams/i386msdos.sh \ + $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/i386msdos.sc ${GEN_DEPENDS} + ${GENSCRIPTS} i386msdos eebmon29k.c: $(srcdir)/emulparams/ebmon29k.sh \ $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/ebmon29k.sc ${GEN_DEPENDS} ${GENSCRIPTS} ebmon29k @@ -427,9 +433,9 @@ esparclynx.c: $(srcdir)/emulparams/sparclynx.sh \ eelf32ppc.c: $(srcdir)/emulparams/elf32ppc.sh \ $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} ${GENSCRIPTS} elf32ppc -eelf32ppcle.c: $(srcdir)/emulparams/elf32ppcle.sh \ +eelf32lppc.c: $(srcdir)/emulparams/elf32lppc.sh \ $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} - ${GENSCRIPTS} elf32ppcle + ${GENSCRIPTS} elf32lppc eriscix.c: $(srcdir)/emulparams/riscix.sh \ $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS} ${GENSCRIPTS} riscix diff --git a/ld/config.h b/ld/config.h index 4ca37dc..ae16e88 100644 --- a/ld/config.h +++ b/ld/config.h @@ -16,7 +16,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, 675 Mass Ave, Cambridge, MA 02139, USA. */ + the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* Look in this environment name for the linker to pretend to be */ #define EMULATION_ENVIRON "LDEMULATION" diff --git a/ld/emultempl/armpe.em b/ld/emultempl/armpe.em index bd9dfaa..4e29a0b 100644 --- a/ld/emultempl/armpe.em +++ b/ld/emultempl/armpe.em @@ -31,7 +31,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software -Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define TARGET_IS_armpe @@ -227,4 +227,4 @@ struct ld_emulation_xfer_struct ld_armpe_emulation = "armpe", "pei-arm" }; -EOF
\ No newline at end of file +EOF diff --git a/ld/emultempl/elf32.em b/ld/emultempl/elf32.em index bc84a8f..b3cb74d 100644 --- a/ld/emultempl/elf32.em +++ b/ld/emultempl/elf32.em @@ -22,7 +22,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software -Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define TARGET_IS_${EMULATION_NAME} diff --git a/ld/emultempl/i386pe.em b/ld/emultempl/i386pe.em index 9095ca5..4b18cbd 100644 --- a/ld/emultempl/i386pe.em +++ b/ld/emultempl/i386pe.em @@ -31,7 +31,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software -Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define TARGET_IS_i386pe diff --git a/ld/emultempl/m88kbcs.em b/ld/emultempl/m88kbcs.em index 1d1f05a..9f04936 100644 --- a/ld/emultempl/m88kbcs.em +++ b/ld/emultempl/m88kbcs.em @@ -21,7 +21,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software -Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define TARGET_IS_${EMULATION_NAME} diff --git a/ld/emultempl/sunos.em b/ld/emultempl/sunos.em index d81279b..e18b2fc 100644 --- a/ld/emultempl/sunos.em +++ b/ld/emultempl/sunos.em @@ -22,7 +22,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software -Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define TARGET_IS_${EMULATION_NAME} @@ -100,6 +100,7 @@ gld${EMULATION_NAME}_find_so (inp) char *alc; int max_maj, max_min; char *found; + boolean found_static; struct stat st; if (! inp->search_dirs_flag @@ -115,6 +116,7 @@ gld${EMULATION_NAME}_find_so (inp) len = strlen (filename); else { + force_maj = atoi (dot + 1); len = dot - filename; alc = (char *) alloca (len + 1); strncpy (alc, filename, len); @@ -123,6 +125,7 @@ gld${EMULATION_NAME}_find_so (inp) } found = NULL; + found_static = false; max_maj = max_min = 0; for (search = search_head; search != NULL; search = search->next) { @@ -138,8 +141,17 @@ gld${EMULATION_NAME}_find_so (inp) int found_maj, found_min; if (strncmp (entry->d_name, "lib", 3) != 0 - || strncmp (entry->d_name + 3, inp->filename, len) != 0 - || strncmp (entry->d_name + 3 + len, ".so", 3) != 0) + || strncmp (entry->d_name + 3, inp->filename, len) != 0) + continue; + + if (dot == NULL + && strncmp (entry->d_name + 3 + len, ".a", 2) == 0) + { + found_static = true; + continue; + } + + if (strncmp (entry->d_name + 3 + len, ".so", 3) != 0) continue; /* We've found a .so file. Work out the major and minor @@ -176,7 +188,7 @@ gld${EMULATION_NAME}_find_so (inp) closedir (dir); - if (found != NULL) + if (found != NULL || found_static) break; } @@ -359,7 +371,7 @@ gld${EMULATION_NAME}_before_allocation () if (sdyn != NULL) h->u.def.section = sdyn; else - h->u.def.section = &bfd_abs_section; + h->u.def.section = bfd_abs_section_ptr; } } @@ -555,6 +567,7 @@ struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation = syslib_default, hll_default, after_parse_default, + after_open_default, after_allocation_default, set_output_arch_default, ldemul_default_target, @@ -562,7 +575,8 @@ struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation = gld${EMULATION_NAME}_get_script, "${EMULATION_NAME}", "${OUTPUT_FORMAT}", - 0, /* finish */ - gld${EMULATION_NAME}_create_output_section_statements + NULL, /* finish */ + gld${EMULATION_NAME}_create_output_section_statements, + NULL /* open_dynamic_library */ }; EOF @@ -16,7 +16,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, 675 Mass Ave, Cambridge, MA 02139, USA. */ + the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef LD_H #define LD_H @@ -58,6 +58,17 @@ typedef struct /* Runtime library search path from the -rpath argument. */ char *rpath; + + /* Big or little endian as set on command line. */ + enum { ENDIAN_UNSET = 0, ENDIAN_BIG, ENDIAN_LITTLE } endian; + + /* If true, export all symbols in the dynamic symbol table of an ELF + executable. */ + boolean export_dynamic; + + /* If true, build MIPS embedded PIC relocation tables in the output + file. */ + boolean embedded_relocs; } args_type; extern args_type command_line; @@ -92,6 +103,9 @@ typedef struct FILE *map_file; boolean stats; + + int split_by_reloc; + boolean split_by_file; } ld_config_type; extern ld_config_type config; diff --git a/ld/ldfile.c b/ld/ldfile.c index f084d36..5fd83ee 100644 --- a/ld/ldfile.c +++ b/ld/ldfile.c @@ -14,7 +14,7 @@ GNU General Public License for more details. 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, 675 Mass Ave, Cambridge, MA 02139, USA. */ +the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* ldfile.c @@ -33,29 +33,27 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "ldmain.h" #include "ldgram.h" #include "ldlex.h" +#include "ldemul.h" #include <ctype.h> -char *ldfile_input_filename; +const char *ldfile_input_filename; +boolean ldfile_assumed_script = false; const char *ldfile_output_machine_name = ""; unsigned long ldfile_output_machine; enum bfd_architecture ldfile_output_architecture; search_dirs_type *search_head; -/* start-sanitize-mpw */ #ifndef MPW -/* end-sanitize-mpw */ #ifdef VMS char *slash = ""; #else char *slash = "/"; #endif -/* start-sanitize-mpw */ #else /* MPW */ /* The MPW path char is a colon. */ char *slash = ":"; #endif /* MPW */ -/* end-sanitize-mpw */ /* LOCAL */ @@ -70,11 +68,9 @@ typedef struct search_arch static search_arch_type *search_arch_head; static search_arch_type **search_arch_tail_ptr = &search_arch_head; -static bfd *cached_bfd_openr PARAMS ((const char *attempt, - lang_input_statement_type *entry)); -static bfd *open_a PARAMS ((char *arch, lang_input_statement_type *entry, - char *lib, char *suffix)); -static FILE *try_open PARAMS ((char *name, char *exten)); +static boolean try_open_bfd PARAMS ((const char *attempt, + lang_input_statement_type *entry)); +static FILE *try_open PARAMS ((const char *name, const char *exten)); void ldfile_add_library_path (name, cmdline) @@ -91,85 +87,93 @@ ldfile_add_library_path (name, cmdline) search_tail_ptr = &new->next; } +/* Try to open a BFD for a lang_input_statement. */ -static bfd * -cached_bfd_openr(attempt,entry) +static boolean +try_open_bfd (attempt, entry) const char *attempt; - lang_input_statement_type *entry; + lang_input_statement_type *entry; { - entry->the_bfd = bfd_openr(attempt, entry->target); - if (trace_file_tries == true ) { + entry->the_bfd = bfd_openr (attempt, entry->target); + + if (trace_file_tries) info_msg ("attempt to open %s %s\n", attempt, - (entry->the_bfd == (bfd *)NULL) ? "failed" : "succeeded" ); - } - return entry->the_bfd; + entry->the_bfd == NULL ? "failed" : "succeeded"); + + if (entry->the_bfd != NULL) + return true; + else + return false; } -static bfd * -open_a(arch, entry, lib, suffix) - char *arch; +/* Search for and open the file specified by ENTRY. If it is an + archive, use ARCH, LIB and SUFFIX to modify the file name. */ + +boolean +ldfile_open_file_search (arch, entry, lib, suffix) + const char *arch; lang_input_statement_type *entry; - char *lib; - char *suffix; + const char *lib; + const char *suffix; { - bfd*desc; - search_dirs_type *search ; + search_dirs_type *search; /* If this is not an archive, try to open it in the current directory first. */ if (! entry->is_archive) { - desc = cached_bfd_openr (entry->filename, entry); - if (desc != NULL) - return desc; + if (try_open_bfd (entry->filename, entry)) + return true; } for (search = search_head; search != (search_dirs_type *)NULL; search = search->next) { - char buffer[1000]; char *string; - if (entry->is_archive == true) { - sprintf(buffer, - "%s%s%s%s%s%s", - search->name, - slash, - lib, - entry->filename, arch, suffix); - } - else { - if (entry->filename[0] == '/' || entry->filename[0] == '.') { - strcpy(buffer, entry->filename); - } else { - sprintf(buffer,"%s%s%s",search->name, slash, entry->filename); - } - } - string = buystring(buffer); - desc = cached_bfd_openr (string, entry); - if (desc) + + string = (char *) xmalloc (strlen (search->name) + + strlen (slash) + + strlen (lib) + + strlen (entry->filename) + + strlen (arch) + + strlen (suffix) + + 1); + + if (entry->is_archive) + sprintf (string, "%s%s%s%s%s%s", search->name, slash, + lib, entry->filename, arch, suffix); + else if (entry->filename[0] == '/' || entry->filename[0] == '.') + strcpy (string, entry->filename); + else + sprintf (string, "%s%s%s", search->name, slash, entry->filename); + + if (try_open_bfd (string, entry)) { entry->filename = string; - entry->the_bfd = desc; - return desc; + return true; } - free(string); + + free (string); } - return (bfd *)NULL; + + return false; } -/* Open the input file specified by 'entry', and return a descriptor. - The open file is remembered; if the same file is opened twice in a row, - a new open is not actually done. */ +/* Open the input file specified by ENTRY. */ void ldfile_open_file (entry) lang_input_statement_type *entry; { - ASSERT (entry->the_bfd == NULL); + if (entry->the_bfd != NULL) + return; if (! entry->search_dirs_flag) - entry->the_bfd = cached_bfd_openr (entry->filename, entry); + { + if (try_open_bfd (entry->filename, entry)) + return; + } else { search_arch_type *arch; @@ -181,55 +185,58 @@ ldfile_open_file (entry) { if (config.dynamic_link) { - /* FIXME: Perhaps we will sometimes want something other - than .so. */ - if (open_a (arch->name, entry, "lib", ".so") != (bfd *) NULL) + if (ldemul_open_dynamic_archive (arch->name, entry)) return; } - if (open_a (arch->name, entry, "lib", ".a") != (bfd *) NULL) + if (ldfile_open_file_search (arch->name, entry, "lib", ".a")) return; #ifdef VMS - if (open_a (arch->name, entry, ":lib", ".a") != (bfd *) NULL) + if (ldfile_open_file_search (arch->name, entry, ":lib", ".a")) return; #endif } } - if (entry->the_bfd == NULL) - einfo("%F%P: cannot open %s: %E\n", entry->local_sym_name); + einfo("%F%P: cannot open %s: %E\n", entry->local_sym_name); } /* Try to open NAME; if that fails, try NAME with EXTEN appended to it. */ static FILE * -try_open(name, exten) - char *name; - char *exten; +try_open (name, exten) + const char *name; + const char *exten; { FILE *result; char buff[1000]; - result = fopen(name, "r"); - if (trace_file_tries == true) { - if (result == (FILE *)NULL) { - info_msg ("cannot find "); + result = fopen (name, "r"); + if (trace_file_tries) + { + if (result == NULL) + info_msg ("cannot find script file "); + else + info_msg ("opened script file "); + info_msg ("%s\n",name); } - info_msg ("%s\n",name); - } - if (result != (FILE *)NULL) { + + if (result != NULL) return result; - } - if (*exten) { - sprintf(buff, "%s%s", name, exten); - result = fopen(buff, "r"); - if (trace_file_tries == true) { - if (result == (FILE *)NULL) { - info_msg ("cannot find "); - } - info_msg ("%s\n", buff); + if (*exten) + { + sprintf (buff, "%s%s", name, exten); + result = fopen (buff, "r"); + if (trace_file_tries) + { + if (result == NULL) + info_msg ("cannot find script file "); + else + info_msg ("opened script file "); + info_msg ("%s\n", buff); + } } - } + return result; } @@ -237,9 +244,9 @@ try_open(name, exten) specified with -L, without and with EXTEND apppended. */ FILE * -ldfile_find_command_file(name, extend) -char *name; -char *extend; +ldfile_find_command_file (name, extend) + const char *name; + const char *extend; { search_dirs_type *search; FILE *result; @@ -261,8 +268,8 @@ char *extend; } void -ldfile_open_command_file(name) -char *name; +ldfile_open_command_file (name) + const char *name; { FILE *ldlex_input_stack; ldlex_input_stack = ldfile_find_command_file(name, ""); @@ -274,6 +281,7 @@ char *name; lex_push_file(ldlex_input_stack, name); ldfile_input_filename = name; + lineno = 1; had_script = true; } diff --git a/ld/ldlang.c b/ld/ldlang.c index 3c9350d..352f0f1 100644 --- a/ld/ldlang.c +++ b/ld/ldlang.c @@ -15,7 +15,7 @@ GNU General Public License for more details. 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, 675 Mass Ave, Cambridge, MA 02139, USA. */ +the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "bfd.h" #include "sysdep.h" @@ -1872,6 +1872,7 @@ lang_size_sections (s, output_section_statement, prev, fill, dot, relax) } dot += size; output_section_statement->bfd_section->_raw_size += size; + output_section_statement->bfd_section->flags |= SEC_HAS_CONTENTS; } break; @@ -2781,7 +2782,7 @@ lang_add_entry (name, cmdline) entry_symbol = name; from_cmdline = cmdline; } -#ifdef 0 /* WINDOWS_NT */ +#if 0 /* don't do this yet. It seems to work (the executables run), but the image created is very different from what I was getting before indicating that something else is being pulled in. When everything else is working, diff --git a/ld/ldlang.h b/ld/ldlang.h index a4e3ca7..5e05017 100644 --- a/ld/ldlang.h +++ b/ld/ldlang.h @@ -1,5 +1,5 @@ /* ldlang.h - linker command language support - Copyright 1991, 1992, 1993 Free Software Foundation, Inc. + Copyright 1991, 1992, 1993, 1994, 1995 Free Software Foundation, Inc. This file is part of GLD, the Gnu Linker. @@ -15,7 +15,7 @@ You should have received a copy of the GNU General Public License along with GLD; see the file COPYING. If not, write to - the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ + the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef LDLANG_H #define LDLANG_H @@ -68,7 +68,8 @@ typedef struct lang_statement_header_struct lang_target_statement_enum, lang_output_statement_enum, lang_padding_statement_enum, - + lang_group_statement_enum, + lang_afile_asection_pair_statement_enum, lang_constructors_statement_enum } type; @@ -159,7 +160,7 @@ typedef struct bfd_reloc_code_real_type reloc; /* Reloc howto structure. */ - const reloc_howto_type *howto; + reloc_howto_type *howto; /* Section to generate reloc against. Exactly one of section and name must be NULL. */ @@ -270,6 +271,17 @@ typedef struct fill_type fill; } lang_padding_statement_type; +/* A group statement collects a set of libraries together. The + libraries are searched multiple times, until no new undefined + symbols are found. The effect is to search a group of libraries as + though they were a single library. */ + +typedef struct +{ + lang_statement_header_type header; + lang_statement_list_type children; +} lang_group_statement_type; + typedef union lang_statement_union { lang_statement_header_type header; @@ -289,6 +301,7 @@ typedef union lang_statement_union lang_object_symbols_statement_type object_symbols_statement; lang_fill_statement_type fill_statement; lang_padding_statement_type padding_statement; + lang_group_statement_type group_statement; } lang_statement_union_type; extern lang_output_section_statement_type *abs_output_section; @@ -331,8 +344,15 @@ extern void lang_abs_symbol_at_beginning_of PARAMS ((const char *, extern void lang_statement_append PARAMS ((struct statement_list *, union lang_statement_union *, union lang_statement_union **)); +extern void lang_for_each_input_file + PARAMS ((void (*dothis) (lang_input_statement_type *))); extern void lang_for_each_file PARAMS ((void (*dothis) (lang_input_statement_type *))); +extern bfd_vma lang_do_assignments + PARAMS ((lang_statement_union_type * s, + lang_output_section_statement_type *output_section_statement, + fill_type fill, + bfd_vma dot)); #define LANG_FOR_EACH_INPUT_STATEMENT(statement) \ extern lang_statement_list_type file_chain; \ @@ -352,11 +372,12 @@ extern void lang_add_keepsyms_file PARAMS ((const char *filename)); extern lang_output_section_statement_type * lang_output_section_statement_lookup PARAMS ((const char * const name)); extern void ldlang_add_undef PARAMS ((const char *const name)); -extern void lang_add_output_format PARAMS ((const char *, int from_script)); +extern void lang_add_output_format PARAMS ((const char *, const char *, + const char *, int from_script)); extern void lang_list_init PARAMS ((lang_statement_list_type*)); extern void lang_add_data PARAMS ((int type, union etree_union *)); extern void lang_add_reloc - PARAMS ((bfd_reloc_code_real_type reloc, const reloc_howto_type *howto, + PARAMS ((bfd_reloc_code_real_type reloc, reloc_howto_type *howto, asection *section, const char *name, union etree_union *addend)); extern void lang_for_each_statement PARAMS ((void (*func) (lang_statement_union_type *))); @@ -366,5 +387,11 @@ extern bfd_vma lang_size_sections lang_output_section_statement_type *output_section_statement, lang_statement_union_type **prev, fill_type fill, bfd_vma dot, boolean relax)); +extern void lang_enter_group PARAMS ((void)); +extern void lang_leave_group PARAMS ((void)); +extern void wild_doit + PARAMS ((lang_statement_list_type *ptr, asection *section, + lang_output_section_statement_type *output, + lang_input_statement_type *file)); #endif diff --git a/ld/ldmain.c b/ld/ldmain.c index dd7c6ae..a0f5eb5 100644 --- a/ld/ldmain.c +++ b/ld/ldmain.c @@ -16,7 +16,7 @@ GNU General Public License for more details. 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, 675 Mass Ave, Cambridge, MA 02139, USA. */ +the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "bfd.h" diff --git a/ld/lexsup.c b/ld/lexsup.c index f361eae..6557f05 100644 --- a/ld/lexsup.c +++ b/ld/lexsup.c @@ -15,7 +15,7 @@ GNU General Public License for more details. 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, 675 Mass Ave, Cambridge, MA 02139, USA. */ +the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "bfd.h" #include "sysdep.h" diff --git a/ld/mpw-emipsidt.c b/ld/mpw-emipsidt.c index 2a791bf..498f688 100644 --- a/ld/mpw-emipsidt.c +++ b/ld/mpw-emipsidt.c @@ -18,7 +18,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software -Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define TARGET_IS_mipsidt diff --git a/ld/mpw-esh.c b/ld/mpw-esh.c index 6aef853..dac5c79 100644 --- a/ld/mpw-esh.c +++ b/ld/mpw-esh.c @@ -18,7 +18,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software -Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define TARGET_IS_sh diff --git a/ld/mpw-make.in b/ld/mpw-make.in index 0e1361c..cb325e3 100644 --- a/ld/mpw-make.in +++ b/ld/mpw-make.in @@ -29,7 +29,7 @@ o = : # # 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., 675 Mass Ave, Cambridge, MA 02139, USA. +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # srcdir = : diff --git a/ld/testsuite/config/default.exp b/ld/testsuite/config/default.exp index 4558ebc..24c04b8 100644 --- a/ld/testsuite/config/default.exp +++ b/ld/testsuite/config/default.exp @@ -13,7 +13,7 @@ # # 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ # # Written by Jeffrey Wheat (cassidy@cygnus.com) # @@ -30,6 +30,10 @@ if ![info exists nm] then { set nm [findfile $base_dir/../binutils/nm.new $base_dir/../binutils/nm.new [transform nm]] } +if ![info exists objdump] then { + set objdump [findfile $base_dir/../binutils/objdump] +} + if ![file isdirectory tmpdir] {catch "exec mkdir tmpdir" status} # load the utility procedures diff --git a/ld/testsuite/ld-bootstrap/bootstrap.exp b/ld/testsuite/ld-bootstrap/bootstrap.exp new file mode 100644 index 0000000..c149744 --- /dev/null +++ b/ld/testsuite/ld-bootstrap/bootstrap.exp @@ -0,0 +1,81 @@ +# Expect script for LD Bootstrap Tests +# Copyright (C) 1993,1994,1995 Free Software Foundation +# +# This file is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# 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. */ +# +# Written by Jeffrey Wheat (cassidy@cygnus.com) +# Rewritten by Ian Lance Taylor (ian@cygnus.com) +# + +# Make sure that ld can bootstrap itself. + +# This test can only be run if ld generates native executables. +if ![isnative] { + return +} + +# Bootstrap ld. First link the object files together using -r, in +# order to test -r. Then link the result into an executable, ld1, to +# really test -r. Use ld1 to link a fresh ld, ld2. Use ld2 to link a +# new ld, ld3. ld2 and ld3 should be identical. + +foreach flags {"" "--static" "--traditional-format" "--no-keep-memory"} { + if {"$flags" != ""} { + set testname "bootstrap with $flags" + } else { + set testname "bootstrap" + } + + # This test can only be run if we have the ld build directory, + # since we need the object files. + if {$ld != "$objdir/ld.new"} { + untested $testname + continue + } + + if ![ld_relocate $ld tmpdir/ld-partial.o "$flags $OFILES"] { + fail $testname + continue + } + + if ![ld_link $ld tmpdir/ld1 "$flags tmpdir/ld-partial.o $BFDLIB $LIBIBERTY"] { + fail $testname + continue + } + + if ![ld_link tmpdir/ld1 tmpdir/ld2 "$flags $OFILES $BFDLIB $LIBIBERTY"] { + fail $testname + continue + } + + if ![ld_link tmpdir/ld2 tmpdir/ld3 "$flags $OFILES $BFDLIB $LIBIBERTY"] { + fail $testname + continue + } + + send_log "cmp tmpdir/ld2 tmpdir/ld3\n" + verbose "cmp tmpdir/ld2 tmpdir/ld3" + catch "exec cmp tmpdir/ld2 tmpdir/ld3" exec_output + set exec_output [prune_system_crud $host_triplet $exec_output] + + if [string match "" $exec_output] then { + pass $testname + } else { + send_log "$exec_output\n" + verbose "$exec_output" 1 + + fail $testname + } +} diff --git a/ld/testsuite/ld-cdtest/cdtest.exp b/ld/testsuite/ld-cdtest/cdtest.exp new file mode 100644 index 0000000..68be616 --- /dev/null +++ b/ld/testsuite/ld-cdtest/cdtest.exp @@ -0,0 +1,94 @@ +# Expect script for LD cdtest Tests +# Copyright (C) 1993,1994,1995 Free Software Foundation +# +# This file is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# 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. */ +# +# Written by Jeffrey Wheat (cassidy@cygnus.com) +# Rewritten by Ian Lance Taylor (ian@cygnus.com) +# + +# Make sure that constructors are handled correctly. + +set test1 "cdtest" +set test2 "cdtest with -Ur" + +# This test requires running the executable generated by ld. +if ![isnative] { + return +} + +if { ![ld_compile "$CXX $CXXFLAGS -fgnu-linker" $srcdir$subdir/cdtest-foo.cc tmpdir/cdtest-foo.o] + || ![ld_compile "$CXX $CXXFLAGS -fgnu-linker" $srcdir$subdir/cdtest-bar.cc tmpdir/cdtest-bar.o] + || ![ld_compile "$CXX $CXXFLAGS -fgnu-linker" $srcdir$subdir/cdtest-main.cc tmpdir/cdtest-main.o] } { + unresolved $test1 + unresolved $test2 + return +} + +if ![ld_link $ld tmpdir/cdtest {tmpdir/cdtest-foo.o tmpdir/cdtest-bar.o tmpdir/cdtest-main.o}] { + fail $test1 +} else { + send_log "tmpdir/cdtest >tmpdir/cdtest.out\n" + verbose "tmpdir/cdtest >tmpdir/cdtest.out" + catch "exec tmpdir/cdtest >tmpdir/cdtest.out" exec_output + if ![string match "" $exec_output] then { + send_log "$exec_output\n" + verbose "$exec_output" 1 + fail $test1 + } else { + send_log "diff tmpdir/cdtest.out $srcdir$subdir/cdtest.dat\n" + verbose "diff tmpdir/cdtest.out $srcdir$subdir/cdtest.dat" + catch "exec diff tmpdir/cdtest.out $srcdir$subdir/cdtest.dat" exec_output + set exec_output [prune_system_crud $host_triplet $exec_output] + + if [string match "" $exec_output] then { + pass $test1 + } else { + send_log "$exec_output\n" + verbose "$exec_output" 1 + fail $test1 + } + } +} + +if ![ld_relocate $ld tmpdir/cdtest.o {-Ur tmpdir/cdtest-foo.o tmpdir/cdtest-bar.o tmpdir/cdtest-main.o}] { + fail $test2 +} else { + if ![ld_link $ld tmpdir/cdtest tmpdir/cdtest.o] { + fail $test2 + } else { + send_log "tmpdir/cdtest >tmpdir/cdtest.out\n" + verbose "tmpdir/cdtest >tmpdir/cdtest.out" + catch "exec tmpdir/cdtest >tmpdir/cdtest.out" exec_output + if ![string match "" $exec_output] then { + send_log "$exec_output\n" + verbose "$exec_output" 1 + fail $test2 + } else { + send_log "diff tmpdir/cdtest.out $srcdir$subdir/cdtest.dat\n" + verbose "diff tmpdir/cdtest.out $srcdir$subdir/cdtest.dat" + catch "exec diff tmpdir/cdtest.out $srcdir$subdir/cdtest.dat" exec_output + set exec_output [prune_system_crud $host_triplet $exec_output] + + if [string match "" $exec_output] then { + pass $test2 + } else { + send_log "$exec_output\n" + verbose "$exec_output" 1 + fail $test2 + } + } + } +} diff --git a/ld/testsuite/ld-empic/empic.exp b/ld/testsuite/ld-empic/empic.exp index 9cc1b07..8d91182 100644 --- a/ld/testsuite/ld-empic/empic.exp +++ b/ld/testsuite/ld-empic/empic.exp @@ -13,7 +13,7 @@ # # 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ # # Written by Ian Lance Taylor (ian@cygnus.com) # diff --git a/ld/testsuite/ld-shared/shared.exp b/ld/testsuite/ld-shared/shared.exp index d836a2a..18bdaf9 100644 --- a/ld/testsuite/ld-shared/shared.exp +++ b/ld/testsuite/ld-shared/shared.exp @@ -1,5 +1,5 @@ # Expect script for ld-shared tests -# Copyright (C) 1994 Free Software Foundation +# Copyright (C) 1994,1995 Free Software Foundation # # This file is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -13,7 +13,7 @@ # # 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ # # Written by Ian Lance Taylor (ian@cygnus.com) # @@ -41,57 +41,55 @@ if { ![istarget i386-*-sysv4*] \ return } -# Compile the main program. -if ![ld_compile "$CC $CFLAGS" $srcdir$subdir/main.c tmpdir/main.o] { - return -} +# The test procedure. +proc shared_test { progname testname main sh1 sh2 } { + global ld + global srcdir + global subdir + global exec_output + global host_triplet -# The shared library is composed of two files. First compile them -# without using -fpic. That should work on an ELF system, although it -# will be less efficient because the dynamic linker will need to do -# more relocation work. However, note that not using -fpic will cause -# some of the tests to return different results. -if ![ld_compile "$CC $CFLAGS" $srcdir$subdir/sh1.c tmpdir/sh1.o] { - return -} -if ![ld_compile "$CC $CFLAGS" $srcdir$subdir/sh2.c tmpdir/sh2.o] { - return -} + # Build the shared library. + if {![ld_simple_link $ld tmpdir/$progname.so "-shared tmpdir/$sh1 tmpdir/$sh2"]} { + fail "$testname" + return + } -# Build the shared library. -if ![ld_simple_link $ld tmpdir/shnonpic.so {-shared tmpdir/sh1.o tmpdir/sh2.o}] { - fail "shared (non PIC)" -} else { - # Link against the shared library. Use -rpath so that the dynamic - # linker can locate the shared library at runtime. - if ![ld_link $ld tmpdir/shnonpic {-rpath tmpdir tmpdir/main.o tmpdir/shnonpic.so}] { - fail "shared (non PIC)" - } else { - # Run the resulting program - send_log "tmpdir/shnonpic >tmpdir/shnonpic.out\n" - verbose "tmpdir/shnonpic >tmpdir/shnonpic.out" - catch "exec tmpdir/shnonpic >tmpdir/shnonpic.out" exec_output - if ![string match "" $exec_output] then { - send_log "$exec_output\n" - verbose "$exec_output" - fail "shared (non PIC)" - } else { - send_log "diff tmpdir/shnonpic.out $srcdir$subdir/shared.dat\n" - verbose "diff tmpdir/shnonpic.out $srcdir$subdir/shared.dat" - catch "exec diff tmpdir/shnonpic.out $srcdir$subdir/shared.dat" exec_output - if [string match "" $exec_output] then { - pass "shared (non PIC)" - } else { - send_log "$exec_output\n" - verbose "$exec_output" - fail "shared (non PIC)" - } - } + # Link against the shared library. Use -rpath so that the + # dynamic linker can locate the shared library at runtime. + if ![ld_link $ld tmpdir/$progname "-rpath tmpdir tmpdir/$main tmpdir/$progname.so"] { + fail "$testname" + return + } + + # Run the resulting program + send_log "tmpdir/$progname >tmpdir/$progname.out\n" + verbose "tmpdir/$progname >tmpdir/$progname.out" + catch "exec tmpdir/$progname >tmpdir/$progname.out" exec_output + if ![string match "" $exec_output] then { + send_log "$exec_output\n" + verbose "$exec_output" + fail "$testname" + return + } + + send_log "diff tmpdir/$progname.out $srcdir$subdir/shared.dat\n" + verbose "diff tmpdir/$progname.out $srcdir$subdir/shared.dat" + catch "exec diff tmpdir/$progname.out $srcdir$subdir/shared.dat" exec_output + set exec_output [prune_system_crud $host_triplet $exec_output] + + if {![string match "" $exec_output]} then { + send_log "$exec_output\n" + verbose "$exec_output" + fail "$testname" + return } + + pass "$testname" } -# Now compile the code using -fpic. Unfortunately, the gcc argument -# is -fpic and the cc argument is -KPIC. We have to try both. +# Unfortunately, the gcc argument is -fpic and the cc argument is +# -KPIC. We have to try both. set picflag "-fpic" send_log "$CC $picflag\n" @@ -106,41 +104,48 @@ if { [string match "*illegal option*" $exec_output] \ } verbose "Using $picflag to compile PIC code" -if ![ld_compile "$CC $CFLAGS $picflag" $srcdir$subdir/sh1.c tmpdir/sh1.o] { - return -} -if ![ld_compile "$CC $CFLAGS $picflag" $srcdir$subdir/sh2.c tmpdir/sh2.o] { - return +# Compile the main program. +if ![ld_compile "$CC $CFLAGS" $srcdir$subdir/main.c tmpdir/mainnp.o] { + unresolved "shared (non PIC)" + unresolved "shared" +} else { + # The shared library is composed of two files. First compile them + # without using -fpic. That should work on an ELF system, + # although it will be less efficient because the dynamic linker + # will need to do more relocation work. However, note that not + # using -fpic will cause some of the tests to return different + # results. + if { ![ld_compile "$CC $CFLAGS" $srcdir$subdir/sh1.c tmpdir/sh1np.o] + || ![ld_compile "$CC $CFLAGS" $srcdir$subdir/sh2.c tmpdir/sh2np.o] } { + unresolved "shared (non PIC)" + } else { + shared_test shnp "shared (non PIC)" mainnp.o sh1np.o sh2np.o + } + + # Now compile the code using -fpic. + + if { ![ld_compile "$CC $CFLAGS $picflag" $srcdir$subdir/sh1.c tmpdir/sh1p.o] + || ![ld_compile "$CC $CFLAGS $picflag" $srcdir$subdir/sh2.c tmpdir/sh2p.o] } { + unresolved "shared" + } else { + shared_test shp "shared" mainnp.o sh1p.o sh2p.o + } } -# Build the shared library. -if ![ld_simple_link $ld tmpdir/shpic.so {-shared tmpdir/sh1.o tmpdir/sh2.o}] { - fail "shared" +# Now do the same tests again, but this time compile main.c PIC. +if ![ld_compile "$CC $CFLAGS $picflag" $srcdir$subdir/main.c tmpdir/mainp.o] { + unresolved "shared (PIC main, non PIC so)" + unresolved "shared (PIC main)" } else { - # Link against the shared library. Use -rpath so that the dynamic - # linker can locate the shared library at runtime. - if ![ld_link $ld tmpdir/shpic {-rpath tmpdir tmpdir/main.o tmpdir/shpic.so}] { - fail "shared" + if { [file exists tmpdir/sh1np.o ] && [ file exists tmpdir/sh2np.o ] } { + shared_test shmpnp "shared (PIC main, non PIC so)" mainp.o sh1np.o sh2np.o + } else { + unresolved "shared (PIC main, non PIC so)" + } + + if { [file exists tmpdir/sh1p.o ] && [ file exists tmpdir/sh2p.o ] } { + shared_test shmpp "shared (PIC main)" mainp.o sh1p.o sh2p.o } else { - # Run the resulting program - send_log "tmpdir/shpic >tmpdir/shpic.out\n" - verbose "tmpdir/shpic >tmpdir/shpic.out" - catch "exec tmpdir/shpic >tmpdir/shpic.out" exec_output - if ![string match "" $exec_output] then { - send_log "$exec_output\n" - verbose "$exec_output" - fail "shared" - } else { - send_log "diff tmpdir/shpic.out $srcdir$subdir/shared.dat\n" - verbose "diff tmpdir/shpic.out $srcdir$subdir/shared.dat" - catch "exec diff tmpdir/shpic.out $srcdir$subdir/shared.dat" exec_output - if [string match "" $exec_output] then { - pass "shared" - } else { - send_log "$exec_output\n" - verbose "$exec_output" - fail "shared" - } - } + unresolved "shared (PIC main)" } } diff --git a/ld/testsuite/ld-versados/versados.exp b/ld/testsuite/ld-versados/versados.exp index 4b33c0a..46a465f 100644 --- a/ld/testsuite/ld-versados/versados.exp +++ b/ld/testsuite/ld-versados/versados.exp @@ -13,7 +13,7 @@ # # 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ # # Written by Steve Chamberlain (sac@cygnus.com) # |