Jan Kratochvil 4140ce
http://sourceware.org/ml/binutils-cvs/2008-09/msg00088.html
Jan Kratochvil 4140ce
http://sourceware.org/ml/binutils/2008-09/msg00125.html
Jan Kratochvil 4140ce
Jan Kratochvil 4140ce
2008-09-17  Jan Kratochvil  <jan.kratochvil@redhat.com>
Jan Kratochvil 4140ce
Jan Kratochvil 4140ce
	Fix testcases compilation failures due to unused variables.
Jan Kratochvil 4140ce
	* ld-elfcomm/common1b.c (dummy1): Mark the variable for GCC as USED.
Jan Kratochvil 4140ce
	* ld-shared/main.c (main): Move the P variable only to the places where
Jan Kratochvil 4140ce
	it is used.
Jan Kratochvil 4140ce
Jan Kratochvil 4140ce
===================================================================
Jan Kratochvil 4140ce
RCS file: /cvs/src/src/ld/testsuite/ld-elfcomm/common1b.c,v
Jan Kratochvil 4140ce
retrieving revision 1.1
Jan Kratochvil 4140ce
retrieving revision 1.2
Jan Kratochvil 4140ce
diff -u -r1.1 -r1.2
Jan Kratochvil 4140ce
--- ld/testsuite/ld-elfcomm/common1b.c	2003/04/15 09:38:10	1.1
Jan Kratochvil 4140ce
+++ ld/testsuite/ld-elfcomm/common1b.c	2008/09/17 07:43:49	1.2
Jan Kratochvil 4140ce
@@ -1,3 +1,7 @@
Jan Kratochvil 4140ce
-static char dummy1 = 'X';
Jan Kratochvil 4140ce
+static
Jan Kratochvil 4140ce
+#if     __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)
Jan Kratochvil 4140ce
+  __attribute__((__used__))
Jan Kratochvil 4140ce
+#endif  /* __GNUC__ */
Jan Kratochvil 4140ce
+  char dummy1 = 'X';
Jan Kratochvil 4140ce
 char foo1 [] = "Aligned at odd byte.";
Jan Kratochvil 4140ce
 char foo2 [4];
Jan Kratochvil 4140ce
===================================================================
Jan Kratochvil 4140ce
RCS file: /cvs/src/src/ld/testsuite/ld-shared/main.c,v
Jan Kratochvil 4140ce
retrieving revision 1.3
Jan Kratochvil 4140ce
retrieving revision 1.4
Jan Kratochvil 4140ce
diff -u -r1.3 -r1.4
Jan Kratochvil 4140ce
--- ld/testsuite/ld-shared/main.c	2001/06/06 21:03:59	1.3
Jan Kratochvil 4140ce
+++ ld/testsuite/ld-shared/main.c	2008/09/17 07:43:49	1.4
Jan Kratochvil 4140ce
@@ -38,8 +38,6 @@
Jan Kratochvil 4140ce
 int
Jan Kratochvil 4140ce
 main ()
