From 23867d6732552f52477a306fca55a145f1c99730 Mon Sep 17 00:00:00 2001 From: Chris Demetriou Date: Wed, 21 Apr 2004 20:52:31 +0000 Subject: [PATCH] [ bfd/ChangeLog ] 2004-04-21 Chris Demetriou * coff-mips.c (bfd_mips_ecoff_create_embedded_relocs): Remove. * elf32-mips.c (bfd_mips_elf32_create_embedded_relocs): Remove. * bfd-in.h (bfd_mips_ecoff_create_embedded_relocs) (bfd_mips_elf32_create_embedded_relocs): Remove prototypes * bfd-in2.h: Regenerate. [ ld/ChangeLog ] 2004-04-21 Chris Demetriou * ld.texinfo: Remove MIPS --embedded-relocs documentation. * emulparams/elf32bmip.sh (EXTRA_EM_FILE): Remove definition. * emulparams/mipsidt.sh (TEMPLATE_NAME): Use generic.em. (EXTRA_EM_FILE): Use mipsecoff.em * emulparams/mipsidtl.sh (TEMPLATE_NAME): Use generic.em. (EXTRA_EM_FILE): Use mipsecoff.em * emultempl/mipsecoff.em: Restructure to be included as an extra emulation file. (check_sections, gld${EMULATION_NAME}_after_open) (gld${EMULATION_NAME}_after_allocation) (gld${EMULATION_NAME}_get_script) (ld_${EMULATION_NAME}_emulation): Remove (gld${EMULATION_NAME}_before_parse): Rename to... (mipsecoff_before_parse): This. (LDEMUL_BEFORE_PARSE): Define. * emultempl/mipself.em: Remove file. * scripttempl/mips.sc (.rel.sdata): Do not include in output. (__runtime_reloc_start, __runtime_reloc_stop): Stop providing these symbols. * Makefile.am: Remove dependencies on emultempl/mipself.em. * Makefile.in: Regenerate. [ ld/testsuite/ChangeLog ] 2004-04-21 Chris Demetriou * ld-empic/run.c: Removed as part of MIPS --embedded-relocs removal. * ld-empic/empic.exp: Likewise. * ld-empic/relax.t: Likewise. * ld-empic/relax1.c: Likewise. * ld-empic/relax2.c: Likewise. * ld-empic/relax3.c: Likewise. * ld-empic/relax4.c: Likewise. * ld-empic/runtest1.c: Likewise. * ld-empic/runtest2.c: Likewise. * ld-empic/runtesti.s: Likewise. * ld-mips-elf/empic1-ln.d: Likewise. * ld-mips-elf/empic1-lp.d: Likewise. * ld-mips-elf/empic1-mn.d: Likewise. * ld-mips-elf/empic1-mp.d: Likewise. * ld-mips-elf/empic1-ref.s: Likewise. * ld-mips-elf/empic1-sn.d: Likewise. * ld-mips-elf/empic1-sp.d: Likewise. * ld-mips-elf/empic1-space.s: Likewise. * ld-mips-elf/empic1-tgt.s: Likewise. * ld-mips-elf/empic2-fwd-0.d: Likewise. * ld-mips-elf/empic2-fwd-1.d: Likewise. * ld-mips-elf/empic2-fwd-tgt.s: Likewise. * ld-mips-elf/empic2-ref.s: Likewise. * ld-mips-elf/empic2-rev-0.d: Likewise. * ld-mips-elf/empic2-rev-1.d: Likewise. * ld-mips-elf/empic2-rev-tgt.s: Likewise. * ld-mips-elf/empic2-space.s: Likewise. * ld-mips-elf/emrelocs-eb.d: Likewise. * ld-mips-elf/emrelocs-el.d: Likewise. * ld-mips-elf/emrelocs.ld: Likewise. * ld-mips-elf/emrelocs1.s: Likewise. * ld-mips-elf/emrelocs2.s: Likewise. * ld-mips-elf/mips-elf.exp: Don't run now-removed tests. --- bfd/ChangeLog | 8 + bfd/bfd-in.h | 4 - bfd/bfd-in2.h | 4 - bfd/coff-mips.c | 126 -------------- bfd/elf32-mips.c | 133 --------------- ld/ChangeLog | 24 +++ ld/Makefile.am | 16 +- ld/Makefile.in | 16 +- ld/emulparams/elf32bmip.sh | 1 - ld/emulparams/mipsidt.sh | 3 +- ld/emulparams/mipsidtl.sh | 3 +- ld/emultempl/mipsecoff.em | 255 +++-------------------------- ld/emultempl/mipself.em | 177 -------------------- ld/ld.texinfo | 9 - ld/scripttempl/mips.sc | 3 - ld/testsuite/ChangeLog | 36 ++++ ld/testsuite/ld-empic/empic.exp | 263 ------------------------------ ld/testsuite/ld-empic/relax.t | 49 ------ ld/testsuite/ld-empic/relax1.c | 22 --- ld/testsuite/ld-empic/relax2.c | 19 --- ld/testsuite/ld-empic/relax3.c | 3 - ld/testsuite/ld-empic/relax4.c | 3 - ld/testsuite/ld-empic/run.c | 160 ------------------ ld/testsuite/ld-empic/runtest1.c | 117 ------------- ld/testsuite/ld-empic/runtest2.c | 26 --- ld/testsuite/ld-empic/runtesti.s | 94 ----------- ld/testsuite/ld-mips-elf/empic1-ln.d | 27 --- ld/testsuite/ld-mips-elf/empic1-lp.d | 26 --- ld/testsuite/ld-mips-elf/empic1-mn.d | 25 --- ld/testsuite/ld-mips-elf/empic1-mp.d | 25 --- ld/testsuite/ld-mips-elf/empic1-ref.s | 9 - ld/testsuite/ld-mips-elf/empic1-sn.d | 23 --- ld/testsuite/ld-mips-elf/empic1-sp.d | 23 --- ld/testsuite/ld-mips-elf/empic1-space.s | 5 - ld/testsuite/ld-mips-elf/empic1-tgt.s | 8 - ld/testsuite/ld-mips-elf/empic2-fwd-0.d | 20 --- ld/testsuite/ld-mips-elf/empic2-fwd-1.d | 21 --- ld/testsuite/ld-mips-elf/empic2-fwd-tgt.s | 7 - ld/testsuite/ld-mips-elf/empic2-ref.s | 7 - ld/testsuite/ld-mips-elf/empic2-rev-0.d | 22 --- ld/testsuite/ld-mips-elf/empic2-rev-1.d | 24 --- ld/testsuite/ld-mips-elf/empic2-rev-tgt.s | 8 - ld/testsuite/ld-mips-elf/empic2-space.s | 5 - ld/testsuite/ld-mips-elf/emrelocs-eb.d | 25 --- ld/testsuite/ld-mips-elf/emrelocs-el.d | 25 --- ld/testsuite/ld-mips-elf/emrelocs.ld | 16 -- ld/testsuite/ld-mips-elf/emrelocs1.s | 23 --- ld/testsuite/ld-mips-elf/emrelocs2.s | 30 ---- ld/testsuite/ld-mips-elf/mips-elf.exp | 19 --- 49 files changed, 104 insertions(+), 1893 deletions(-) delete mode 100644 ld/emultempl/mipself.em delete mode 100644 ld/testsuite/ld-empic/empic.exp delete mode 100644 ld/testsuite/ld-empic/relax.t delete mode 100644 ld/testsuite/ld-empic/relax1.c delete mode 100644 ld/testsuite/ld-empic/relax2.c delete mode 100644 ld/testsuite/ld-empic/relax3.c delete mode 100644 ld/testsuite/ld-empic/relax4.c delete mode 100644 ld/testsuite/ld-empic/run.c delete mode 100644 ld/testsuite/ld-empic/runtest1.c delete mode 100644 ld/testsuite/ld-empic/runtest2.c delete mode 100644 ld/testsuite/ld-empic/runtesti.s delete mode 100644 ld/testsuite/ld-mips-elf/empic1-ln.d delete mode 100644 ld/testsuite/ld-mips-elf/empic1-lp.d delete mode 100644 ld/testsuite/ld-mips-elf/empic1-mn.d delete mode 100644 ld/testsuite/ld-mips-elf/empic1-mp.d delete mode 100644 ld/testsuite/ld-mips-elf/empic1-ref.s delete mode 100644 ld/testsuite/ld-mips-elf/empic1-sn.d delete mode 100644 ld/testsuite/ld-mips-elf/empic1-sp.d delete mode 100644 ld/testsuite/ld-mips-elf/empic1-space.s delete mode 100644 ld/testsuite/ld-mips-elf/empic1-tgt.s delete mode 100644 ld/testsuite/ld-mips-elf/empic2-fwd-0.d delete mode 100644 ld/testsuite/ld-mips-elf/empic2-fwd-1.d delete mode 100644 ld/testsuite/ld-mips-elf/empic2-fwd-tgt.s delete mode 100644 ld/testsuite/ld-mips-elf/empic2-ref.s delete mode 100644 ld/testsuite/ld-mips-elf/empic2-rev-0.d delete mode 100644 ld/testsuite/ld-mips-elf/empic2-rev-1.d delete mode 100644 ld/testsuite/ld-mips-elf/empic2-rev-tgt.s delete mode 100644 ld/testsuite/ld-mips-elf/empic2-space.s delete mode 100644 ld/testsuite/ld-mips-elf/emrelocs-eb.d delete mode 100644 ld/testsuite/ld-mips-elf/emrelocs-el.d delete mode 100644 ld/testsuite/ld-mips-elf/emrelocs.ld delete mode 100644 ld/testsuite/ld-mips-elf/emrelocs1.s delete mode 100644 ld/testsuite/ld-mips-elf/emrelocs2.s diff --git a/bfd/ChangeLog b/bfd/ChangeLog index a36324a..5b715d6 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,11 @@ +2004-04-21 Chris Demetriou + + * coff-mips.c (bfd_mips_ecoff_create_embedded_relocs): Remove. + * elf32-mips.c (bfd_mips_elf32_create_embedded_relocs): Remove. + * bfd-in.h (bfd_mips_ecoff_create_embedded_relocs) + (bfd_mips_elf32_create_embedded_relocs): Remove prototypes + * bfd-in2.h: Regenerate. + 2004-04-21 Bob Wilson * elf32-xtensa.c (is_same_value): Add final_static_link argument and diff --git a/bfd/bfd-in.h b/bfd/bfd-in.h index 9ad727e..a3330e8 100644 --- a/bfd/bfd-in.h +++ b/bfd/bfd-in.h @@ -587,8 +587,6 @@ extern bfd_boolean bfd_ecoff_write_accumulated_debug (void *handle, bfd *abfd, struct ecoff_debug_info *debug, const struct ecoff_debug_swap *swap, struct bfd_link_info *info, file_ptr where); -extern bfd_boolean bfd_mips_ecoff_create_embedded_relocs - (bfd *, struct bfd_link_info *, struct bfd_section *, struct bfd_section *, char **); /* Externally visible ELF routines. */ @@ -670,8 +668,6 @@ extern struct bfd_section *_bfd_elf_tls_setup extern bfd_boolean bfd_m68k_elf32_create_embedded_relocs (bfd *, struct bfd_link_info *, struct bfd_section *, struct bfd_section *, char **); -extern bfd_boolean bfd_mips_elf32_create_embedded_relocs - (bfd *, struct bfd_link_info *, struct bfd_section *, struct bfd_section *, char **); /* SunOS shared library support routines for the linker. */ diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h index 49e22b4..2e83341 100644 --- a/bfd/bfd-in2.h +++ b/bfd/bfd-in2.h @@ -594,8 +594,6 @@ extern bfd_boolean bfd_ecoff_write_accumulated_debug (void *handle, bfd *abfd, struct ecoff_debug_info *debug, const struct ecoff_debug_swap *swap, struct bfd_link_info *info, file_ptr where); -extern bfd_boolean bfd_mips_ecoff_create_embedded_relocs - (bfd *, struct bfd_link_info *, struct bfd_section *, struct bfd_section *, char **); /* Externally visible ELF routines. */ @@ -677,8 +675,6 @@ extern struct bfd_section *_bfd_elf_tls_setup extern bfd_boolean bfd_m68k_elf32_create_embedded_relocs (bfd *, struct bfd_link_info *, struct bfd_section *, struct bfd_section *, char **); -extern bfd_boolean bfd_mips_elf32_create_embedded_relocs - (bfd *, struct bfd_link_info *, struct bfd_section *, struct bfd_section *, char **); /* SunOS shared library support routines for the linker. */ diff --git a/bfd/coff-mips.c b/bfd/coff-mips.c index d6d8218..a5ad65a 100644 --- a/bfd/coff-mips.c +++ b/bfd/coff-mips.c @@ -2323,132 +2323,6 @@ mips_relax_pcrel16 (info, input_bfd, input_section, h, location, address) return TRUE; } - -/* Given a .sdata section and a .rel.sdata in-memory section, store - relocation information into the .rel.sdata section which can be - used at runtime to relocate the section. This is called by the - linker when the --embedded-relocs switch is used. This is called - after the add_symbols entry point has been called for all the - objects, and before the final_link entry point is called. This - function presumes that the object was compiled using - -membedded-pic. */ - -bfd_boolean -bfd_mips_ecoff_create_embedded_relocs (abfd, info, datasec, relsec, errmsg) - bfd *abfd; - struct bfd_link_info *info; - asection *datasec; - asection *relsec; - char **errmsg; -{ - struct ecoff_link_hash_entry **sym_hashes; - struct ecoff_section_tdata *section_tdata; - struct external_reloc *ext_rel; - struct external_reloc *ext_rel_end; - bfd_byte *p; - bfd_size_type amt; - - BFD_ASSERT (! info->relocatable); - - *errmsg = NULL; - - if (datasec->reloc_count == 0) - return TRUE; - - sym_hashes = ecoff_data (abfd)->sym_hashes; - - if (! mips_read_relocs (abfd, datasec)) - return FALSE; - - amt = (bfd_size_type) datasec->reloc_count * 4; - relsec->contents = (bfd_byte *) bfd_alloc (abfd, amt); - if (relsec->contents == NULL) - return FALSE; - - p = relsec->contents; - - section_tdata = ecoff_section_data (abfd, datasec); - ext_rel = (struct external_reloc *) section_tdata->external_relocs; - ext_rel_end = ext_rel + datasec->reloc_count; - for (; ext_rel < ext_rel_end; ext_rel++, p += 4) - { - struct internal_reloc int_rel; - bfd_boolean text_relative; - - mips_ecoff_swap_reloc_in (abfd, (PTR) ext_rel, &int_rel); - - /* We are going to write a four byte word into the runtime reloc - section. The word will be the address in the data section - which must be relocated. This must be on a word boundary, - which means the lower two bits must be zero. We use the - least significant bit to indicate how the value in the data - section must be relocated. A 0 means that the value is - relative to the text section, while a 1 indicates that the - value is relative to the data section. Given that we are - assuming the code was compiled using -membedded-pic, there - should not be any other possibilities. */ - - /* We can only relocate REFWORD relocs at run time. */ - if (int_rel.r_type != MIPS_R_REFWORD) - { - *errmsg = _("unsupported reloc type"); - bfd_set_error (bfd_error_bad_value); - return FALSE; - } - - if (int_rel.r_extern) - { - struct ecoff_link_hash_entry *h; - - h = sym_hashes[int_rel.r_symndx]; - /* If h is NULL, that means that there is a reloc against an - external symbol which we thought was just a debugging - symbol. This should not happen. */ - if (h == (struct ecoff_link_hash_entry *) NULL) - abort (); - if ((h->root.type == bfd_link_hash_defined - || h->root.type == bfd_link_hash_defweak) - && (h->root.u.def.section->flags & SEC_CODE) != 0) - text_relative = TRUE; - else - text_relative = FALSE; - } - else - { - switch (int_rel.r_symndx) - { - case RELOC_SECTION_TEXT: - text_relative = TRUE; - break; - case RELOC_SECTION_SDATA: - case RELOC_SECTION_SBSS: - case RELOC_SECTION_LIT8: - text_relative = FALSE; - break; - default: - /* No other sections should appear in -membedded-pic - code. */ - *errmsg = _("reloc against unsupported section"); - bfd_set_error (bfd_error_bad_value); - return FALSE; - } - } - - if ((int_rel.r_offset & 3) != 0) - { - *errmsg = _("reloc not properly aligned"); - bfd_set_error (bfd_error_bad_value); - return FALSE; - } - - bfd_put_32 (abfd, - (int_rel.r_vaddr - datasec->vma + datasec->output_offset - + (text_relative ? 0 : 1)), - p); - } - - return TRUE; -} /* This is the ECOFF backend structure. The backend field of the target vector points to this. */ diff --git a/bfd/elf32-mips.c b/bfd/elf32-mips.c index a0480f0..2f6f436 100644 --- a/bfd/elf32-mips.c +++ b/bfd/elf32-mips.c @@ -1335,139 +1335,6 @@ elf32_mips_irix_compat (bfd *abfd) return ict_none; } -/* Given a data section and an in-memory embedded reloc section, store - relocation information into the embedded reloc section which can be - used at runtime to relocate the data section. This is called by the - linker when the --embedded-relocs switch is used. This is called - after the add_symbols entry point has been called for all the - objects, and before the final_link entry point is called. */ - -bfd_boolean -bfd_mips_elf32_create_embedded_relocs (bfd *abfd, struct bfd_link_info *info, - asection *datasec, asection *relsec, - char **errmsg) -{ - Elf_Internal_Shdr *symtab_hdr; - Elf_Internal_Sym *isymbuf = NULL; - Elf_Internal_Rela *internal_relocs = NULL; - Elf_Internal_Rela *irel, *irelend; - bfd_byte *p; - - BFD_ASSERT (! info->relocatable); - - *errmsg = NULL; - - if (datasec->reloc_count == 0) - return TRUE; - - /* Read this BFD's symbols if we haven't done so already, or get the cached - copy if it exists. */ - symtab_hdr = &elf_tdata (abfd)->symtab_hdr; - if (symtab_hdr->sh_info != 0) - { - isymbuf = (Elf_Internal_Sym *) symtab_hdr->contents; - if (isymbuf == NULL) - isymbuf = bfd_elf_get_elf_syms (abfd, symtab_hdr, - symtab_hdr->sh_info, 0, - NULL, NULL, NULL); - if (isymbuf == NULL) - goto error_return; - } - - /* Get a copy of the native relocations. */ - internal_relocs = _bfd_elf_link_read_relocs (abfd, datasec, NULL, NULL, - info->keep_memory); - if (internal_relocs == NULL) - goto error_return; - - relsec->contents = bfd_alloc (abfd, datasec->reloc_count * 12); - if (relsec->contents == NULL) - goto error_return; - - p = relsec->contents; - - irelend = internal_relocs + datasec->reloc_count; - - for (irel = internal_relocs; irel < irelend; irel++, p += 12) - { - asection *targetsec; - - /* We are going to write a four byte longword into the runtime - reloc section. The longword will be the address in the data - section which must be relocated. It is followed by the name - of the target section NUL-padded or truncated to 8 - characters. */ - - /* We can only relocate absolute longword relocs at run time. */ - if ((ELF32_R_TYPE (irel->r_info) != (int) R_MIPS_32) && - (ELF32_R_TYPE (irel->r_info) != (int) R_MIPS_64)) - { - *errmsg = _("unsupported reloc type"); - bfd_set_error (bfd_error_bad_value); - goto error_return; - } - /* Get the target section referred to by the reloc. */ - if (ELF32_R_SYM (irel->r_info) < symtab_hdr->sh_info) - { - Elf_Internal_Sym *isym; - - /* A local symbol. */ - isym = isymbuf + ELF32_R_SYM (irel->r_info); - targetsec = bfd_section_from_elf_index (abfd, isym->st_shndx); - } - else - { - unsigned long indx; - struct elf_link_hash_entry *h; - - /* An external symbol. */ - indx = ELF32_R_SYM (irel->r_info); - h = elf_sym_hashes (abfd)[indx]; - targetsec = NULL; - /* - For some reason, in certain programs, the symbol will - not be in the hash table. It seems to happen when you - declare a static table of pointers to const external structures. - In this case, the relocs are relative to data, not - text, so just treating it like an undefined link - should be sufficient. */ - BFD_ASSERT(h != NULL); - if (h->root.type == bfd_link_hash_defined - || h->root.type == bfd_link_hash_defweak) - targetsec = h->root.u.def.section; - } - - - /* - Set the low bit of the relocation offset if it's a MIPS64 reloc. - Relocations will always be on (at least) 32-bit boundaries. */ - - bfd_put_32 (abfd, ((irel->r_offset + datasec->output_offset) + - ((ELF32_R_TYPE (irel->r_info) == (int) R_MIPS_64) ? 1 : 0)), - p); - memset (p + 4, 0, 8); - if (targetsec != NULL) - strncpy (p + 4, targetsec->output_section->name, 8); - } - - if (internal_relocs != NULL - && elf_section_data (datasec)->relocs != internal_relocs) - free (internal_relocs); - if (isymbuf != NULL - && symtab_hdr->contents != (unsigned char *) isymbuf) - free (isymbuf); - return TRUE; - - error_return: - if (internal_relocs != NULL - && elf_section_data (datasec)->relocs != internal_relocs) - free (internal_relocs); - if (isymbuf != NULL - && symtab_hdr->contents != (unsigned char *) isymbuf) - free (isymbuf); - return FALSE; -} - /* ECOFF swapping routines. These are used when dealing with the .mdebug section, which is in the ECOFF debugging format. */ static const struct ecoff_debug_swap mips_elf32_ecoff_debug_swap = { diff --git a/ld/ChangeLog b/ld/ChangeLog index 7a5e139..ad50e6b 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,27 @@ +2004-04-21 Chris Demetriou + + * ld.texinfo: Remove MIPS --embedded-relocs documentation. + * emulparams/elf32bmip.sh (EXTRA_EM_FILE): Remove definition. + * emulparams/mipsidt.sh (TEMPLATE_NAME): Use generic.em. + (EXTRA_EM_FILE): Use mipsecoff.em + * emulparams/mipsidtl.sh (TEMPLATE_NAME): Use generic.em. + (EXTRA_EM_FILE): Use mipsecoff.em + * emultempl/mipsecoff.em: Restructure to be included as an + extra emulation file. + (check_sections, gld${EMULATION_NAME}_after_open) + (gld${EMULATION_NAME}_after_allocation) + (gld${EMULATION_NAME}_get_script) + (ld_${EMULATION_NAME}_emulation): Remove + (gld${EMULATION_NAME}_before_parse): Rename to... + (mipsecoff_before_parse): This. + (LDEMUL_BEFORE_PARSE): Define. + * emultempl/mipself.em: Remove file. + * scripttempl/mips.sc (.rel.sdata): Do not include in output. + (__runtime_reloc_start, __runtime_reloc_stop): Stop providing + these symbols. + * Makefile.am: Remove dependencies on emultempl/mipself.em. + * Makefile.in: Regenerate. + 2004-04-21 Anil Paranjpe * ld.texinfo (synthesizing on H8/300): Information about linker diff --git a/ld/Makefile.am b/ld/Makefile.am index 887419f..308d422 100644 --- a/ld/Makefile.am +++ b/ld/Makefile.am @@ -627,7 +627,7 @@ 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)/emultempl/mipself.em \ + $(srcdir)/emulparams/elf32bmip.sh \ $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} ${GENSCRIPTS} elf32b4300 "$(tdir_elf32b4300)" eelf32cr16c.c: $(srcdir)/emulparams/elf32cr16c.sh \ @@ -635,7 +635,6 @@ eelf32cr16c.c: $(srcdir)/emulparams/elf32cr16c.sh \ $(srcdir)/scripttempl/elf32cr16c.sc ${GEN_DEPENDS} ${GENSCRIPTS} elf32cr16c "$(tdir_elf32cr16c)" 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 \ @@ -643,30 +642,27 @@ eelf32bsmip.c: $(srcdir)/emulparams/elf32bsmip.sh \ $(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)/emultempl/mipself.em \ + $(srcdir)/emulparams/elf32bmip.sh \ $(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)/emultempl/mipself.em \ + $(srcdir)/emulparams/elf32bmip.sh \ $(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)/emultempl/mipself.em \ + $(srcdir)/emulparams/elf32bmip.sh \ $(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 \ @@ -675,11 +671,10 @@ 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)/emultempl/mipself.em \ + $(srcdir)/emulparams/elf32bmip.sh \ $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} ${GENSCRIPTS} elf32lmip "$(tdir_elf32lmip)" eelf32mipswindiss.c: $(srcdir)/emulparams/elf32mipswindiss.sh \ @@ -707,7 +702,6 @@ 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 \ diff --git a/ld/Makefile.in b/ld/Makefile.in index 75e334a..40051ef 100644 --- a/ld/Makefile.in +++ b/ld/Makefile.in @@ -1353,7 +1353,7 @@ 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)/emultempl/mipself.em \ + $(srcdir)/emulparams/elf32bmip.sh \ $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} ${GENSCRIPTS} elf32b4300 "$(tdir_elf32b4300)" eelf32cr16c.c: $(srcdir)/emulparams/elf32cr16c.sh \ @@ -1361,7 +1361,6 @@ eelf32cr16c.c: $(srcdir)/emulparams/elf32cr16c.sh \ $(srcdir)/scripttempl/elf32cr16c.sc ${GEN_DEPENDS} ${GENSCRIPTS} elf32cr16c "$(tdir_elf32cr16c)" 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 \ @@ -1369,30 +1368,27 @@ eelf32bsmip.c: $(srcdir)/emulparams/elf32bsmip.sh \ $(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)/emultempl/mipself.em \ + $(srcdir)/emulparams/elf32bmip.sh \ $(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)/emultempl/mipself.em \ + $(srcdir)/emulparams/elf32bmip.sh \ $(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)/emultempl/mipself.em \ + $(srcdir)/emulparams/elf32bmip.sh \ $(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 \ @@ -1401,11 +1397,10 @@ 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)/emultempl/mipself.em \ + $(srcdir)/emulparams/elf32bmip.sh \ $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} ${GENSCRIPTS} elf32lmip "$(tdir_elf32lmip)" eelf32mipswindiss.c: $(srcdir)/emulparams/elf32mipswindiss.sh \ @@ -1433,7 +1428,6 @@ 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 \ diff --git a/ld/emulparams/elf32bmip.sh b/ld/emulparams/elf32bmip.sh index 94e1c9c..7badcb8 100644 --- a/ld/emulparams/elf32bmip.sh +++ b/ld/emulparams/elf32bmip.sh @@ -33,5 +33,4 @@ OTHER_SECTIONS=' ARCH=mips MACHINE= TEMPLATE_NAME=elf32 -EXTRA_EM_FILE=mipself GENERATE_SHLIB_SCRIPT=yes diff --git a/ld/emulparams/mipsidt.sh b/ld/emulparams/mipsidt.sh index 63176f5..f381267 100644 --- a/ld/emulparams/mipsidt.sh +++ b/ld/emulparams/mipsidt.sh @@ -7,5 +7,6 @@ ARCH=mips ENTRY=start TEXT_START_ADDR=0xa0012000 DATA_ADDR=. -TEMPLATE_NAME=mipsecoff +TEMPLATE_NAME=generic +EXTRA_EM_FILE=mipsecoff EMBEDDED=yes diff --git a/ld/emulparams/mipsidtl.sh b/ld/emulparams/mipsidtl.sh index 02279de..52447ff 100644 --- a/ld/emulparams/mipsidtl.sh +++ b/ld/emulparams/mipsidtl.sh @@ -7,5 +7,6 @@ ARCH=mips ENTRY=start TEXT_START_ADDR=0xa0012000 DATA_ADDR=. -TEMPLATE_NAME=mipsecoff +TEMPLATE_NAME=generic +EXTRA_EM_FILE=mipsecoff EMBEDDED=yes diff --git a/ld/emultempl/mipsecoff.em b/ld/emultempl/mipsecoff.em index dde33c2..5d160cd 100644 --- a/ld/emultempl/mipsecoff.em +++ b/ld/emultempl/mipsecoff.em @@ -1,51 +1,30 @@ # This shell script emits a C file. -*- C -*- -# It does some substitutions. +# Copyright 1994, 1995, 1997, 2000, 2002, 2003, 2004 +# Free Software Foundation, Inc. +# +# This file is part of GLD, the Gnu Linker. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# 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. +# + if [ -z "$MACHINE" ]; then OUTPUT_ARCH=${ARCH} else OUTPUT_ARCH=${ARCH}:${MACHINE} fi -cat >e${EMULATION_NAME}.c < based on generic.em. - -This file is part of GLD, the Gnu Linker. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -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. */ - -#define TARGET_IS_${EMULATION_NAME} - -#include "bfd.h" -#include "sysdep.h" -#include "bfdlink.h" - -#include "ld.h" -#include "ldmain.h" -#include "ldmisc.h" - -#include "ldexp.h" -#include "ldlang.h" -#include "ldfile.h" -#include "ldemul.h" - -static void check_sections (bfd *, asection *, void *); - +cat >>e${EMULATION_NAME}.c <link_next) - { - asection *datasec; - - /* As first-order business, make sure that each input BFD is ECOFF. It - better be, as we are directly calling an ECOFF backend function. */ - if (bfd_get_flavour (abfd) != bfd_target_ecoff_flavour) - einfo ("%F%B: all input objects must be ECOFF for --embedded-relocs\n"); - - datasec = bfd_get_section_by_name (abfd, ".sdata"); - - /* Note that we assume that the reloc_count field has already - been set up. We could call bfd_get_reloc_upper_bound, but - that returns the size of a memory buffer rather than a reloc - count. We do not want to call bfd_canonicalize_reloc, - because although it would always work it would force us to - read in the relocs into BFD canonical form, which would waste - a significant amount of time and memory. */ - if (datasec != NULL && datasec->reloc_count > 0) - { - asection *relsec; - - relsec = bfd_make_section (abfd, ".rel.sdata"); - if (relsec == NULL - || ! bfd_set_section_flags (abfd, relsec, - (SEC_ALLOC - | SEC_LOAD - | SEC_HAS_CONTENTS - | SEC_IN_MEMORY)) - || ! bfd_set_section_alignment (abfd, relsec, 2) - || ! bfd_set_section_size (abfd, relsec, - datasec->reloc_count * 4)) - einfo ("%F%B: can not create .rel.sdata section: %E\n"); - } - - /* Double check that all other data sections are empty, as is - required for embedded PIC code. */ - bfd_map_over_sections (abfd, check_sections, datasec); - } -} - -/* Check that of the data sections, only the .sdata section has - relocs. This is called via bfd_map_over_sections. */ - -static void -check_sections (bfd *abfd, asection *sec, void *sdatasec) -{ - if ((bfd_get_section_flags (abfd, sec) & SEC_CODE) == 0 - && 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)); -} - -/* This function is called after the section sizes and offsets have - been set. If we are generating embedded relocs, it calls a special - BFD backend routine to do the work. */ - -static void -gld${EMULATION_NAME}_after_allocation (void) -{ - bfd *abfd; - - if (! command_line.embedded_relocs - || link_info.relocatable) - return; - - for (abfd = link_info.input_bfds; abfd != NULL; abfd = abfd->link_next) - { - asection *datasec, *relsec; - char *errmsg; - - datasec = bfd_get_section_by_name (abfd, ".sdata"); - - if (datasec == NULL || datasec->reloc_count == 0) - continue; - - relsec = bfd_get_section_by_name (abfd, ".rel.sdata"); - ASSERT (relsec != NULL); - - if (! bfd_mips_ecoff_create_embedded_relocs (abfd, &link_info, - datasec, relsec, - &errmsg)) - { - if (errmsg == NULL) - einfo ("%B%X: can not create runtime reloc information: %E\n", - abfd); - else - einfo ("%X%B: can not create runtime reloc information: %s\n", - abfd, errmsg); - } - } -} - -static char * -gld${EMULATION_NAME}_get_script (int *isfile) EOF -if test -n "$COMPILE_IN" -then -# Scripts compiled in. - -# sed commands to quote an ld script as a C string. -sc="-f stringify.sed" - -cat >>e${EMULATION_NAME}.c <> e${EMULATION_NAME}.c -echo ' ; else if (link_info.relocatable) return' >> e${EMULATION_NAME}.c -sed $sc ldscripts/${EMULATION_NAME}.xr >> e${EMULATION_NAME}.c -echo ' ; else if (!config.text_read_only) return' >> e${EMULATION_NAME}.c -sed $sc ldscripts/${EMULATION_NAME}.xbn >> e${EMULATION_NAME}.c -echo ' ; else if (!config.magic_demand_paged) return' >> e${EMULATION_NAME}.c -sed $sc ldscripts/${EMULATION_NAME}.xn >> e${EMULATION_NAME}.c -echo ' ; else return' >> e${EMULATION_NAME}.c -sed $sc ldscripts/${EMULATION_NAME}.x >> e${EMULATION_NAME}.c -echo '; }' >> e${EMULATION_NAME}.c - -else -# Scripts read from the filesystem. - -cat >>e${EMULATION_NAME}.c <>e${EMULATION_NAME}.c < and -# Chris Demetriou based on m68kelf.em and mipsecoff.em. -# -# This file is part of GLD, the Gnu Linker. -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# 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 file is sourced from elf32.em, and defines some extra routines for m68k -# embedded systems using ELF and for some other systems using m68k ELF. While -# it is sourced from elf32.em for all m68k ELF configurations, here we include -# only the features we want depending on the configuration. - -case ${target} in - mips*-*-elf) - echo "#define SUPPORT_EMBEDDED_RELOCS" >>e${EMULATION_NAME}.c - ;; -esac - -cat >>e${EMULATION_NAME}.c <link_next) - { - asection *datasec; - - /* As first-order business, make sure that each input BFD is - ELF. We need to call a special BFD backend function to - generate the embedded relocs, and we have that function - only for ELF */ - - if (bfd_get_flavour (abfd) != bfd_target_elf_flavour) - einfo ("%F%B: all input objects must be ELF for --embedded-relocs\n"); - - if (bfd_get_arch_size (abfd) != ${ELFSIZE}) - einfo ("%F%B: all input objects must be ${ELFSIZE}-bit ELF for --embedded-relocs\n"); - - datasec = bfd_get_section_by_name (abfd, ".sdata"); - - /* Note that we assume that the reloc_count field has already - been set up. We could call bfd_get_reloc_upper_bound, but - that returns the size of a memory buffer rather than a reloc - count. We do not want to call bfd_canonicalize_reloc, - because although it would always work it would force us to - read in the relocs into BFD canonical form, which would waste - a significant amount of time and memory. */ - - if (datasec != NULL && datasec->reloc_count > 0) - { - asection *relsec; - - relsec = bfd_make_section (abfd, ".rel.sdata"); - if (relsec == NULL - || ! bfd_set_section_flags (abfd, relsec, - (SEC_ALLOC - | SEC_LOAD - | SEC_HAS_CONTENTS - | SEC_IN_MEMORY)) - || ! bfd_set_section_alignment (abfd, relsec, - (${ELFSIZE} == 32) ? 2 : 3) - || ! bfd_set_section_size (abfd, relsec, - datasec->reloc_count - * ((${ELFSIZE} / 8) + 8))) - einfo ("%F%B: cannot create .rel.sdata section: %E\n"); - } - - /* 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, - datasec); - } - } -#endif /* SUPPORT_EMBEDDED_RELOCS */ -} - -#ifdef SUPPORT_EMBEDDED_RELOCS -/* Check that of the data sections, only the .sdata section has - relocs. This is called via bfd_map_over_sections. */ - -static void -mips_elf${ELFSIZE}_check_sections (bfd *abfd, asection *sec, void *sdatasec) -{ - if ((bfd_get_section_flags (abfd, sec) & SEC_DATA) - && 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)); -} -#endif /* SUPPORT_EMBEDDED_RELOCS */ - -/* This function is called after the section sizes and offsets have - been set. If we are generating embedded relocs, it calls a special - BFD backend routine to do the work. */ - -static void -mips_elf${ELFSIZE}_after_allocation (void) -{ - /* Call the standard elf routine. */ - after_allocation_default (); - -#ifdef SUPPORT_EMBEDDED_RELOCS - if (command_line.embedded_relocs && (! link_info.relocatable)) - { - bfd *abfd; - - for (abfd = link_info.input_bfds; abfd != NULL; abfd = abfd->link_next) - { - asection *datasec, *relsec; - char *errmsg; - - datasec = bfd_get_section_by_name (abfd, ".sdata"); - - if (datasec == NULL || datasec->reloc_count == 0) - continue; - - relsec = bfd_get_section_by_name (abfd, ".rel.sdata"); - ASSERT (relsec != NULL); - - if (! bfd_mips_elf${ELFSIZE}_create_embedded_relocs (abfd, - &link_info, - datasec, - relsec, - &errmsg)) - { - if (errmsg == NULL) - einfo ("%B%X: can not create runtime reloc information: %E\n", - abfd); - else - einfo ("%X%B: can not create runtime reloc information: %s\n", - abfd, errmsg); - } - } - } -#endif /* SUPPORT_EMBEDDED_RELOCS */ -} - -EOF - -# We have our own after_open and after_allocation functions, but they call -# the standard routines, so give them a different name. -LDEMUL_AFTER_OPEN=mips_elf${ELFSIZE}_after_open -LDEMUL_AFTER_ALLOCATION=mips_elf${ELFSIZE}_after_allocation diff --git a/ld/ld.texinfo b/ld/ld.texinfo index 0ba3af2..5461f0b 100644 --- a/ld/ld.texinfo +++ b/ld/ld.texinfo @@ -1113,15 +1113,6 @@ generating dynamically linked ELF executables. The default dynamic linker is normally correct; don't use this unless you know what you are doing. -@cindex MIPS embedded PIC code -@kindex --embedded-relocs -@item --embedded-relocs -This option is only meaningful when linking MIPS embedded PIC code, -generated by the -membedded-pic option to the @sc{gnu} compiler and -assembler. It causes the linker to create a table which may be used at -runtime to relocate any data which was statically initialized to pointer -values. See the code in testsuite/ld-empic for details. - @kindex --fatal-warnings @item --fatal-warnings diff --git a/ld/scripttempl/mips.sc b/ld/scripttempl/mips.sc index d60aeed..972351f 100644 --- a/ld/scripttempl/mips.sc +++ b/ld/scripttempl/mips.sc @@ -29,9 +29,6 @@ SECTIONS *(.init) ${RELOCATING+ eprol = .}; *(.text) - ${RELOCATING+PROVIDE (__runtime_reloc_start = .);} - *(.rel.sdata) - ${RELOCATING+PROVIDE (__runtime_reloc_stop = .);} *(.fini) ${RELOCATING+ etext = .}; ${RELOCATING+ _etext = .}; diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog index 4d302ec..5195dcc 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,3 +1,39 @@ +2004-04-21 Chris Demetriou + + * ld-empic/run.c: Removed as part of MIPS --embedded-relocs removal. + * ld-empic/empic.exp: Likewise. + * ld-empic/relax.t: Likewise. + * ld-empic/relax1.c: Likewise. + * ld-empic/relax2.c: Likewise. + * ld-empic/relax3.c: Likewise. + * ld-empic/relax4.c: Likewise. + * ld-empic/runtest1.c: Likewise. + * ld-empic/runtest2.c: Likewise. + * ld-empic/runtesti.s: Likewise. + * ld-mips-elf/empic1-ln.d: Likewise. + * ld-mips-elf/empic1-lp.d: Likewise. + * ld-mips-elf/empic1-mn.d: Likewise. + * ld-mips-elf/empic1-mp.d: Likewise. + * ld-mips-elf/empic1-ref.s: Likewise. + * ld-mips-elf/empic1-sn.d: Likewise. + * ld-mips-elf/empic1-sp.d: Likewise. + * ld-mips-elf/empic1-space.s: Likewise. + * ld-mips-elf/empic1-tgt.s: Likewise. + * ld-mips-elf/empic2-fwd-0.d: Likewise. + * ld-mips-elf/empic2-fwd-1.d: Likewise. + * ld-mips-elf/empic2-fwd-tgt.s: Likewise. + * ld-mips-elf/empic2-ref.s: Likewise. + * ld-mips-elf/empic2-rev-0.d: Likewise. + * ld-mips-elf/empic2-rev-1.d: Likewise. + * ld-mips-elf/empic2-rev-tgt.s: Likewise. + * ld-mips-elf/empic2-space.s: Likewise. + * ld-mips-elf/emrelocs-eb.d: Likewise. + * ld-mips-elf/emrelocs-el.d: Likewise. + * ld-mips-elf/emrelocs.ld: Likewise. + * ld-mips-elf/emrelocs1.s: Likewise. + * ld-mips-elf/emrelocs2.s: Likewise. + * ld-mips-elf/mips-elf.exp: Don't run now-removed tests. + 2004-04-20 H.J. Lu * ld-elfweak/elfweak.exp: Add an undefined weak size change diff --git a/ld/testsuite/ld-empic/empic.exp b/ld/testsuite/ld-empic/empic.exp deleted file mode 100644 index f72b1f3..0000000 --- a/ld/testsuite/ld-empic/empic.exp +++ /dev/null @@ -1,263 +0,0 @@ -# Expect script for ld-empic tests -# Copyright 1994, 1995, 1996 Free Software Foundation, Inc. -# -# 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 Ian Lance Taylor (ian@cygnus.com) -# - -# Test the handling of MIPS embedded PIC code. This test essentially -# tests the compiler and assembler as well as the linker, since MIPS -# embedded PIC is a GNU enhancement to standard MIPS tools. - -# Embedded PIC is only supported for MIPS ECOFF targets. -if ![istarget mips*-*-ecoff*] { - return -} - -set testname relax - -if { [which $CC] == 0 } { - untested $testname - return -} - -# Test that relaxation works correctly. This testsuite was composed -# (by experimentation) to force the linker to relax twice--that is, -# the first relaxation pass will force another call to be out of -# range, requiring a second relaxation pass. -if { ![ld_compile "$CC $CFLAGS -membedded-pic" $srcdir/$subdir/relax1.c tmpdir/relax1.o] - || ![ld_compile "$CC $CFLAGS -membedded-pic" $srcdir/$subdir/relax2.c tmpdir/relax2.o] - || ![ld_compile "$CC $CFLAGS -membedded-pic" $srcdir/$subdir/relax3.c tmpdir/relax3.o] - || ![ld_compile "$CC $CFLAGS -membedded-pic" $srcdir/$subdir/relax4.c tmpdir/relax4.o] } { - unresolved $testname - return -} - -if ![ld_simple_link $ld tmpdir/relax "--relax -T $srcdir/$subdir/relax.t tmpdir/relax1.o tmpdir/relax2.o tmpdir/relax3.o tmpdir/relax4.o"] { - fail $testname -} else { - # Check that the relaxation produced the correct result. Check - # each bal instruction. Some will go directly to the start of a - # function, which is OK. Some will form part of the five - # instruction expanded call sequence, in which case we compute the - # real destination and make sure it is the start of a function. - # Some bal instructions are used to locate the start of the - # function in order to do position independent addressing into the - # text section, in which case we just check that it correctly - # computes the start of the function. - - # Get the symbol table. - if ![ld_nm $nm "" tmpdir/relax] { - unresolved $testname - return - } - - # Get a disassembly. - send_log "$objdump -d tmpdir/relax >tmpdir/relax.dis\n" - verbose "$objdump -d tmpdir/relax >tmpdir/relax.dis" - catch "exec $objdump -d tmpdir/relax >tmpdir/relax.dis" exec_output - if ![string match "" $exec_output] { - send_log "$exec_output\n" - verbose $exec_output - unresolved $testname - return - } - - set balcnt 0 - set file [open tmpdir/relax.dis r] - while { [gets $file line] != -1 } { - verbose "$line" 2 - - if ![string match "*bal*" $line] { - continue - } - - verbose "$line" - - incr balcnt - - if ![regexp "^(\[0-9a-fA-F\]+) (<\[a-z+0-9A-Z.\]+>)? bal (\[0-9a-fA-F\]+)" $line whole addr label dest] { - perror "unrecognized format for $line" - unresolved $testname - return - } - - if "0x$addr + 8 != 0x$dest" { - # This is a straight function call. All function calls in - # this example are to either foo or bar. - if "0x$dest != $nm_output(foo) && 0x$dest != $nm_output(bar)" { - send_log "fail 1\n" - send_log "$line\n" - fail $testname - return - } - } else { - # Pick up the next line. If it is sll, this is a switch - # prologue, and there is not much we can do to test it. - # Otherwise, it should be lui, and the next instruction - # should be an addiu, followed by an addu to $31. - if { [gets $file l] == -1 } { - send_log "fail 2\n" - send_log "$line\n" - fail $testname - return - } - verbose $l - - if [string match "*sll*" $l] { - continue - } - if ![regexp "lui (\[\$a-z0-9\]+),(\[0-9a-fA-Fx\]+)" $l whole reg upper] { - send_log "fail 3\n" - send_log "$line\n" - send_log "$l\n" - fail $testname - return - } - - if { [gets $file l] == -1 } { - send_log "fail 4\n" - send_log "$line\n" - fail $testname - return - } - verbose "$l" - if ![regexp "addiu \\$reg,\\$reg,(\[-0-9\]+)" $l whole lower] { - send_log "fail 5\n" - send_log "$line\n" - send_log "$l\n" - send_log "addiu \\$reg,\\$reg,(\[-0-9\]+)\n" - fail $testname - return - } - - if { [gets $file l] == -1 } { - send_log "fail 6\n" - send_log "$line\n" - fail $testname - return - } - verbose "$l" - if ![regexp "addu \\$reg,\\$reg,\\\$ra" $l] { - send_log "fail 7\n" - send_log "$line\n" - send_log "$l\n" - fail $testname - return - } - - # The next line will be jalr in the case of an expanded - # call. Otherwise, the code is getting the start of the - # function, and the next line can be anything. - - if { [gets $file l] == -1 } { - send_log "fail 8\n" - send_log "$line\n" - fail $testname - return - } - verbose "$l" - if [string match "*jalr*" $l] { - set dest [expr 0x$addr + 8 + ($upper << 16) + $lower] - if { $dest != $nm_output(foo) && $dest != $nm_output(bar) } { - send_log "fail 9\n" - send_log "$line\n" - fail $testname - return - } - } else { - set dest [expr ($upper << 16) + $lower] - if ![regexp "<(\[.a-z\]+)\\+(\[0-9a-fA-F\]+)>" $label whole base offset] { - send_log "fail 10\n" - send_log "$line\n" - fail $testname - return - } - set offset 0x$offset - if { $base == ".foo" } { - set offset [expr $offset - ($nm_output(foo) - 0x30)] - } - if { $offset + 8 != - $dest } { - send_log "fail 11\n" - send_log "$line\n" - fail $testname - return - } - } - } - } - - close $file - - if {$balcnt < 10} { - send_log "fail 12\n" - fail $testname - } else { - verbose "$balcnt bal instructions" - pass $testname - } -} - -# We now test actually running embedded MIPS PIC code. This can only -# be done on a MIPS host with the same endianness as our target. -if [istarget mipsel-*-*] { - if ![ishost mips*-*-ultrix*] { - return - } -} else { - if ![ishost mips*-*-irix*] { - return - } -} - -set testname "run embedded PIC code" - -# Compile the program which will run the test. This code must be -# compiled for the host, not the target. -send_log "$CC_FOR_HOST $CFLAGS_FOR_HOST -o tmpdir/run $srcdir/$subdir/run.c\n" -verbose "$CC_FOR_HOST $CFLAGS_FOR_HOST -o tmpdir/run $srcdir/$subdir/run.c" -catch "exec $CC_FOR_HOST $CFLAGS_FOR_HOST -o tmpdir/run $srcdir/$subdir/run.c" exec_output -if ![string match "" $exec_output] { - send_log "$exec_output\n" - verbose "$exec_output" - unresolved $testname - return -} - -# Compile and link the test. -if { ![ld_compile "$CC $CFLAGS -membedded-pic" $srcdir/$subdir/runtesti.s tmpdir/runtesti.o] - || ![ld_compile "$CC $CFLAGS -membedded-pic" $srcdir/$subdir/runtest1.c tmpdir/runtest1.o] - || ![ld_compile "$CC $CFLAGS -membedded-pic" $srcdir/$subdir/runtest2.c tmpdir/runtest2.o] } { - unresolved $testname - return -} -if ![ld_simple_link $ld tmpdir/runtest "--embedded-relocs tmpdir/runtesti.o tmpdir/runtest1.o tmpdir/runtest2.o"] { - fail $testname -} else { - # Now run the test. - send_log "tmpdir/run tmpdir/runtest\n" - verbose "tmpdir/run tmpdir/runtest" - catch "exec tmpdir/run tmpdir/runtest" exec_output - if [string match "*ran and returned 0*" $exec_output] { - send_log "$exec_output\n" - verbose "$exec_output" - pass $testname - } else { - send_log "$exec_output\n" - verbose "$exec_output" - fail $testname - } -} diff --git a/ld/testsuite/ld-empic/relax.t b/ld/testsuite/ld-empic/relax.t deleted file mode 100644 index 8c18b69..0000000 --- a/ld/testsuite/ld-empic/relax.t +++ /dev/null @@ -1,49 +0,0 @@ -OUTPUT_FORMAT("ecoff-bigmips") -SECTIONS -{ - .foo 0x30 : { - tmpdir/relax3.o(.text) - tmpdir/relax1.o(.text) - } - .text 0x20000 : { - _ftext = . ; - *(.init) - eprol = .; - tmpdir/relax4.o(.text) - *(.text) - *(.fini) - etext = .; - _etext = .; - } - .rdata . : { - *(.rdata) - } - _fdata = .; - .data . : { - *(.data) - CONSTRUCTORS - } - _gp = . + 0x8000; - .lit8 . : { - *(.lit8) - } - .lit4 . : { - *(.lit4) - } - .sdata . : { - *(.sdata) - } - edata = .; - _edata = .; - _fbss = .; - .sbss . : { - *(.sbss) - *(.scommon) - } - .bss . : { - *(.bss) - *(COMMON) - } - end = .; - _end = .; -} diff --git a/ld/testsuite/ld-empic/relax1.c b/ld/testsuite/ld-empic/relax1.c deleted file mode 100644 index 20ec39e..0000000 --- a/ld/testsuite/ld-empic/relax1.c +++ /dev/null @@ -1,22 +0,0 @@ -/* First source file in relaxation test. */ - -extern int bar (); -static int foo2 (); - -int foo (int i) -{ - switch (i) - { - case 0: bar (0); break; - case 1: bar (1); break; - case 2: bar (2); break; - case 3: bar (3); break; - case 4: bar (foo2); break; - case 5: bar (bar); break; - } - while (1) - if (i) - return bar (); -} - -static int foo2 () { } diff --git a/ld/testsuite/ld-empic/relax2.c b/ld/testsuite/ld-empic/relax2.c deleted file mode 100644 index 58854a0..0000000 --- a/ld/testsuite/ld-empic/relax2.c +++ /dev/null @@ -1,19 +0,0 @@ -/* Second source file in relaxation test. */ - -int bar2 () -{ - int i; - - for (i = 0; i < 100; i++) - foo (); - return foo () + foo () + foo () + foo (); -} - -int bar (int i) -{ - while (1) - if (i) - return foo (); - else - return foo (); -} diff --git a/ld/testsuite/ld-empic/relax3.c b/ld/testsuite/ld-empic/relax3.c deleted file mode 100644 index 1aaa532..0000000 --- a/ld/testsuite/ld-empic/relax3.c +++ /dev/null @@ -1,3 +0,0 @@ -/* Third source file in relaxation test. */ - -int quux () { return 0; } diff --git a/ld/testsuite/ld-empic/relax4.c b/ld/testsuite/ld-empic/relax4.c deleted file mode 100644 index 21cfb05..0000000 --- a/ld/testsuite/ld-empic/relax4.c +++ /dev/null @@ -1,3 +0,0 @@ -/* Fourth source file in relaxation test. */ - -int xyzzy () { return 0; } diff --git a/ld/testsuite/ld-empic/run.c b/ld/testsuite/ld-empic/run.c deleted file mode 100644 index 9a0377e..0000000 --- a/ld/testsuite/ld-empic/run.c +++ /dev/null @@ -1,160 +0,0 @@ -/* Load and run a MIPS position independent ECOFF file. - Written by Ian Lance Taylor - Public domain. */ - -/* This program will load an ECOFF file into memory and execute it. - The file must have been compiled using the GNU -membedded-pic - switch to produce position independent code. This will only work - if this program is run on a MIPS system with the same endianness as - the ECOFF file. The ECOFF file must be complete. System calls may - not work correctly. - - There are further restrictions on the file (they could be removed - by doing some additional programming). The file must be aligned - such that it does not require any gaps introduced in the data - segment; the GNU linker produces such files by default. However, - the file must not assume that the text or data segment is aligned - on a page boundary. The start address must be at the start of the - text segment. - - The ECOFF file is run by calling it as though it were a function. - The address of the data segment is passed as the only argument. - The file is expected to return an integer value, which will be - printed. */ - -#include -#include -#include - -/* Structures used in ECOFF files. We assume that a short is two - bytes and an int is four bytes. This is not much of an assumption, - since we already assume that we are running on a MIPS host with the - same endianness as the file we are examining. */ - -struct ecoff_filehdr { - unsigned short f_magic; /* magic number */ - unsigned short f_nscns; /* number of sections */ - unsigned int f_timdat; /* time & date stamp */ - unsigned int f_symptr; /* file pointer to symtab */ - unsigned int f_nsyms; /* number of symtab entries */ - unsigned short f_opthdr; /* sizeof(optional hdr) */ - unsigned short f_flags; /* flags */ -}; - -struct ecoff_aouthdr -{ - unsigned short magic; /* type of file */ - unsigned short vstamp; /* version stamp */ - unsigned int tsize; /* text size in bytes, padded to FW bdry*/ - unsigned int dsize; /* initialized data " " */ - unsigned int bsize; /* uninitialized data " " */ - unsigned int entry; /* entry pt. */ - unsigned int text_start; /* base of text used for this file */ - unsigned int data_start; /* base of data used for this file */ - unsigned int bss_start; /* base of bss used for this file */ - unsigned int gprmask; /* ?? */ - unsigned int cprmask[4]; /* ?? */ - unsigned int gp_value; /* value for gp register */ -}; - -#define ECOFF_SCNHDR_SIZE (40) - -static void -die (s) - char *s; -{ - perror (s); - exit (1); -} - -int -main (argc, argv) - int argc; - char **argv; -{ - FILE *f; - struct stat s; - char *z; - struct ecoff_filehdr *fh; - struct ecoff_aouthdr *ah; - unsigned int toff; - char *t, *d; - int (*pfn) (); - int ret; - - if (argc != 2) - { - fprintf (stderr, "Usage: %s file\n", argv[0]); - exit (1); - } - - f = fopen (argv[1], "r"); - if (f == NULL) - die (argv[1]); - - if (stat (argv[1], &s) < 0) - die ("stat"); - - z = (char *) malloc (s.st_size); - if (z == NULL) - die ("malloc"); - - if (fread (z, 1, s.st_size, f) != s.st_size) - die ("fread"); - - /* We need to figure out the start of the text segment, which is the - location we are going to call, and the start of the data segment, - which we are going to pass as an argument. We also need the size - and start address of the bss segment. This information is all in - the ECOFF a.out header. */ - - fh = (struct ecoff_filehdr *) z; - if (fh->f_opthdr != sizeof (struct ecoff_aouthdr)) - { - fprintf (stderr, "%s: unexpected opthdr size: is %u, want %u\n", - argv[1], (unsigned int) fh->f_opthdr, - (unsigned int) sizeof (struct ecoff_aouthdr)); - exit (1); - } - - ah = (struct ecoff_aouthdr *) (z + sizeof (struct ecoff_filehdr)); - if (ah->magic != 0413) - { - fprintf (stderr, "%s: bad aouthdr magic number 0%o (want 0413)\n", - argv[1], (unsigned int) ah->magic); - exit (1); - } - - /* We should clear the bss segment at this point. This is the - ah->bsize bytes starting at ah->bss_start, To do this correctly, - we would have to make sure our memory block is large enough. It - so happens that our test case does not have any additional pages - for the bss segment--it is contained within the data segment. - So, we don't bother. */ - if (ah->bsize != 0) - { - fprintf (stderr, - "%s: bss segment is %u bytes; non-zero sizes not supported\n", - argv[1], ah->bsize); - exit (1); - } - - /* The text section starts just after all the headers, rounded to a - 16 byte boundary. */ - toff = (sizeof (struct ecoff_filehdr) + sizeof (struct ecoff_aouthdr) - + fh->f_nscns * ECOFF_SCNHDR_SIZE); - toff += 15; - toff &=~ 15; - t = z + toff; - - /* The tsize field gives us the start of the data segment. */ - d = z + ah->tsize; - - /* Call the code as a function. */ - pfn = (int (*) ()) t; - ret = (*pfn) (d); - - printf ("%s ran and returned %d\n", argv[1], ret); - - exit (0); -} diff --git a/ld/testsuite/ld-empic/runtest1.c b/ld/testsuite/ld-empic/runtest1.c deleted file mode 100644 index f9ab6eb..0000000 --- a/ld/testsuite/ld-empic/runtest1.c +++ /dev/null @@ -1,117 +0,0 @@ -/* First C source file for actual execution test. */ - -/* The main point of this test is to make sure that the code and data - are truly position independent. We statically initialize several - global variables, and make sure that they are correctly adjusted at - runtime. */ - -int i = 1; -int j = 0; -extern int k; -int l; -char small_buf[] = "aaaa"; -char *small_pointer = small_buf; -char big_buf[] = "aaaaaaaaaaaaaaaa"; -char *big_pointer = big_buf; - -extern int bar (); -int (*pbar) () = bar; - -static int -foo2 (arg) - int arg; -{ - l = arg; - return i + j; -} - -int (*pfoo2) () = foo2; - -int -chkstr (z, c) - char *z; - int c; -{ - /* Switch statements need extra effort to be position independent, - so we run one here, even though most of the cases will never be - taken. */ - switch (c) - { - case 1: - case 2: - case 3: - return i - 1; - case 4: - break; - case 5: - case 6: - case 7: - case 8: - case 9: - return i * j; - case 10: - case 11: - case 12: - case 13: - case 14: - case 15: - return j; - case 16: - break; - default: - return 0; - } - - while (c-- != 0) - if (*z++ != 'a') - return 0; - - return *z == '\0'; -} - -/* This function is called by the assembler startup routine. It tries - to test that everything was correctly initialized. It returns 0 on - success, something else on failure. */ - -int -foo () -{ - if (i != 1) - return 1; - if (j != 0) - return 2; - if (! chkstr (small_buf, 4)) - return 3; - if (! chkstr (small_pointer, 4)) - return 4; - if (! chkstr (big_buf, 16)) - return 5; - if (! chkstr (big_pointer, 16)) - return 6; - - if (l != 0) - return 7; - if (foo2 (1) != 1) - return 8; - if (l != 1) - return 9; - if ((*pfoo2) (2) != 1) - return 10; - if (l != 2) - return 11; - - if (bar (1) != 0) - return 12; - if (bar (-1) != 1) - return 13; - if ((*pbar) (0xa5a5a5a5) != -1) - return 14; - if (k != 0xa5a5a5a5) - return 15; - if ((*pbar) (0) != 0xa5a5a5a5) - return 16; - if (k != 0) - return 17; - - return 0; -} diff --git a/ld/testsuite/ld-empic/runtest2.c b/ld/testsuite/ld-empic/runtest2.c deleted file mode 100644 index 000525f..0000000 --- a/ld/testsuite/ld-empic/runtest2.c +++ /dev/null @@ -1,26 +0,0 @@ -/* Second C source file for actual execution test. */ - -int k; -extern int i; -extern int j; -extern char small_buf[]; -extern char *small_pointer; - -extern int chkstr (); - -int -bar (n) - int n; -{ - int r; - - if (i != 1 - || j != 0 - || ! chkstr (small_buf, 4) - || ! chkstr (small_pointer, 4)) - return k + 1; - - r = k; - k = n; - return r; -} diff --git a/ld/testsuite/ld-empic/runtesti.s b/ld/testsuite/ld-empic/runtesti.s deleted file mode 100644 index efa1953..0000000 --- a/ld/testsuite/ld-empic/runtesti.s +++ /dev/null @@ -1,94 +0,0 @@ -# Assembler initialization code for actual execution test. - -# This code becomes the start of the execution test program. It is -# responsible for initializing the static data, invoking the C code, -# and returning the result. It is called as though it were a C -# function with an argument of the address of the data segment. - -# We need to know the value of _ftext and _fdata at link time, but we -# have no way to actually get that at runtime. This is because when -# this code is compiled with -membedded-pic, the la instruction will -# be turned into an addiu $gp instruction. We work around this by -# storing the information in words in the .data section. We then load -# the values of these words *before* doing the runtime relocation. - .sdata -text_start: - .word _ftext -data_start: - .word _fdata - - .globl start - .text -start: - # Grab some space on the stack, just as though we were a real - # function. - addiu $sp,$sp,-8 - sw $31,0($sp) - - # Save the $gp register, and set it up for our data section. - sw $gp,4($sp) - - addu $gp,$4,0x8000 # macro - - # The start of the data segment is in $4. - - # Get the address of start into $5 in a position independent - # fashion. - .set noreorder - $LF1 = . + 8 - bal $LF1 - la $5,start-$LF1 # macro - .set reorder - addu $5,$5,$31 - - # Now get the address of _ftext into $6. - la $6,_ftext-start # macro - addu $6,$6,$5 - - # Get the value of _ftext used to link into $7. - lw $7,text_start # macro - - # Get the value of _fdata used to link into $8. - lw $8,data_start # macro - - # Get the address of __runtime_reloc_start into $9. - la $9,__runtime_reloc_start-start # macro - addu $9,$9,$5 - - # Get the address of __runtime_reloc_stop into $10. - la $10,__runtime_reloc_stop-start # macro - addu $10,$10,$5 - - # The words between $9 and $10 are the runtime initialization - # instructions. Step through and relocate them. First set - # $11 and $12 to the values to add to text and data sections, - # respectively. - subu $11,$6,$7 - subu $12,$4,$8 - -1: - bge $9,$10,3f # macro - lw $13,0($9) - and $14,$13,0xfffffffe # macro - move $15,$11 - beq $13,$14,2f - move $15,$12 -2: - addu $14,$14,$4 - lw $24,0($14) - addu $24,$24,$15 - sw $24,0($14) - addiu $9,$9,4 - b 1b -3: - - # Now the statically initialized data has been relocated - # correctly, and we can call the C code which does the actual - # testing. - bal foo - - # We return the value returned by the C code. - lw $31,0($sp) - lw $gp,4($sp) - addu $sp,$sp,8 - j $31 diff --git a/ld/testsuite/ld-mips-elf/empic1-ln.d b/ld/testsuite/ld-mips-elf/empic1-ln.d deleted file mode 100644 index eb78478..0000000 --- a/ld/testsuite/ld-mips-elf/empic1-ln.d +++ /dev/null @@ -1,27 +0,0 @@ -#name: MIPS 32-bit ELF embedded-pic relocs #1-ln (large negative) -#as: -membedded-pic -mips3 -#source: empic1-tgt.s -#source: empic1-space.s -#source: empic1-space.s -#source: empic1-ref.s -#objdump: --prefix-addresses -tdr --show-raw-insn -mmips:4000 -#ld: -Ttext 0x400000 -e 0x400000 - -.*: file format elf.*mips.* - -SYMBOL TABLE: -#... -0+410020 g F .text [0-9a-f]+ foo -#... -0+400000 g F .text [0-9a-f]+ bar -#... - -Disassembly of section \.text: - ... - ... - ... -0+410020 <[^>]*> 00000000 nop -0+410024 <[^>]*> 3c02ffff lui v0,0xffff -0+410028 <[^>]*> 6442ffe0 daddiu v0,v0,-32 - ... -#pass diff --git a/ld/testsuite/ld-mips-elf/empic1-lp.d b/ld/testsuite/ld-mips-elf/empic1-lp.d deleted file mode 100644 index bd11e52..0000000 --- a/ld/testsuite/ld-mips-elf/empic1-lp.d +++ /dev/null @@ -1,26 +0,0 @@ -#name: MIPS 32-bit ELF embedded-pic relocs #1-lp (large positive) -#as: -membedded-pic -mips3 -#source: empic1-ref.s -#source: empic1-space.s -#source: empic1-space.s -#source: empic1-tgt.s -#objdump: --prefix-addresses -tdr --show-raw-insn -mmips:4000 -#ld: -Ttext 0x400000 -e 0x400000 - -.*: file format elf.*mips.* - -SYMBOL TABLE: -#... -0+400000 g F .text [0-9a-f]+ foo -#... -0+410020 g F .text [0-9a-f]+ bar -#... - -Disassembly of section \.text: -0+400000 <[^>]*> 00000000 nop -0+400004 <[^>]*> 3c020001 lui v0,0x1 -0+400008 <[^>]*> 64420020 daddiu v0,v0,32 - ... - ... - ... -#pass diff --git a/ld/testsuite/ld-mips-elf/empic1-mn.d b/ld/testsuite/ld-mips-elf/empic1-mn.d deleted file mode 100644 index fa43abf..0000000 --- a/ld/testsuite/ld-mips-elf/empic1-mn.d +++ /dev/null @@ -1,25 +0,0 @@ -#name: MIPS 32-bit ELF embedded-pic relocs #1-mn (medium negative) -#as: -membedded-pic -mips3 -#source: empic1-tgt.s -#source: empic1-space.s -#source: empic1-ref.s -#objdump: --prefix-addresses -tdr --show-raw-insn -mmips:4000 -#ld: -Ttext 0x400000 -e 0x400000 - -.*: file format elf.*mips.* - -SYMBOL TABLE: -#... -0+408020 g F .text [0-9a-f]+ foo -#... -0+400000 g F .text [0-9a-f]+ bar -#... - -Disassembly of section \.text: - ... - ... -0+408020 <[^>]*> 00000000 nop -0+408024 <[^>]*> 3c02ffff lui v0,0xffff -0+408028 <[^>]*> 64427fe0 daddiu v0,v0,32736 - ... -#pass diff --git a/ld/testsuite/ld-mips-elf/empic1-mp.d b/ld/testsuite/ld-mips-elf/empic1-mp.d deleted file mode 100644 index 27d1574..0000000 --- a/ld/testsuite/ld-mips-elf/empic1-mp.d +++ /dev/null @@ -1,25 +0,0 @@ -#name: MIPS 32-bit ELF embedded-pic relocs #1-mp (medium positive) -#as: -membedded-pic -mips3 -#source: empic1-ref.s -#source: empic1-space.s -#source: empic1-tgt.s -#objdump: --prefix-addresses -tdr --show-raw-insn -mmips:4000 -#ld: -Ttext 0x400000 -e 0x400000 - -.*: file format elf.*mips.* - -SYMBOL TABLE: -#... -0+400000 g F .text [0-9a-f]+ foo -#... -0+408020 g F .text [0-9a-f]+ bar -#... - -Disassembly of section \.text: -0+400000 <[^>]*> 00000000 nop -0+400004 <[^>]*> 3c020001 lui v0,0x1 -0+400008 <[^>]*> 64428020 daddiu v0,v0,-32736 - ... - ... - ... -#pass diff --git a/ld/testsuite/ld-mips-elf/empic1-ref.s b/ld/testsuite/ld-mips-elf/empic1-ref.s deleted file mode 100644 index dfa345e..0000000 --- a/ld/testsuite/ld-mips-elf/empic1-ref.s +++ /dev/null @@ -1,9 +0,0 @@ - - .globl foo - .ent foo -foo: - nop - la $2, bar - foo - .end foo - - .p2align 5 diff --git a/ld/testsuite/ld-mips-elf/empic1-sn.d b/ld/testsuite/ld-mips-elf/empic1-sn.d deleted file mode 100644 index 6d041ed..0000000 --- a/ld/testsuite/ld-mips-elf/empic1-sn.d +++ /dev/null @@ -1,23 +0,0 @@ -#name: MIPS 32-bit ELF embedded-pic relocs #1-sn (small negative) -#as: -membedded-pic -mips3 -#source: empic1-tgt.s -#source: empic1-ref.s -#objdump: --prefix-addresses -tdr --show-raw-insn -mmips:4000 -#ld: -Ttext 0x400000 -e 0x400000 - -.*: file format elf.*mips.* - -SYMBOL TABLE: -#... -0+400020 g F .text [0-9a-f]+ foo -#... -0+400000 g F .text [0-9a-f]+ bar -#... - -Disassembly of section \.text: - ... -0+400020 <[^>]*> 00000000 nop -0+400024 <[^>]*> 3c020000 lui v0,0x0 -0+400028 <[^>]*> 6442ffe0 daddiu v0,v0,-32 - ... -#pass diff --git a/ld/testsuite/ld-mips-elf/empic1-sp.d b/ld/testsuite/ld-mips-elf/empic1-sp.d deleted file mode 100644 index f91d625..0000000 --- a/ld/testsuite/ld-mips-elf/empic1-sp.d +++ /dev/null @@ -1,23 +0,0 @@ -#name: MIPS 32-bit ELF embedded-pic relocs #1-sp (small positive) -#as: -membedded-pic -mips3 -#source: empic1-ref.s -#source: empic1-tgt.s -#objdump: --prefix-addresses -tdr --show-raw-insn -mmips:4000 -#ld: -Ttext 0x400000 -e 0x400000 - -.*: file format elf.*mips.* - -SYMBOL TABLE: -#... -0+400000 g F .text [0-9a-f]+ foo -#... -0+400020 g F .text [0-9a-f]+ bar -#... - -Disassembly of section \.text: -0+400000 <[^>]*> 00000000 nop -0+400004 <[^>]*> 3c020000 lui v0,0x0 -0+400008 <[^>]*> 64420020 daddiu v0,v0,32 - ... - ... -#pass diff --git a/ld/testsuite/ld-mips-elf/empic1-space.s b/ld/testsuite/ld-mips-elf/empic1-space.s deleted file mode 100644 index 9c30cfb..0000000 --- a/ld/testsuite/ld-mips-elf/empic1-space.s +++ /dev/null @@ -1,5 +0,0 @@ - - .ent space -space: - .space (32 * 1024) - .end space diff --git a/ld/testsuite/ld-mips-elf/empic1-tgt.s b/ld/testsuite/ld-mips-elf/empic1-tgt.s deleted file mode 100644 index 909488c..0000000 --- a/ld/testsuite/ld-mips-elf/empic1-tgt.s +++ /dev/null @@ -1,8 +0,0 @@ - - .globl bar - .ent bar -bar: - nop - .end bar - - .p2align 5 diff --git a/ld/testsuite/ld-mips-elf/empic2-fwd-0.d b/ld/testsuite/ld-mips-elf/empic2-fwd-0.d deleted file mode 100644 index e53f1fa..0000000 --- a/ld/testsuite/ld-mips-elf/empic2-fwd-0.d +++ /dev/null @@ -1,20 +0,0 @@ -#name: MIPS 32-bit ELF embedded-pic relocs #2-fwd-0 (0x7ffc forward edge case) -#as: -membedded-pic -mips3 -#source: empic2-ref.s -#source: empic2-fwd-tgt.s -#objdump: --prefix-addresses -tdr --show-raw-insn -mmips:4000 -#ld: -Ttext 0x400000 -e 0x400000 - -.*: file format elf.*mips.* - -#... -0+400000 g F .text [0-9a-f]+ foo -#... -0+407ffc g F .text [0-9a-f]+ bar -#... - -Disassembly of section \.text: -0+400000 <[^>]*> 3c020000 lui v0,0x0 -0+400004 <[^>]*> 64427ffc daddiu v0,v0,32764 - ... -#pass diff --git a/ld/testsuite/ld-mips-elf/empic2-fwd-1.d b/ld/testsuite/ld-mips-elf/empic2-fwd-1.d deleted file mode 100644 index e720852..0000000 --- a/ld/testsuite/ld-mips-elf/empic2-fwd-1.d +++ /dev/null @@ -1,21 +0,0 @@ -#name: MIPS 32-bit ELF embedded-pic relocs #2-fwd-1 (0xfffc forward edge case) -#as: -membedded-pic -mips3 -#source: empic2-ref.s -#source: empic2-space.s -#source: empic2-fwd-tgt.s -#objdump: --prefix-addresses -tdr --show-raw-insn -mmips:4000 -#ld: -Ttext 0x400000 -e 0x400000 - -.*: file format elf.*mips.* - -#... -0+400000 g F .text [0-9a-f]+ foo -#... -0+40fffc g F .text [0-9a-f]+ bar -#... - -Disassembly of section \.text: -0+400000 <[^>]*> 3c020001 lui v0,0x1 -0+400004 <[^>]*> 6442fffc daddiu v0,v0,-4 - ... -#pass diff --git a/ld/testsuite/ld-mips-elf/empic2-fwd-tgt.s b/ld/testsuite/ld-mips-elf/empic2-fwd-tgt.s deleted file mode 100644 index 915cf45..0000000 --- a/ld/testsuite/ld-mips-elf/empic2-fwd-tgt.s +++ /dev/null @@ -1,7 +0,0 @@ - - .space (32768 - 16 - 4) # 16..32764 - - .globl bar - .ent bar -bar: - .end bar diff --git a/ld/testsuite/ld-mips-elf/empic2-ref.s b/ld/testsuite/ld-mips-elf/empic2-ref.s deleted file mode 100644 index 7048887..0000000 --- a/ld/testsuite/ld-mips-elf/empic2-ref.s +++ /dev/null @@ -1,7 +0,0 @@ - .globl foo - .ent foo -foo: - la $2,bar-foo - .end foo - - .p2align 4 diff --git a/ld/testsuite/ld-mips-elf/empic2-rev-0.d b/ld/testsuite/ld-mips-elf/empic2-rev-0.d deleted file mode 100644 index 9bd9acc..0000000 --- a/ld/testsuite/ld-mips-elf/empic2-rev-0.d +++ /dev/null @@ -1,22 +0,0 @@ -#name: MIPS 32-bit ELF embedded-pic relocs #2-rev-0 (0x0004 backward edge case) -#as: -membedded-pic -mips3 -#source: empic2-rev-tgt.s -#source: empic2-ref.s -#objdump: --prefix-addresses -tdr --show-raw-insn -mmips:4000 -#ld: -Ttext 0x400000 -e 0x400000 - -.*: file format elf.*mips.* - -#... -0+408000 g F .text [0-9a-f]+ foo -#... -0+407ffc g F .text [0-9a-f]+ bar -#... - -Disassembly of section \.text: - ... -0+407ffc <[^>]*> 00000000 nop -0+408000 <[^>]*> 3c020000 lui v0,0x0 -0+408004 <[^>]*> 6442fffc daddiu v0,v0,-4 - ... -#pass diff --git a/ld/testsuite/ld-mips-elf/empic2-rev-1.d b/ld/testsuite/ld-mips-elf/empic2-rev-1.d deleted file mode 100644 index 1a38ec2..0000000 --- a/ld/testsuite/ld-mips-elf/empic2-rev-1.d +++ /dev/null @@ -1,24 +0,0 @@ -#name: MIPS 32-bit ELF embedded-pic relocs #2-rev-1 (0x8004 backward edge case) -#as: -membedded-pic -mips3 -#source: empic2-rev-tgt.s -#source: empic2-space.s -#source: empic2-ref.s -#objdump: --prefix-addresses -tdr --show-raw-insn -mmips:4000 -#ld: -Ttext 0x400000 -e 0x400000 - -.*: file format elf.*mips.* - -#... -0+410000 g F .text [0-9a-f]+ foo -#... -0+407ffc g F .text [0-9a-f]+ bar -#... - -Disassembly of section \.text: - ... -0+407ffc <[^>]*> 00000000 nop - ... -0+410000 <[^>]*> 3c02ffff lui v0,0xffff -0+410004 <[^>]*> 64427ffc daddiu v0,v0,32764 - ... -#pass diff --git a/ld/testsuite/ld-mips-elf/empic2-rev-tgt.s b/ld/testsuite/ld-mips-elf/empic2-rev-tgt.s deleted file mode 100644 index 8124cfe..0000000 --- a/ld/testsuite/ld-mips-elf/empic2-rev-tgt.s +++ /dev/null @@ -1,8 +0,0 @@ - - .space (32768 - 4) - - .globl bar - .ent bar -bar: - .space 4 - .end bar diff --git a/ld/testsuite/ld-mips-elf/empic2-space.s b/ld/testsuite/ld-mips-elf/empic2-space.s deleted file mode 100644 index 9c30cfb..0000000 --- a/ld/testsuite/ld-mips-elf/empic2-space.s +++ /dev/null @@ -1,5 +0,0 @@ - - .ent space -space: - .space (32 * 1024) - .end space diff --git a/ld/testsuite/ld-mips-elf/emrelocs-eb.d b/ld/testsuite/ld-mips-elf/emrelocs-eb.d deleted file mode 100644 index dd79bdd..0000000 --- a/ld/testsuite/ld-mips-elf/emrelocs-eb.d +++ /dev/null @@ -1,25 +0,0 @@ -#name: MIPS 32-bit ELF embedded relocs (big endian) -#source: emrelocs1.s -EB -#source: emrelocs2.s -EB -#ld: -EB --embedded-relocs -T $srcdir/$subdir/emrelocs.ld -#objdump: -s - -.*: file format elf.*mips.* - -Contents of section \.text: - 100000 00000000 00000001 00000000 00000000 .* - 100010 00000000 00000000 00000003 00000000 .* -Contents of section \.data: - 200000 00000000 00000002 00000000 00000000 .* - 200010 00000000 00000000 00000004 00000000 .* - 200020 00100004 00200004 00100018 00200018 .* - 200030 00000000 00100004 00000000 00200004 .* - 200040 00000000 00100018 00000000 00200018 .* -Contents of section \.rel\.sdata: - 300000 00000020 2e746578 74000000 00000024 .* - 300010 2e646174 61000000 00000028 2e746578 .* - 300020 74000000 0000002c 2e646174 61000000 .* - 300030 00000031 2e746578 74000000 00000039 .* - 300040 2e646174 61000000 00000041 2e746578 .* - 300050 74000000 00000049 2e646174 61000000 .* -#pass diff --git a/ld/testsuite/ld-mips-elf/emrelocs-el.d b/ld/testsuite/ld-mips-elf/emrelocs-el.d deleted file mode 100644 index ad1e495..0000000 --- a/ld/testsuite/ld-mips-elf/emrelocs-el.d +++ /dev/null @@ -1,25 +0,0 @@ -#name: MIPS 32-bit ELF embedded relocs (little endian) -#source: emrelocs1.s -EL -#source: emrelocs2.s -EL -#ld: -EL --embedded-relocs -T $srcdir/$subdir/emrelocs.ld -#objdump: -s - -.*: file format elf.*mips.* - -Contents of section \.text: - 100000 00000000 01000000 00000000 00000000 .* - 100010 00000000 00000000 03000000 00000000 .* -Contents of section \.data: - 200000 00000000 02000000 00000000 00000000 .* - 200010 00000000 00000000 04000000 00000000 .* - 200020 04001000 04002000 18001000 18002000 .* - 200030 04001000 00000000 04002000 00000000 .* - 200040 18001000 00000000 18002000 00000000 .* -Contents of section \.rel\.sdata: - 300000 20000000 2e746578 74000000 24000000 .* - 300010 2e646174 61000000 28000000 2e746578 .* - 300020 74000000 2c000000 2e646174 61000000 .* - 300030 31000000 2e746578 74000000 39000000 .* - 300040 2e646174 61000000 41000000 2e746578 .* - 300050 74000000 49000000 2e646174 61000000 .* -#pass diff --git a/ld/testsuite/ld-mips-elf/emrelocs.ld b/ld/testsuite/ld-mips-elf/emrelocs.ld deleted file mode 100644 index 557f139..0000000 --- a/ld/testsuite/ld-mips-elf/emrelocs.ld +++ /dev/null @@ -1,16 +0,0 @@ -ENTRY(ext_fun) -SECTIONS -{ - .text 0x00100000: - { - *(.text) - } - .data 0x00200000: - { - *(.sdata) - } - .rel.sdata 0x00300000: - { - *(.rel.sdata) - } -} diff --git a/ld/testsuite/ld-mips-elf/emrelocs1.s b/ld/testsuite/ld-mips-elf/emrelocs1.s deleted file mode 100644 index 3e679ae..0000000 --- a/ld/testsuite/ld-mips-elf/emrelocs1.s +++ /dev/null @@ -1,23 +0,0 @@ -# emrelocs1.s: some external symbols to be used in relocations. - - .text - .p2align 4 - - # Pad things so addresses which are used for relocations - # are non-zero. Zero simply isn't as much fun. - .word 0 - - .globl ext_fun - .ent ext_fun -ext_fun: .word 1 - .end ext_fun - - - .sdata - .p2align 4 - - # Padding here, for same reason. - .word 0 - - .globl ext_var -ext_var: .word 2 diff --git a/ld/testsuite/ld-mips-elf/emrelocs2.s b/ld/testsuite/ld-mips-elf/emrelocs2.s deleted file mode 100644 index 77570f1..0000000 --- a/ld/testsuite/ld-mips-elf/emrelocs2.s +++ /dev/null @@ -1,30 +0,0 @@ -# emrelocs2.s: local symbols and data which causes relocations. - - .text - .p2align 4 - - .word 0, 0 - - .ent lcl_fun -lcl_fun: .word 3 - .end lcl_fun - - - .sdata - .p2align 4 - - .word 0, 0 - -lcl_var: .word 4 - - .p2align 4 - - .word ext_fun - .word ext_var - .word lcl_fun - .word lcl_var - - .dword ext_fun - .dword ext_var - .dword lcl_fun - .dword lcl_var diff --git a/ld/testsuite/ld-mips-elf/mips-elf.exp b/ld/testsuite/ld-mips-elf/mips-elf.exp index f2194a1..50cb811 100644 --- a/ld/testsuite/ld-mips-elf/mips-elf.exp +++ b/ld/testsuite/ld-mips-elf/mips-elf.exp @@ -58,25 +58,6 @@ if { $linux_gnu } { } if { $embedded_elf } { - # Check basic Embedded-PIC PC-relative HI/LO relocs. - run_dump_test "empic1-ln" - run_dump_test "empic1-lp" - run_dump_test "empic1-mn" - run_dump_test "empic1-mp" - run_dump_test "empic1-sn" - run_dump_test "empic1-sp" - - # Embedded-PIC PC-relative HI/LO reloc edge-case regression tests. - # As of 2001-12-26, the linker botches the fwd-0 and rev-1 tests. - run_dump_test "empic2-fwd-0" - run_dump_test "empic2-fwd-1" - run_dump_test "empic2-rev-0" - run_dump_test "empic2-rev-1" - - # Check generation of embedded relocs section. - run_dump_test "emrelocs-eb" - run_dump_test "emrelocs-el" - run_dump_test "region1" } -- 2.7.4