This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH RFA] implement "ld --embedded-relocs" for 32-bit MIPSELF.


The patch below implements and adds a test case for "ld
--embedded-relocs" for 32-bit MIPS ELF.

I previously submitted a patch to do this last October, in the
message:

	http://sources.redhat.com/ml/binutils/2001-10/msg00653.html

but subsequently withdrew it in the hopes of doing something Better.

Anyway, that better thing never materialized, and what I was doing
before is no worse than (in fact, it's approx. the same as) what is
done for m68k ELF+COFF and MIPS COFF.  We use the code every day, and
rely on it.

Anyway, so, I'd like to get this patch in pre-branch, or, if not, then
on branch and trunk.

It doesn't really modify an existing functionality.

It's been tested in the current binutils sources by make && make check
for the following targets, from an x86-linux host.

	mips-elf mips64-elf mips-linux mipsel-linux


As noted previously, there are no documentation changes, etc., because
the manual already seems to document --embedded-relocs for MIPS...


chris
====
[ bfd/Changelog ]
2002-01-29  Chris Demetriou  <cgd@broadcom.com>
            Mitch Lichtenberg  <mpl@broadcom.com>

	* bfd-in.h (bfd_mips_elf32_create_embedded_relocs): New prototype.
	* elf32-mips.c (bfd_mips_elf32_create_embedded_relocs): New function
	to handle 32-bit ELF embedded reloc (ld --embedded-relocs)
	generation.
	* bfd-in2.h: Regenerate.

[ ld/ChangeLog ]
2002-01-29  Chris Demetriou  <cgd@broadcom.com>
            Mitch Lichtenberg  <mpl@broadcom.com>

	* emulparams/elf32bmip.sh (EXTRA_EM_FILE): Define to be mipself.
	* emultempl/mipself.sh: New file to handle MIPS ELF embedded
	reloc creation (ld --embedded-relocs).

[ ld/testsuite/ChangeLog ]
2002-01-29  Chris Demetriou  <cgd@broadcom.com>

	* ld-mips-elf/emrelocs-eb.d: New file to test --embedded-relocs.
	* ld-mips-elf/emrelocs-el.d: Likewise.
	* ld-mips-elf/emrelocs1.s: Likewise.
	* ld-mips-elf/emrelocs2.s: Likewise.
	* ld-mips-elf/emrelocs.ld: Likewise.
	* ld-mips-elf/mips-elf.exp: Add the above to the list of tests.

Index: bfd/bfd-in.h
===================================================================
RCS file: /cvs/src/src/bfd/bfd-in.h,v
retrieving revision 1.38
diff -u -p -r1.38 bfd-in.h
--- bfd-in.h	2001/12/22 17:18:34	1.38
+++ bfd-in.h	2002/01/30 01:13:17
@@ -663,6 +663,9 @@ extern int bfd_get_sign_extend_vma PARAM
 extern boolean bfd_m68k_elf32_create_embedded_relocs
   PARAMS ((bfd *, struct bfd_link_info *, struct sec *, struct sec *,
 	   char **));
+extern boolean bfd_mips_elf32_create_embedded_relocs
+  PARAMS ((bfd *, struct bfd_link_info *, struct sec *, struct sec *,
+	   char **));
 
 /* SunOS shared library support routines for the linker.  */
 
Index: bfd/bfd-in2.h
===================================================================
RCS file: /cvs/src/src/bfd/bfd-in2.h,v
retrieving revision 1.136
diff -u -p -r1.136 bfd-in2.h
--- bfd-in2.h	2002/01/06 07:30:35	1.136
+++ bfd-in2.h	2002/01/30 01:13:17
@@ -669,6 +669,9 @@ extern int bfd_get_sign_extend_vma PARAM
 extern boolean bfd_m68k_elf32_create_embedded_relocs
   PARAMS ((bfd *, struct bfd_link_info *, struct sec *, struct sec *,
 	   char **));
+extern boolean bfd_mips_elf32_create_embedded_relocs
+  PARAMS ((bfd *, struct bfd_link_info *, struct sec *, struct sec *,
+	   char **));
 
 /* SunOS shared library support routines for the linker.  */
 
Index: bfd/elf32-mips.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-mips.c,v
retrieving revision 1.139
diff -u -p -r1.139 elf32-mips.c
--- elf32-mips.c	2002/01/21 10:29:09	1.139
+++ elf32-mips.c	2002/01/30 01:13:20
@@ -9824,6 +9824,181 @@ _bfd_elf32_mips_write_section (output_bf
   return true;
 }
 
+/* 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.  */
+
+boolean
+bfd_mips_elf32_create_embedded_relocs (abfd, info, datasec, relsec, errmsg)
+     bfd *abfd;
+     struct bfd_link_info *info;
+     asection *datasec;
+     asection *relsec;
+     char **errmsg;
+{
+  Elf_Internal_Shdr *symtab_hdr;
+  Elf_Internal_Shdr *shndx_hdr;
+  Elf32_External_Sym *extsyms;
+  Elf32_External_Sym *free_extsyms = NULL;
+  Elf_External_Sym_Shndx *shndx_buf = NULL;
+  Elf_Internal_Rela *internal_relocs;
+  Elf_Internal_Rela *free_relocs = NULL;
+  Elf_Internal_Rela *irel, *irelend;
+  bfd_byte *p;
+  bfd_size_type amt;
+
+  BFD_ASSERT (! info->relocateable);
+
+  *errmsg = NULL;
+
+  if (datasec->reloc_count == 0)
+    return true;
+
+  symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
+  /* Read this BFD's symbols if we haven't done so already, or get the cached
+     copy if it exists.  */
+  if (symtab_hdr->contents != NULL)
+    extsyms = (Elf32_External_Sym *) symtab_hdr->contents;
+  else
+    {
+      /* Go get them off disk.  */
+      if (info->keep_memory)
+	extsyms = ((Elf32_External_Sym *)
+		   bfd_alloc (abfd, symtab_hdr->sh_size));
+      else
+	extsyms = ((Elf32_External_Sym *)
+		   bfd_malloc (symtab_hdr->sh_size));
+      if (extsyms == NULL)
+	goto error_return;
+      if (! info->keep_memory)
+	free_extsyms = extsyms;
+      if (bfd_seek (abfd, symtab_hdr->sh_offset, SEEK_SET) != 0
+	  || (bfd_bread (extsyms, symtab_hdr->sh_size, abfd)
+	      != symtab_hdr->sh_size))
+	goto error_return;
+      if (info->keep_memory)
+	symtab_hdr->contents = (unsigned char *) extsyms;
+    }
+
+  shndx_hdr = &elf_tdata (abfd)->symtab_shndx_hdr;
+  if (shndx_hdr->sh_size != 0)
+    {
+      amt = symtab_hdr->sh_info * sizeof (Elf_External_Sym_Shndx);
+      shndx_buf = (Elf_External_Sym_Shndx *) bfd_malloc (amt);
+      if (shndx_buf == NULL)
+	goto error_return;
+      if (bfd_seek (abfd, shndx_hdr->sh_offset, SEEK_SET) != 0
+	  || bfd_bread ((PTR) shndx_buf, amt, abfd) != amt)
+	goto error_return;
+    }
+
+  /* Get a copy of the native relocations.  */
+  internal_relocs = (_bfd_elf32_link_read_relocs
+		     (abfd, datasec, (PTR) NULL, (Elf_Internal_Rela *) NULL,
+		      info->keep_memory));
+  if (internal_relocs == NULL)
+    goto error_return;
+  if (! info->keep_memory)
+    free_relocs = internal_relocs;
+
+  relsec->contents = (bfd_byte *) 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)
+	{
+          Elf32_External_Sym *esym;
+          Elf_External_Sym_Shndx *shndx;
+          Elf_Internal_Sym isym;
+
+          /* A local symbol.  */
+          esym = extsyms + ELF32_R_SYM (irel->r_info);
+          shndx = shndx_buf + (shndx_buf ? ELF32_R_SYM (irel->r_info) : 0);
+	  bfd_elf32_swap_symbol_in (abfd, esym, shndx, &isym);
+
+	  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 (shndx_buf != NULL)
+    free (shndx_buf);
+  if (free_extsyms != NULL)
+    free (free_extsyms);
+  if (free_relocs != NULL)
+    free (free_relocs);
+  return true;
+
+ error_return:
+  if (shndx_buf != NULL)
+    free (shndx_buf);
+  if (free_extsyms != NULL)
+    free (free_extsyms);
+  if (free_relocs != NULL)
+    free (free_relocs);
+  return false;
+}
+
 /* This is almost identical to bfd_generic_get_... except that some
    MIPS relocations need to be handled specially.  Sigh.  */
 
Index: ld/emulparams/elf32bmip.sh
===================================================================
RCS file: /cvs/src/src/ld/emulparams/elf32bmip.sh,v
retrieving revision 1.3
diff -u -p -r1.3 elf32bmip.sh
--- elf32bmip.sh	2001/11/22 09:08:04	1.3
+++ elf32bmip.sh	2002/01/30 01:13:25
@@ -32,4 +32,5 @@ OTHER_SECTIONS='
 ARCH=mips
 MACHINE=
 TEMPLATE_NAME=elf32
+EXTRA_EM_FILE=mipself
 GENERATE_SHLIB_SCRIPT=yes
Index: ld/emultempl/mipself.em
===================================================================
RCS file: mipself.em
diff -N mipself.em
--- /dev/null	Tue May  5 13:32:27 1998
+++ mipself.em	Tue Jan 29 17:13:25 2002
@@ -0,0 +1,183 @@
+# Copyright 2001 Free Software Foundation, Inc.
+#   Written by Mitch Lichtenberg <mpl@broadcom.com> and
+#   Chris Demetriou <cgd@broadcom.com> 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 shell script emits a C file. -*- C -*-
+
+
+# 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 <<EOF
+
+static void mips_elf${ELFSIZE}_after_open PARAMS ((void));
+#ifdef SUPPORT_EMBEDDED_RELOCS
+static void mips_elf${ELFSIZE}_check_sections PARAMS ((bfd *, asection *,
+						       PTR));
+#endif
+static void mips_elf${ELFSIZE}_after_allocation PARAMS ((void));
+
+/* This function is run after all the input files have been opened.  */
+
+static void
+mips_elf${ELFSIZE}_after_open()
+{
+  /* Call the standard elf routine.  */
+  gld${EMULATION_NAME}_after_open ();
+
+#ifdef SUPPORT_EMBEDDED_RELOCS
+  if (command_line.embedded_relocs && (! link_info.relocateable))
+    {  
+      bfd *abfd;
+
+      /* In the embedded relocs mode we create a .rel.sdata section for
+	 each input file with a .sdata section which has has
+	 relocations.  The BFD backend will fill in these sections
+	 with magic numbers which can be used to relocate the data
+	 section at run time.  */
+      for (abfd = link_info.input_bfds; abfd != NULL; abfd = abfd->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,
+				 (PTR) 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 (abfd, sec, sdatasec)
+     bfd *abfd;
+     asection *sec;
+     PTR sdatasec;
+{
+  if ((bfd_get_section_flags (abfd, sec) & SEC_CODE) == 0
+      && sec != (asection *) sdatasec
+      && sec->reloc_count != 0)
+    einfo ("%F%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 ()
+{
+  /* Call the standard elf routine.  */
+  after_allocation_default ();
+
+#ifdef SUPPORT_EMBEDDED_RELOCS
+  if (command_line.embedded_relocs && (! link_info.relocateable))
+    {
+      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
Index: ld/testsuite/ld-mips-elf/emrelocs-eb.d
===================================================================
RCS file: emrelocs-eb.d
diff -N emrelocs-eb.d
--- /dev/null	Tue May  5 13:32:27 1998
+++ emrelocs-eb.d	Tue Jan 29 17:13:26 2002
@@ -0,0 +1,25 @@
+#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
Index: ld/testsuite/ld-mips-elf/emrelocs-el.d
===================================================================
RCS file: emrelocs-el.d
diff -N emrelocs-el.d
--- /dev/null	Tue May  5 13:32:27 1998
+++ emrelocs-el.d	Tue Jan 29 17:13:26 2002
@@ -0,0 +1,25 @@
+#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
Index: ld/testsuite/ld-mips-elf/emrelocs.ld
===================================================================
RCS file: emrelocs.ld
diff -N emrelocs.ld
--- /dev/null	Tue May  5 13:32:27 1998
+++ emrelocs.ld	Tue Jan 29 17:13:26 2002
@@ -0,0 +1,16 @@
+ENTRY(ext_fun)
+SECTIONS
+{
+  .text 0x00100000: 
+  {
+    *(.text)
+  }
+  .data 0x00200000: 
+  {
+    *(.sdata)
+  }
+  .rel.sdata 0x00300000: 
+  {
+    *(.rel.sdata)
+  }
+}
Index: ld/testsuite/ld-mips-elf/emrelocs1.s
===================================================================
RCS file: emrelocs1.s
diff -N emrelocs1.s
--- /dev/null	Tue May  5 13:32:27 1998
+++ emrelocs1.s	Tue Jan 29 17:13:26 2002
@@ -0,0 +1,23 @@
+# 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
Index: ld/testsuite/ld-mips-elf/emrelocs2.s
===================================================================
RCS file: emrelocs2.s
diff -N emrelocs2.s
--- /dev/null	Tue May  5 13:32:27 1998
+++ emrelocs2.s	Tue Jan 29 17:13:26 2002
@@ -0,0 +1,30 @@
+# 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
Index: ld/testsuite/ld-mips-elf/mips-elf.exp
===================================================================
RCS file: /cvs/src/src/ld/testsuite/ld-mips-elf/mips-elf.exp,v
retrieving revision 1.1
diff -u -p -r1.1 mips-elf.exp
--- mips-elf.exp	2002/01/02 18:59:32	1.1
+++ mips-elf.exp	2002/01/30 01:13:26
@@ -34,5 +34,9 @@ if { [istarget mips*-*-*] } then {
 	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"
     }
 }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]