Jan Kratochvil 4140ce
 {
Jan Kratochvil 4140ce
-  int (*p) ();
Jan Kratochvil 4140ce
-
Jan Kratochvil 4140ce
   printf ("mainvar == %d\n", mainvar);
Jan Kratochvil 4140ce
   printf ("overriddenvar == %d\n", overriddenvar);
Jan Kratochvil 4140ce
   printf ("shlibvar1 == %d\n", shlibvar1);
Jan Kratochvil 4140ce
@@ -62,21 +60,29 @@
Jan Kratochvil 4140ce
   printf ("shlib_checkfunptr2 (main_called) == %d\n",
Jan Kratochvil 4140ce
 	  shlib_checkfunptr2 (main_called));
Jan Kratochvil 4140ce
 #endif
Jan Kratochvil 4140ce
-  p = shlib_getfunptr1 ();
Jan Kratochvil 4140ce
-  printf ("shlib_getfunptr1 () ");
Jan Kratochvil 4140ce
-  if (p == shlib_shlibvar1)
Jan Kratochvil 4140ce
-    printf ("==");
Jan Kratochvil 4140ce
-  else
Jan Kratochvil 4140ce
-    printf ("!=");
Jan Kratochvil 4140ce
-  printf (" shlib_shlibvar1\n");
Jan Kratochvil 4140ce
+  {
Jan Kratochvil 4140ce
+    int (*p) ();
Jan Kratochvil 4140ce
+
Jan Kratochvil 4140ce
+    p = shlib_getfunptr1 ();
Jan Kratochvil 4140ce
+    printf ("shlib_getfunptr1 () ");
Jan Kratochvil 4140ce
+    if (p == shlib_shlibvar1)
Jan Kratochvil 4140ce
+      printf ("==");
Jan Kratochvil 4140ce
+    else
Jan Kratochvil 4140ce
+      printf ("!=");
Jan Kratochvil 4140ce
+    printf (" shlib_shlibvar1\n");
Jan Kratochvil 4140ce
+  }
Jan Kratochvil 4140ce
 #ifndef XCOFF_TEST
Jan Kratochvil 4140ce
-  p = shlib_getfunptr2 ();
Jan Kratochvil 4140ce
-  printf ("shlib_getfunptr2 () ");
Jan Kratochvil 4140ce
-  if (p == main_called)
Jan Kratochvil 4140ce
-    printf ("==");
Jan Kratochvil 4140ce
-  else
Jan Kratochvil 4140ce
-    printf ("!=");
Jan Kratochvil 4140ce
-  printf (" main_called\n");
Jan Kratochvil 4140ce
+  {
Jan Kratochvil 4140ce
+    int (*p) ();
Jan Kratochvil 4140ce
+
Jan Kratochvil 4140ce
+    p = shlib_getfunptr2 ();
Jan Kratochvil 4140ce
+    printf ("shlib_getfunptr2 () ");
Jan Kratochvil 4140ce
+    if (p == main_called)
Jan Kratochvil 4140ce
+      printf ("==");
Jan Kratochvil 4140ce
+    else
Jan Kratochvil 4140ce
+      printf ("!=");
Jan Kratochvil 4140ce
+    printf (" main_called\n");
Jan Kratochvil 4140ce
+  }
Jan Kratochvil 4140ce
 #endif
Jan Kratochvil 4140ce
 #endif
Jan Kratochvil 4140ce
   printf ("shlib_check () == %d\n", shlib_check ());
Jan Kratochvil 4140ce
Jan Kratochvil 4140ce
Jan Kratochvil 4140ce
Jan Kratochvil 4140ce
http://sourceware.org/ml/binutils-cvs/2008-09/msg00089.html
Jan Kratochvil 4140ce
http://sourceware.org/ml/binutils/2008-09/msg00124.html
Jan Kratochvil 4140ce
Jan Kratochvil 4140ce
bfd/
Jan Kratochvil 4140ce
2008-09-17  Jan Kratochvil  <jan.kratochvil@redhat.com>
Jan Kratochvil 4140ce
Jan Kratochvil 4140ce
	PR 6893 - Do not consider FDEs for discarded sections as invalid.
Jan Kratochvil 4140ce
	* elf-eh-frame.c (_bfd_elf_parse_eh_frame): New REQUIRE_CLEARED_RELOCS.
Jan Kratochvil 4140ce
	Consider FDEs with cleared relocations as valid and ignorable.
Jan Kratochvil 4140ce
Jan Kratochvil 4140ce
binutils/
Jan Kratochvil 4140ce
2008-09-17  Jan Kratochvil  <jan.kratochvil@redhat.com>
Jan Kratochvil 4140ce
Jan Kratochvil 4140ce
	Suppress warnings on NONE relocations to discarded sections.
Jan Kratochvil 4140ce
	* readelf.c (is_none_reloc): New function.
Jan Kratochvil 4140ce
	(debug_apply_relocations): Ignore is_none_reloc() relocations.
Jan Kratochvil 4140ce
Jan Kratochvil 4140ce
testsuite/
Jan Kratochvil 4140ce
2008-09-17  Jan Kratochvil  <jan.kratochvil@redhat.com>
Jan Kratochvil 4140ce
Jan Kratochvil 4140ce
	* ld-elf/eh-group.exp, ld-elf/eh-group1.s, ld-elf/eh-group2.s: New test.
Jan Kratochvil 4140ce
Jan Kratochvil 4140ce
===================================================================
Jan Kratochvil 4140ce
RCS file: /cvs/src/src/bfd/elf-eh-frame.c,v
Jan Kratochvil 4140ce
retrieving revision 1.72
Jan Kratochvil 4140ce
retrieving revision 1.73
Jan Kratochvil 4140ce
diff -u -r1.72 -r1.73
Jan Kratochvil 4140ce
--- bfd/elf-eh-frame.c	2008/08/24 21:43:00	1.72
Jan Kratochvil 4140ce
+++ bfd/elf-eh-frame.c	2008/09/17 07:50:28	1.73
Jan Kratochvil 4140ce
@@ -549,6 +549,16 @@
Jan Kratochvil 4140ce
 	     < (bfd_size_type) ((buf) - ehbuf)))	\
Jan Kratochvil 4140ce
     cookie->rel++
Jan Kratochvil 4140ce
 
Jan Kratochvil 4140ce
+#define REQUIRE_CLEARED_RELOCS(buf)			\
Jan Kratochvil 4140ce
+  while (cookie->rel < cookie->relend			\
Jan Kratochvil 4140ce
+	 && (cookie->rel->r_offset			\
Jan Kratochvil 4140ce
+	     < (bfd_size_type) ((buf) - ehbuf)))	\
Jan Kratochvil 4140ce
+    {							\
Jan Kratochvil 4140ce
+      REQUIRE (cookie->rel->r_info == 0);		\
Jan Kratochvil 4140ce
+      REQUIRE (cookie->rel->r_addend == 0);		\
Jan Kratochvil 4140ce
+      cookie->rel++;					\
Jan Kratochvil 4140ce
+    }
Jan Kratochvil 4140ce
+
Jan Kratochvil 4140ce
 #define GET_RELOC(buf)					\
