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