Jan Kratochvil 4140ce
   ((cookie->rel < cookie->relend			\
Jan Kratochvil 4140ce
     && (cookie->rel->r_offset				\
Jan Kratochvil 4140ce
@@ -766,9 +776,14 @@
Jan Kratochvil 4140ce
 
Jan Kratochvil 4140ce
 	  /* Chain together the FDEs for each section.  */
Jan Kratochvil 4140ce
 	  rsec = _bfd_elf_gc_mark_rsec (info, sec, gc_mark_hook, cookie);
Jan Kratochvil 4140ce
-	  REQUIRE (rsec && rsec->owner == abfd);
Jan Kratochvil 4140ce
-	  this_inf->u.fde.next_for_section = elf_fde_list (rsec);
Jan Kratochvil 4140ce
-	  elf_fde_list (rsec) = this_inf;
Jan Kratochvil 4140ce
+	  /* RSEC will be NULL if FDE was cleared out as it was belonging to
Jan Kratochvil 4140ce
+	     a discarded SHT_GROUP.  */
Jan Kratochvil 4140ce
+	  if (rsec)
Jan Kratochvil 4140ce
+	    {
Jan Kratochvil 4140ce
+	      REQUIRE (rsec->owner == abfd);
Jan Kratochvil 4140ce
+	      this_inf->u.fde.next_for_section = elf_fde_list (rsec);
Jan Kratochvil 4140ce
+	      elf_fde_list (rsec) = this_inf;
Jan Kratochvil 4140ce
+	    }
Jan Kratochvil 4140ce
 
Jan Kratochvil 4140ce
 	  /* Skip the initial location and address range.  */
Jan Kratochvil 4140ce
 	  start = buf;
Jan Kratochvil 4140ce
@@ -801,7 +816,17 @@
Jan Kratochvil 4140ce
 	  insns = buf;
Jan Kratochvil 4140ce
 
Jan Kratochvil 4140ce
 	  buf = last_fde + 4 + hdr_length;
Jan Kratochvil 4140ce
-	  SKIP_RELOCS (buf);
Jan Kratochvil 4140ce
+
Jan Kratochvil 4140ce
+	  /* Cleared FDE?  The instructions will not be cleared but verify all
Jan Kratochvil 4140ce
+	     the relocation entries for them are cleared.  */
Jan Kratochvil 4140ce
+	  if (rsec == NULL)
Jan Kratochvil 4140ce
+	    {
Jan Kratochvil 4140ce
+	      REQUIRE_CLEARED_RELOCS (buf);
Jan Kratochvil 4140ce
+	    }
Jan Kratochvil 4140ce
+	  else
Jan Kratochvil 4140ce
+	    {
Jan Kratochvil 4140ce
+	      SKIP_RELOCS (buf);
Jan Kratochvil 4140ce
+	    }
Jan Kratochvil 4140ce
 	}
Jan Kratochvil 4140ce
 
Jan Kratochvil 4140ce
       /* Try to interpret the CFA instructions and find the first
Jan Kratochvil 4140ce
===================================================================
Jan Kratochvil 4140ce
RCS file: /cvs/src/src/binutils/readelf.c,v
Jan Kratochvil 4140ce
retrieving revision 1.425
Jan Kratochvil 4140ce
retrieving revision 1.426
Jan Kratochvil 4140ce
diff -u -r1.425 -r1.426
Jan Kratochvil 4140ce
--- binutils/readelf.c	2008/09/05 14:49:05	1.425
Jan Kratochvil 4140ce
+++ binutils/readelf.c	2008/09/17 07:50:28	1.426
Jan Kratochvil 4140ce
@@ -8284,6 +8284,53 @@
Jan Kratochvil 4140ce
     }
Jan Kratochvil 4140ce
 }
Jan Kratochvil 4140ce
 
Jan Kratochvil 4140ce
+/* Returns TRUE iff RELOC_TYPE is a NONE relocation used for discarded
Jan Kratochvil 4140ce
+   relocation entries (possibly formerly used for SHT_GROUP sections).  */
Jan Kratochvil 4140ce
+
Jan Kratochvil 4140ce
+static bfd_boolean
Jan Kratochvil 4140ce
+is_none_reloc (unsigned int reloc_type)
Jan Kratochvil 4140ce
+{
Jan Kratochvil 4140ce
+  switch (elf_header.e_machine)
Jan Kratochvil 4140ce
+    {
Jan Kratochvil 4140ce
+    case EM_68K:
Jan Kratochvil 4140ce
+      return reloc_type == 0; /* R_68K_NONE.  */
Jan Kratochvil 4140ce
+    case EM_386:
Jan Kratochvil 4140ce
+      return reloc_type == 0; /* R_386_NONE.  */
Jan Kratochvil 4140ce
+    case EM_SPARC32PLUS:
Jan Kratochvil 4140ce
+    case EM_SPARCV9:
Jan Kratochvil 4140ce
+    case EM_SPARC:
Jan Kratochvil 4140ce
+      return reloc_type == 0; /* R_SPARC_NONE.  */
Jan Kratochvil 4140ce
+    case EM_MIPS:
Jan Kratochvil 4140ce
+      return reloc_type == 0; /* R_MIPS_NONE.  */
Jan Kratochvil 4140ce
+    case EM_PARISC:
Jan Kratochvil 4140ce
+      return reloc_type == 0; /* R_PARISC_NONE.  */
Jan Kratochvil 4140ce
+    case EM_ALPHA:
Jan Kratochvil 4140ce
+      return reloc_type == 0; /* R_ALPHA_NONE.  */
Jan Kratochvil 4140ce
+    case EM_PPC:
Jan Kratochvil 4140ce
+      return reloc_type == 0; /* R_PPC_NONE.  */
Jan Kratochvil 4140ce
+    case EM_PPC64:
Jan Kratochvil 4140ce
+      return reloc_type == 0; /* R_PPC64_NONE.  */
Jan Kratochvil 4140ce
+    case EM_ARM:
Jan Kratochvil 4140ce
+      return reloc_type == 0; /* R_ARM_NONE.  */
Jan Kratochvil 4140ce
+    case EM_IA_64:
Jan Kratochvil 4140ce
+      return reloc_type == 0; /* R_IA64_NONE.  */
Jan Kratochvil 4140ce
+    case EM_SH:
Jan Kratochvil 4140ce
+      return reloc_type == 0; /* R_SH_NONE.  */
Jan Kratochvil 4140ce
+    case EM_S390_OLD:
Jan Kratochvil 4140ce
+    case EM_S390:
Jan Kratochvil 4140ce
+      return reloc_type == 0; /* R_390_NONE.  */
Jan Kratochvil 4140ce
+    case EM_CRIS:
Jan Kratochvil 4140ce
+      return reloc_type == 0; /* R_CRIS_NONE.  */
Jan Kratochvil 4140ce
+    case EM_X86_64:
Jan Kratochvil 4140ce
+      return reloc_type == 0; /* R_X86_64_NONE.  */
Jan Kratochvil 4140ce
+    case EM_MN10300:
Jan Kratochvil 4140ce
+      return reloc_type == 0; /* R_MN10300_NONE.  */
Jan Kratochvil 4140ce
+    case EM_M32R:
Jan Kratochvil 4140ce
+      return reloc_type == 0; /* R_M32R_NONE.  */
Jan Kratochvil 4140ce
+    }
Jan Kratochvil 4140ce
+  return FALSE;
Jan Kratochvil 4140ce
+}
Jan Kratochvil 4140ce
+
Jan Kratochvil 4140ce
 /* Uncompresses a section that was compressed using zlib, in place.
Jan Kratochvil 4140ce
  * This is a copy of bfd_uncompress_section_contents, in bfd/compress.c  */
Jan Kratochvil 4140ce
 
Jan Kratochvil 4140ce
@@ -8419,6 +8466,9 @@
Jan Kratochvil 4140ce
 
Jan Kratochvil 4140ce
 	  reloc_type = get_reloc_type (rp->r_info);
Jan Kratochvil 4140ce
 
Jan Kratochvil 4140ce
+	  if (is_none_reloc (reloc_type))
Jan Kratochvil 4140ce
+	    continue;
Jan Kratochvil 4140ce
+
Jan Kratochvil 4140ce
 	  if (is_32bit_abs_reloc (reloc_type)
Jan Kratochvil 4140ce
 	      || is_32bit_pcrel_reloc (reloc_type))
Jan Kratochvil 4140ce
 	    reloc_size = 4;
Jan Kratochvil 4140ce
/cvs/src/src/ld/testsuite/ld-elf/eh-group.exp,v  -->  standard output
Jan Kratochvil 4140ce
revision 1.1
Jan Kratochvil 4140ce
--- ld/testsuite/ld-elf/eh-group.exp
Jan Kratochvil 4140ce
+++ ld/testsuite/ld-elf/eh-group.exp	2008-09-21 22:56:18.321559000 +0000
Jan Kratochvil 4140ce
@@ -0,0 +1,51 @@
Jan Kratochvil 4140ce
+# Expect script for .eh_frame entries to a removed section.
Jan Kratochvil 4140ce
+#   Copyright 2008  Free Software Foundation, Inc.
Jan Kratochvil 4140ce
+#
Jan Kratochvil 4140ce
+# This file is part of the GNU Binutils.
Jan Kratochvil 4140ce
+#
Jan Kratochvil 4140ce
+# This program is free software; you can redistribute it and/or modify
Jan Kratochvil 4140ce
+# it under the terms of the GNU General Public License as published by
Jan Kratochvil 4140ce
+# the Free Software Foundation; either version 3 of the License, or
Jan Kratochvil 4140ce
+# (at your option) any later version.
Jan Kratochvil 4140ce
+#
Jan Kratochvil 4140ce
+# This program is distributed in the hope that it will be useful,
Jan Kratochvil 4140ce
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
Jan Kratochvil 4140ce
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Jan Kratochvil 4140ce
+# GNU General Public License for more details.
Jan Kratochvil 4140ce
+#
Jan Kratochvil 4140ce
+# You should have received a copy of the GNU General Public License
Jan Kratochvil 4140ce
+# along with this program; if not, write to the Free Software
Jan Kratochvil 4140ce
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
Jan Kratochvil 4140ce
+# MA 02110-1301, USA.
Jan Kratochvil 4140ce
+#
Jan Kratochvil 4140ce
+
Jan Kratochvil 4140ce
+#
Jan Kratochvil 4140ce
+# Written by Jan Kratochvil (jan.kratochvil@redhat.com)
Jan Kratochvil 4140ce
+#
Jan Kratochvil 4140ce
+# .eh_frame with relocations to a removed (group) section did result to:
Jan Kratochvil 4140ce
+# error in tmpdir/eh-group.o(.eh_frame); no .eh_frame_hdr table will be created.
Jan Kratochvil 4140ce
+# The purpose of this test is to merge two .o files with -r and then link this
Jan Kratochvil 4140ce
+# merged file (containing a discarded R_X86_64_NONE relocation) to the final
Jan Kratochvil 4140ce
+# executable trying to create .eh_frame_hdr.  It needs a separate .exp file due
Jan Kratochvil 4140ce
+# to the requirement of two `ld' runs.
Jan Kratochvil 4140ce
+
Jan Kratochvil 4140ce
+# Exclude non-ELF targets.
Jan Kratochvil 4140ce
+
Jan Kratochvil 4140ce
+if ![is_elf_format] {
Jan Kratochvil 4140ce
+    return
Jan Kratochvil 4140ce
+}
Jan Kratochvil 4140ce
+
Jan Kratochvil 4140ce
+set build_tests_ld {
Jan Kratochvil 4140ce
+  {"Build eh-group1.o"
Jan Kratochvil 4140ce
+   "-r" ""
Jan Kratochvil 4140ce
+   {eh-group1.s eh-group2.s} {} "eh-group.o"}
Jan Kratochvil 4140ce
+}
Jan Kratochvil 4140ce
+
Jan Kratochvil 4140ce
+run_ld_link_tests $build_tests_ld
Jan Kratochvil 4140ce
+
Jan Kratochvil 4140ce
+set testname "Link eh-group.o to eh-group"
Jan Kratochvil 4140ce
+if [ld_simple_link $ld "tmpdir/eh-group" "-e _start tmpdir/eh-group.o"] {
Jan Kratochvil 4140ce
+    pass $testname
Jan Kratochvil 4140ce
+} else {
Jan Kratochvil 4140ce
+    fail $testname
Jan Kratochvil 4140ce
+}
Jan Kratochvil 4140ce
/cvs/src/src/ld/testsuite/ld-elf/eh-group1.s,v  -->  standard output
Jan Kratochvil 4140ce
revision 1.1
Jan Kratochvil 4140ce
--- ld/testsuite/ld-elf/eh-group1.s
Jan Kratochvil 4140ce
+++ ld/testsuite/ld-elf/eh-group1.s	2008-09-21 22:56:19.003793000 +0000
Jan Kratochvil 4140ce
@@ -0,0 +1,6 @@
Jan Kratochvil 4140ce
+	.section	sect, "axG", @progbits, sectgroup, comdat
Jan Kratochvil 4140ce
+	.global	_start
Jan Kratochvil 4140ce
+_start:
Jan Kratochvil 4140ce
+	.cfi_startproc
Jan Kratochvil 4140ce
+	.skip 16
Jan Kratochvil 4140ce
+	.cfi_endproc
Jan Kratochvil 4140ce
/cvs/src/src/ld/testsuite/ld-elf/eh-group2.s,v  -->  standard output
Jan Kratochvil 4140ce
revision 1.1
Jan Kratochvil 4140ce
--- ld/testsuite/ld-elf/eh-group2.s
Jan Kratochvil 4140ce
+++ ld/testsuite/ld-elf/eh-group2.s	2008-09-21 22:56:19.663297000 +0000
Jan Kratochvil 4140ce
@@ -0,0 +1,4 @@
Jan Kratochvil 4140ce
+	.section	sect, "axG", @progbits, sectgroup, comdat
Jan Kratochvil 4140ce
+	.cfi_startproc
Jan Kratochvil 4140ce
+	.skip 16
Jan Kratochvil 4140ce
+	.cfi_endproc
Jan Kratochvil 4140ce
Jan Kratochvil 4140ce
http://sourceware.org/ml/binutils-cvs/2008-09/msg00107.html
Jan Kratochvil 4140ce
http://sourceware.org/ml/binutils/2008-09/msg00145.html
Jan Kratochvil 4140ce
Jan Kratochvil 4140ce
testsuite/
Jan Kratochvil 4140ce
2008-09-20  Jan Kratochvil  <jan.kratochvil@redhat.com>
Jan Kratochvil 4140ce
Jan Kratochvil 4140ce
	Provide virtual target "cfi" for targets supporting CFI.
Jan Kratochvil 4140ce
	* ld-elf/eh-frame-hdr.d: Replace target and xfail statements by single
Jan Kratochvil 4140ce
	`target: cfi'.
Jan Kratochvil 4140ce
	* ld-elf/eh-group.exp: Call check_as_cfi instead of is_elf_format.
Jan Kratochvil 4140ce
	* ld-elf/eh-group1.s, elf/eh-group2.s: Use more compatible section
Jan Kratochvil 4140ce
	flags prefix '%'.
Jan Kratochvil 4140ce
	* ld-elf/eh5.d: Replace target statement by `target: cfi' with an Alpha
Jan Kratochvil 4140ce
	exception.  Relax the `Code alignment factor' matching.
Jan Kratochvil 4140ce
	* lib/ld-lib.exp: Rename istarget as istarget_ld.
Jan Kratochvil 4140ce
	(istarget, check_as_cfi): New procedure.
Jan Kratochvil 4140ce
	(run_dump_test): New comment for the virtual target `cfi'.
Jan Kratochvil 4140ce
Jan Kratochvil 4140ce
===================================================================
Jan Kratochvil 4140ce
RCS file: /cvs/src/src/ld/testsuite/ld-elf/eh-frame-hdr.d,v
Jan Kratochvil 4140ce
retrieving revision 1.1
Jan Kratochvil 4140ce
retrieving revision 1.2
Jan Kratochvil 4140ce
diff -u -r1.1 -r1.2
Jan Kratochvil 4140ce
--- ld/testsuite/ld-elf/eh-frame-hdr.d	2006/12/04 08:57:09	1.1
Jan Kratochvil 4140ce
+++ ld/testsuite/ld-elf/eh-frame-hdr.d	2008/09/20 08:42:53	1.2
Jan Kratochvil 4140ce
@@ -1,17 +1,7 @@
Jan Kratochvil 4140ce
 #source: eh-frame-hdr.s
Jan Kratochvil 4140ce
 #ld: -e _start --eh-frame-hdr
Jan Kratochvil 4140ce
 #objdump: -hw
Jan Kratochvil 4140ce
-#target: alpha*-*-*
Jan Kratochvil 4140ce
-#target: arm*-*-*
Jan Kratochvil 4140ce
-#target: i?86-*-*
Jan Kratochvil 4140ce
-#target: m68k-*-*
Jan Kratochvil 4140ce
-#target: mips*-*-*
Jan Kratochvil 4140ce
-#target: powerpc*-*-*
Jan Kratochvil 4140ce
-#target: s390*-*-*
Jan Kratochvil 4140ce
-#target: sh*-*-*
Jan Kratochvil 4140ce
-#xfail: sh*l*-*-*
Jan Kratochvil 4140ce
-#target: sparc*-*-*
Jan Kratochvil 4140ce
-#target: x86_64-*-*
Jan Kratochvil 4140ce
+#target: cfi
Jan Kratochvil 4140ce
 #...
Jan Kratochvil 4140ce
   [0-9] .eh_frame_hdr 0*[12][048c] .*
Jan Kratochvil 4140ce
 #pass
Jan Kratochvil 4140ce
===================================================================
Jan Kratochvil 4140ce
RCS file: /cvs/src/src/ld/testsuite/ld-elf/eh-group.exp,v
Jan Kratochvil 4140ce
retrieving revision 1.1
Jan Kratochvil 4140ce
retrieving revision 1.2
Jan Kratochvil 4140ce
diff -u -r1.1 -r1.2
Jan Kratochvil 4140ce
--- ld/testsuite/ld-elf/eh-group.exp	2008/09/17 07:50:29	1.1
Jan Kratochvil 4140ce
+++ ld/testsuite/ld-elf/eh-group.exp	2008/09/20 08:42:53	1.2
Jan Kratochvil 4140ce
@@ -29,9 +29,9 @@
Jan Kratochvil 4140ce
 # executable trying to create .eh_frame_hdr.  It needs a separate .exp file due
Jan Kratochvil 4140ce
 # to the requirement of two `ld' runs.
Jan Kratochvil 4140ce
 
Jan Kratochvil 4140ce
-# Exclude non-ELF targets.
Jan Kratochvil 4140ce
+# Exclude non-CFI (such as ia64) targets.
Jan Kratochvil 4140ce
 
Jan Kratochvil 4140ce
-if ![is_elf_format] {
Jan Kratochvil 4140ce
+if {![check_as_cfi]} {
Jan Kratochvil 4140ce
     return
Jan Kratochvil 4140ce
 }
Jan Kratochvil 4140ce
 
Jan Kratochvil 4140ce
===================================================================
Jan Kratochvil 4140ce
RCS file: /cvs/src/src/ld/testsuite/ld-elf/eh-group1.s,v
Jan Kratochvil 4140ce
retrieving revision 1.1
Jan Kratochvil 4140ce
retrieving revision 1.2
Jan Kratochvil 4140ce
diff -u -r1.1 -r1.2
Jan Kratochvil 4140ce
--- ld/testsuite/ld-elf/eh-group1.s	2008/09/17 07:50:29	1.1
Jan Kratochvil 4140ce
+++ ld/testsuite/ld-elf/eh-group1.s	2008/09/20 08:42:53	1.2
Jan Kratochvil 4140ce
@@ -1,4 +1,4 @@
Jan Kratochvil 4140ce
-	.section	sect, "axG", @progbits, sectgroup, comdat
Jan Kratochvil 4140ce
+	.section	sect, "axG", %progbits, sectgroup, comdat
Jan Kratochvil 4140ce
 	.global	_start
Jan Kratochvil 4140ce
 _start:
Jan Kratochvil 4140ce
 	.cfi_startproc
Jan Kratochvil 4140ce
===================================================================
Jan Kratochvil 4140ce
RCS file: /cvs/src/src/ld/testsuite/ld-elf/eh-group2.s,v
Jan Kratochvil 4140ce
retrieving revision 1.1
Jan Kratochvil 4140ce
retrieving revision 1.2
Jan Kratochvil 4140ce
diff -u -r1.1 -r1.2
Jan Kratochvil 4140ce
--- ld/testsuite/ld-elf/eh-group2.s	2008/09/17 07:50:29	1.1
Jan Kratochvil 4140ce
+++ ld/testsuite/ld-elf/eh-group2.s	2008/09/20 08:42:53	1.2
Jan Kratochvil 4140ce
@@ -1,4 +1,4 @@
Jan Kratochvil 4140ce
-	.section	sect, "axG", @progbits, sectgroup, comdat
Jan Kratochvil 4140ce
+	.section	sect, "axG", %progbits, sectgroup, comdat
Jan Kratochvil 4140ce
 	.cfi_startproc
Jan Kratochvil 4140ce
 	.skip 16
Jan Kratochvil 4140ce
 	.cfi_endproc
Jan Kratochvil 4140ce
===================================================================
Jan Kratochvil 4140ce
RCS file: /cvs/src/src/ld/testsuite/ld-elf/eh5.d,v
Jan Kratochvil 4140ce
retrieving revision 1.2
Jan Kratochvil 4140ce
retrieving revision 1.3
Jan Kratochvil 4140ce
diff -u -r1.2 -r1.3
Jan Kratochvil 4140ce
--- ld/testsuite/ld-elf/eh5.d	2008/01/28 15:15:32	1.2
Jan Kratochvil 4140ce
+++ ld/testsuite/ld-elf/eh5.d	2008/09/20 08:42:53	1.3
Jan Kratochvil 4140ce
@@ -3,14 +3,15 @@
Jan Kratochvil 4140ce
 #source: eh5b.s
Jan Kratochvil 4140ce
 #ld:
Jan Kratochvil 4140ce
 #readelf: -wf
Jan Kratochvil 4140ce
-#target: x86_64-*-* i?86-*-*
Jan Kratochvil 4140ce
+#target: cfi
Jan Kratochvil 4140ce
+#notarget: alpha*
Jan Kratochvil 4140ce
 
Jan Kratochvil 4140ce
 The section .eh_frame contains:
Jan Kratochvil 4140ce
 
Jan Kratochvil 4140ce
 00000000 0000001[04] 00000000 CIE
Jan Kratochvil 4140ce
   Version:               1
Jan Kratochvil 4140ce
   Augmentation:          "zR"
Jan Kratochvil 4140ce
-  Code alignment factor: 1
Jan Kratochvil 4140ce
+  Code alignment factor: .*
Jan Kratochvil 4140ce
   Data alignment factor: .*
Jan Kratochvil 4140ce
   Return address column: .*
Jan Kratochvil 4140ce
   Augmentation data:     1b
Jan Kratochvil 4140ce
@@ -29,7 +30,7 @@
Jan Kratochvil 4140ce
 000000(2c|30) 00000014 00000000 CIE
Jan Kratochvil 4140ce
   Version:               1
Jan Kratochvil 4140ce
   Augmentation:          "zPR"
Jan Kratochvil 4140ce
-  Code alignment factor: 1
Jan Kratochvil 4140ce
+  Code alignment factor: .*
Jan Kratochvil 4140ce
   Data alignment factor: .*
Jan Kratochvil 4140ce
   Return address column: .*
Jan Kratochvil 4140ce
   Augmentation data:     03 .. .. .. .. 1b
Jan Kratochvil 4140ce
@@ -53,7 +54,7 @@
Jan Kratochvil 4140ce
 0000007[48] 0000001[8c] 00000000 CIE
Jan Kratochvil 4140ce
   Version:               1
Jan Kratochvil 4140ce
   Augmentation:          "zPLR"
Jan Kratochvil 4140ce
-  Code alignment factor: 1
Jan Kratochvil 4140ce
+  Code alignment factor: .*
Jan Kratochvil 4140ce
   Data alignment factor: .*
Jan Kratochvil 4140ce
   Return address column: .*
Jan Kratochvil 4140ce
   Augmentation data:     03 .. .. .. .. 0c 1b
Jan Kratochvil 4140ce
@@ -74,7 +75,7 @@
Jan Kratochvil 4140ce
 000000b[08] 0000001[04] 00000000 CIE
Jan Kratochvil 4140ce
   Version:               1
Jan Kratochvil 4140ce
   Augmentation:          "zR"
Jan Kratochvil 4140ce
-  Code alignment factor: 1
Jan Kratochvil 4140ce
+  Code alignment factor: .*
Jan Kratochvil 4140ce
   Data alignment factor: .*
Jan Kratochvil 4140ce
   Return address column: .*
Jan Kratochvil 4140ce
   Augmentation data:     1b
Jan Kratochvil 4140ce
@@ -89,7 +90,7 @@
Jan Kratochvil 4140ce
 000000[de]8 00000014 00000000 CIE
Jan Kratochvil 4140ce
   Version:               1
Jan Kratochvil 4140ce
   Augmentation:          "zPR"
Jan Kratochvil 4140ce
-  Code alignment factor: 1
Jan Kratochvil 4140ce
+  Code alignment factor: .*
Jan Kratochvil 4140ce
   Data alignment factor: .*
Jan Kratochvil 4140ce
   Return address column: .*
Jan Kratochvil 4140ce
   Augmentation data:     03 .. .. .. .. 1b
Jan Kratochvil 4140ce
@@ -111,7 +112,7 @@
Jan Kratochvil 4140ce
 000001(1c|30) 0000001[8c] 00000000 CIE
Jan Kratochvil 4140ce
   Version:               1
Jan Kratochvil 4140ce
   Augmentation:          "zPLR"
Jan Kratochvil 4140ce
-  Code alignment factor: 1
Jan Kratochvil 4140ce
+  Code alignment factor: .*
Jan Kratochvil 4140ce
   Data alignment factor: .*
Jan Kratochvil 4140ce
   Return address column: .*
Jan Kratochvil 4140ce
   Augmentation data:     03 .. .. .. .. 0c 1b
Jan Kratochvil 4140ce
===================================================================
Jan Kratochvil 4140ce
RCS file: /cvs/src/src/ld/testsuite/lib/ld-lib.exp,v
Jan Kratochvil 4140ce
retrieving revision 1.54
Jan Kratochvil 4140ce
retrieving revision 1.55
Jan Kratochvil 4140ce
diff -u -r1.54 -r1.55
Jan Kratochvil 4140ce
--- ld/testsuite/lib/ld-lib.exp	2008/02/18 11:04:09	1.54
Jan Kratochvil 4140ce
+++ ld/testsuite/lib/ld-lib.exp	2008/09/20 08:42:53	1.55
Jan Kratochvil 4140ce
@@ -598,7 +598,8 @@
Jan Kratochvil 4140ce
 #
Jan Kratochvil 4140ce
 #   target: TARGET
Jan Kratochvil 4140ce
 #       Only run the test for TARGET.  This may occur more than once; the
Jan Kratochvil 4140ce
-#       target being tested must match at least one.
Jan Kratochvil 4140ce
+#       target being tested must match at least one.  You may provide target
Jan Kratochvil 4140ce
+#       name "cfi" for any target supporting the CFI statements.
Jan Kratochvil 4140ce
 #
Jan Kratochvil 4140ce
 #   notarget: TARGET
Jan Kratochvil 4140ce
 #       Do not run the test for TARGET.  This may occur more than once;
Jan Kratochvil 4140ce
@@ -1569,3 +1570,39 @@
Jan Kratochvil 4140ce
     }
Jan Kratochvil 4140ce
     return $gc_sections_available_saved
Jan Kratochvil 4140ce
 }
Jan Kratochvil 4140ce
+
Jan Kratochvil 4140ce
+# Check if the assembler supports CFI statements.
Jan Kratochvil 4140ce
+
Jan Kratochvil 4140ce
+proc check_as_cfi { } {
Jan Kratochvil 4140ce
+    global check_as_cfi_result
Jan Kratochvil 4140ce
+    global as
Jan Kratochvil 4140ce
+    if [info exists check_as_cfi_result] {
Jan Kratochvil 4140ce
+	return $check_as_cfi_result
Jan Kratochvil 4140ce
+    }
Jan Kratochvil 4140ce
+    set as_file "tmpdir/check_as_cfi.s"
Jan Kratochvil 4140ce
+    set as_fh [open $as_file w 0666]
Jan Kratochvil 4140ce
+    puts $as_fh "# Generated file. DO NOT EDIT"
Jan Kratochvil 4140ce
+    puts $as_fh "\t.cfi_startproc"
Jan Kratochvil 4140ce
+    puts $as_fh "\t.cfi_endproc"
Jan Kratochvil 4140ce
+    close $as_fh
Jan Kratochvil 4140ce
+    remote_download host $as_file
Jan Kratochvil 4140ce
+    verbose -log "Checking CFI support:"
Jan Kratochvil 4140ce
+    rename "perror" "check_as_cfi_perror"
Jan Kratochvil 4140ce
+    proc perror { args } { }
Jan Kratochvil 4140ce
+    set success [ld_assemble $as $as_file "/dev/null"]
Jan Kratochvil 4140ce
+    rename "perror" ""
Jan Kratochvil 4140ce
+    rename "check_as_cfi_perror" "perror"
Jan Kratochvil 4140ce
+    #remote_file host delete $as_file
Jan Kratochvil 4140ce
+    set check_as_cfi_result $success
Jan Kratochvil 4140ce
+    return $success
Jan Kratochvil 4140ce
+}
Jan Kratochvil 4140ce
+
Jan Kratochvil 4140ce
+# Provide virtual target "cfi" for targets supporting CFI.
Jan Kratochvil 4140ce
+
Jan Kratochvil 4140ce
+rename "istarget" "istarget_ld"
Jan Kratochvil 4140ce
+proc istarget { target } {
Jan Kratochvil 4140ce
+    if {$target == "cfi"} {
Jan Kratochvil 4140ce
+	return [check_as_cfi]
Jan Kratochvil 4140ce
+    }
Jan Kratochvil 4140ce
+    return [istarget_ld $target]
Jan Kratochvil 4140ce
+}