* [patch] Fix C++ no .eh_frame_hdr table will be created (PR 6893)
@ 2008-09-16 14:09 Jan Kratochvil
2008-09-17 2:37 ` Alan Modra
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Jan Kratochvil @ 2008-09-16 14:09 UTC (permalink / raw)
To: binutils
[-- Attachment #1: Type: text/plain, Size: 2242 bytes --]
Hi,
original bugreport by Andrew Haley:
1. svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm
2. cd llvm
3. ./configure \
--disable-static \
--enable-assertions \
--enable-debug-runtime \
--enable-jit \
--enable-optimized \
--enable-shared \
--enable-targets=host-only \
--with-pic \
--enable-pic \
--disable-binding
4. make VERBOSE=true
Actual results:/usr/bin/ld: error in
/home/aph/llvm/Release/lib/LLVMInterpreter.o(.eh_frame); no .eh_frame_hdr table will be created.
/usr/bin/ld: error in /home/aph/llvm/Release/lib/LLVMX86.o(.eh_frame); no .eh_frame_hdr table will be created.
/usr/bin/ld: error in /home/aph/llvm/Release/lib/LLVMExecutionEngine.o(.eh_frame); no .eh_frame_hdr table will be created.
/usr/bin/ld: error in /home/aph/llvm/Release/lib/LLVMJIT.o(.eh_frame); no .eh_frame_hdr table will be created.
------------------------------------------------------------------------------
These relocations
Relocation section '.rela.eh_frame' at offset 0x14b0 contains 2 entries:
Offset Info Type Sym. Value Sym. Name +
Addend
000000000020 000600000002 R_X86_64_PC32 0000000000000000 .text._ZNK4llvm13Targe + 0
with its target section .text._ZNK4llvm13 which is SHT_GROUP
[ 9] .text._ZNK4llvm13 PROGBITS 0000000000000000 000004c0
000000000000004f 0000000000000000 AXG 0 0 16
get converted to:
000000000020 000000000000 R_X86_64_NONE 0000000000000000
by this code:
../bfd/elf64-x86-64.c
if (sec != NULL && elf_discarded_section (sec))
{
/* For relocs against symbols from removed linkonce sections,
or sections discarded by a linker script, we just want the
section contents zeroed. Avoid any special processing. */
_bfd_clear_contents (howto, input_bfd, contents + rel->r_offset);
rel->r_info = 0;
rel->r_addend = 0;
continue;
}
ld will later error out on R_X86_64_NONE
The attached fix will properly discard those FDEs with discarded relocations
which can be verified in the testcase.
original bugreports:
https://bugzilla.redhat.com/show_bug.cgi?id=458950
https://bugzilla.redhat.com/show_bug.cgi?id=461675
Thanks,
Jan
[-- Attachment #2: llvm-binutils4.patch --]
[-- Type: text/plain, Size: 6882 bytes --]
bfd/
2008-09-16 Jan Kratochvil <jan.kratochvil@redhat.com>
PR 6893 - Do not consider FDEs for discarded sections as invalid.
* elf-eh-frame.c (_bfd_elf_parse_eh_frame): New REQUIRE_CLEARED_RELOCS.
Consider FDEs with cleared relocations as valid and ignorable.
ld/testsuite/
2008-09-16 Jan Kratochvil <jan.kratochvil@redhat.com>
* ld-elf/eh-group.exp, ld-elf/eh-group1.s, ld-elf/eh-group2.s: New test.
binutils/
2008-09-16 Jan Kratochvil <jan.kratochvil@redhat.com>
Suppress warnings on NONE relocations to discarded sections.
* readelf.c (is_none_reloc): New function.
(debug_apply_relocations): Ignore is_none_reloc() relocations.
--- bfd/elf-eh-frame.c 24 Aug 2008 21:43:00 -0000 1.72
+++ bfd/elf-eh-frame.c 16 Sep 2008 13:28:43 -0000
@@ -549,6 +549,16 @@ _bfd_elf_parse_eh_frame (bfd *abfd, stru
< (bfd_size_type) ((buf) - ehbuf))) \
cookie->rel++
+#define REQUIRE_CLEARED_RELOCS(buf) \
+ while (cookie->rel < cookie->relend \
+ && (cookie->rel->r_offset \
+ < (bfd_size_type) ((buf) - ehbuf))) \
+ { \
+ REQUIRE (cookie->rel->r_info == 0); \
+ REQUIRE (cookie->rel->r_addend == 0); \
+ cookie->rel++; \
+ }
+
#define GET_RELOC(buf) \
((cookie->rel < cookie->relend \
&& (cookie->rel->r_offset \
@@ -766,9 +776,14 @@ _bfd_elf_parse_eh_frame (bfd *abfd, stru
/* Chain together the FDEs for each section. */
rsec = _bfd_elf_gc_mark_rsec (info, sec, gc_mark_hook, cookie);
- REQUIRE (rsec && rsec->owner == abfd);
- this_inf->u.fde.next_for_section = elf_fde_list (rsec);
- elf_fde_list (rsec) = this_inf;
+ /* RSEC will be NULL if FDE was cleared out as it was belonging to
+ a discarded SHT_GROUP. */
+ if (rsec)
+ {
+ REQUIRE (rsec->owner == abfd);
+ this_inf->u.fde.next_for_section = elf_fde_list (rsec);
+ elf_fde_list (rsec) = this_inf;
+ }
/* Skip the initial location and address range. */
start = buf;
@@ -801,7 +816,17 @@ _bfd_elf_parse_eh_frame (bfd *abfd, stru
insns = buf;
buf = last_fde + 4 + hdr_length;
- SKIP_RELOCS (buf);
+
+ /* Cleared FDE? The instructions will not be cleared but verify all
+ the relocation entries for them are cleared. */
+ if (rsec == NULL)
+ {
+ REQUIRE_CLEARED_RELOCS (buf);
+ }
+ else
+ {
+ SKIP_RELOCS (buf);
+ }
}
/* Try to interpret the CFA instructions and find the first
--- binutils/readelf.c 5 Sep 2008 14:49:05 -0000 1.425
+++ binutils/readelf.c 16 Sep 2008 13:28:50 -0000
@@ -8284,6 +8284,53 @@ is_16bit_abs_reloc (unsigned int reloc_t
}
}
+/* Returns TRUE iff RELOC_TYPE is a NONE relocation used for discarded
+ relocation entries (possibly formerly used for SHT_GROUP sections). */
+
+static bfd_boolean
+is_none_reloc (unsigned int reloc_type)
+{
+ switch (elf_header.e_machine)
+ {
+ case EM_68K:
+ return reloc_type == 0; /* R_68K_NONE. */
+ case EM_386:
+ return reloc_type == 0; /* R_386_NONE. */
+ case EM_SPARC32PLUS:
+ case EM_SPARCV9:
+ case EM_SPARC:
+ return reloc_type == 0; /* R_SPARC_NONE. */
+ case EM_MIPS:
+ return reloc_type == 0; /* R_MIPS_NONE. */
+ case EM_PARISC:
+ return reloc_type == 0; /* R_PARISC_NONE. */
+ case EM_ALPHA:
+ return reloc_type == 0; /* R_ALPHA_NONE. */
+ case EM_PPC:
+ return reloc_type == 0; /* R_PPC_NONE. */
+ case EM_PPC64:
+ return reloc_type == 0; /* R_PPC64_NONE. */
+ case EM_ARM:
+ return reloc_type == 0; /* R_ARM_NONE. */
+ case EM_IA_64:
+ return reloc_type == 0; /* R_IA64_NONE. */
+ case EM_SH:
+ return reloc_type == 0; /* R_SH_NONE. */
+ case EM_S390_OLD:
+ case EM_S390:
+ return reloc_type == 0; /* R_390_NONE. */
+ case EM_CRIS:
+ return reloc_type == 0; /* R_CRIS_NONE. */
+ case EM_X86_64:
+ return reloc_type == 0; /* R_X86_64_NONE. */
+ case EM_MN10300:
+ return reloc_type == 0; /* R_MN10300_NONE. */
+ case EM_M32R:
+ return reloc_type == 0; /* R_M32R_NONE. */
+ }
+ return FALSE;
+}
+
/* Uncompresses a section that was compressed using zlib, in place.
* This is a copy of bfd_uncompress_section_contents, in bfd/compress.c */
@@ -8419,6 +8466,9 @@ debug_apply_relocations (void *file,
reloc_type = get_reloc_type (rp->r_info);
+ if (is_none_reloc (reloc_type))
+ continue;
+
if (is_32bit_abs_reloc (reloc_type)
|| is_32bit_pcrel_reloc (reloc_type))
reloc_size = 4;
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ld/testsuite/ld-elf/eh-group.exp 16 Sep 2008 13:28:54 -0000
@@ -0,0 +1,51 @@
+# Expect script for .eh_frame entries to a removed section.
+# Copyright 2008 Free Software Foundation, Inc.
+#
+# This file is part of the GNU Binutils.
+#
+# 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 3 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., 51 Franklin Street - Fifth Floor, Boston,
+# MA 02110-1301, USA.
+#
+
+#
+# Written by Jan Kratochvil (jan.kratochvil@redhat.com)
+#
+# .eh_frame with relocations to a removed (group) section did result to:
+# error in tmpdir/eh-group.o(.eh_frame); no .eh_frame_hdr table will be created.
+# The purpose of this test is to merge two .o files with -r and then link this
+# merged file (containing a discarded R_X86_64_NONE relocation) to the final
+# executable trying to create .eh_frame_hdr. It needs a separate .exp file due
+# to the requirement of two `ld' runs.
+
+# Exclude non-ELF targets.
+
+if ![is_elf_format] {
+ return
+}
+
+set build_tests_ld {
+ {"Build eh-group1.o"
+ "-r" ""
+ {eh-group1.s eh-group2.s} {} "eh-group.o"}
+}
+
+run_ld_link_tests $build_tests_ld
+
+set testname "Link eh-group.o to eh-group"
+if [ld_simple_link $ld "tmpdir/eh-group" "-e _start tmpdir/eh-group.o"] {
+ pass $testname
+} else {
+ fail $testname
+}
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ld/testsuite/ld-elf/eh-group1.s 16 Sep 2008 13:28:54 -0000
@@ -0,0 +1,6 @@
+ .section sect, "axG", @progbits, sectgroup, comdat
+ .global _start
+_start:
+ .cfi_startproc
+ .skip 16
+ .cfi_endproc
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ld/testsuite/ld-elf/eh-group2.s 16 Sep 2008 13:28:54 -0000
@@ -0,0 +1,4 @@
+ .section sect, "axG", @progbits, sectgroup, comdat
+ .cfi_startproc
+ .skip 16
+ .cfi_endproc
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [patch] Fix C++ no .eh_frame_hdr table will be created (PR 6893)
2008-09-16 14:09 [patch] Fix C++ no .eh_frame_hdr table will be created (PR 6893) Jan Kratochvil
@ 2008-09-17 2:37 ` Alan Modra
2008-09-17 15:41 ` Andreas Schwab
2008-09-17 15:50 ` Andreas Schwab
2 siblings, 0 replies; 9+ messages in thread
From: Alan Modra @ 2008-09-17 2:37 UTC (permalink / raw)
To: Jan Kratochvil; +Cc: binutils
On Tue, Sep 16, 2008 at 04:08:07PM +0200, Jan Kratochvil wrote:
> The attached fix will properly discard those FDEs with discarded relocations
> which can be verified in the testcase.
Please apply. 2.19 branch too.
--
Alan Modra
Australia Development Lab, IBM
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [patch] Fix C++ no .eh_frame_hdr table will be created (PR 6893)
2008-09-16 14:09 [patch] Fix C++ no .eh_frame_hdr table will be created (PR 6893) Jan Kratochvil
2008-09-17 2:37 ` Alan Modra
@ 2008-09-17 15:41 ` Andreas Schwab
2008-09-17 17:47 ` Jan Kratochvil
2008-09-17 15:50 ` Andreas Schwab
2 siblings, 1 reply; 9+ messages in thread
From: Andreas Schwab @ 2008-09-17 15:41 UTC (permalink / raw)
To: Jan Kratochvil; +Cc: binutils
Jan Kratochvil <jan.kratochvil@redhat.com> writes:
> +# Exclude non-ELF targets.
> +
> +if ![is_elf_format] {
> + return
> +}
> +
> +set build_tests_ld {
> + {"Build eh-group1.o"
> + "-r" ""
> + {eh-group1.s eh-group2.s} {} "eh-group.o"}
> +}
> +
> +run_ld_link_tests $build_tests_ld
> +
> +set testname "Link eh-group.o to eh-group"
> +if [ld_simple_link $ld "tmpdir/eh-group" "-e _start tmpdir/eh-group.o"] {
> + pass $testname
> +} else {
> + fail $testname
> +}
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ ld/testsuite/ld-elf/eh-group1.s 16 Sep 2008 13:28:54 -0000
> @@ -0,0 +1,6 @@
> + .section sect, "axG", @progbits, sectgroup, comdat
> + .global _start
> +_start:
> + .cfi_startproc
> + .skip 16
> + .cfi_endproc
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ ld/testsuite/ld-elf/eh-group2.s 16 Sep 2008 13:28:54 -0000
> @@ -0,0 +1,4 @@
> + .section sect, "axG", @progbits, sectgroup, comdat
> + .cfi_startproc
> + .skip 16
> + .cfi_endproc
This fails on ia64, because .cfi_* does not exist.
Andreas.
--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, MaxfeldstraÃe 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [patch] Fix C++ no .eh_frame_hdr table will be created (PR 6893)
2008-09-16 14:09 [patch] Fix C++ no .eh_frame_hdr table will be created (PR 6893) Jan Kratochvil
2008-09-17 2:37 ` Alan Modra
2008-09-17 15:41 ` Andreas Schwab
@ 2008-09-17 15:50 ` Andreas Schwab
2 siblings, 0 replies; 9+ messages in thread
From: Andreas Schwab @ 2008-09-17 15:50 UTC (permalink / raw)
To: Jan Kratochvil; +Cc: binutils
Jan Kratochvil <jan.kratochvil@redhat.com> writes:
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ ld/testsuite/ld-elf/eh-group1.s 16 Sep 2008 13:28:54 -0000
> @@ -0,0 +1,6 @@
> + .section sect, "axG", @progbits, sectgroup, comdat
> + .global _start
> +_start:
> + .cfi_startproc
> + .skip 16
> + .cfi_endproc
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ ld/testsuite/ld-elf/eh-group2.s 16 Sep 2008 13:28:54 -0000
> @@ -0,0 +1,4 @@
> + .section sect, "axG", @progbits, sectgroup, comdat
> + .cfi_startproc
> + .skip 16
> + .cfi_endproc
This will also fail to assemble on arm because @ is a comment character.
Andreas.
--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, MaxfeldstraÃe 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [patch] Fix C++ no .eh_frame_hdr table will be created (PR 6893)
2008-09-17 15:41 ` Andreas Schwab
@ 2008-09-17 17:47 ` Jan Kratochvil
2008-09-17 20:26 ` Andreas Schwab
0 siblings, 1 reply; 9+ messages in thread
From: Jan Kratochvil @ 2008-09-17 17:47 UTC (permalink / raw)
To: Andreas Schwab; +Cc: binutils, Alan Modra
On Wed, 17 Sep 2008 17:41:07 +0200, Andreas Schwab wrote:
> Jan Kratochvil <jan.kratochvil@redhat.com> writes:
> > +# Exclude non-ELF targets.
> > +
> > +if ![is_elf_format] {
> > + return
> > +}
>
> This fails on ia64, because .cfi_* does not exist.
On Wed, 17 Sep 2008 17:50:10 +0200, Andreas Schwab wrote:
> Jan Kratochvil <jan.kratochvil@redhat.com> writes:
> > + .section sect, "axG", @progbits, sectgroup, comdat
>
> This will also fail to assemble on arm because @ is a comment character.
I see now the other CFI-using testcases use an explicit list of targets.
Tested those listed below.
OK to apply?
Thanks,
Jan
2008-09-17 Jan Kratochvil <jan.kratochvil@redhat.com>
* ld-elf/eh-group.exp: Execute only on tested targets supporting CFI.
--- ld/testsuite/ld-elf/eh-group.exp 17 Sep 2008 07:50:29 -0000 1.1
+++ ld/testsuite/ld-elf/eh-group.exp 17 Sep 2008 17:28:43 -0000
@@ -29,9 +29,13 @@
# executable trying to create .eh_frame_hdr. It needs a separate .exp file due
# to the requirement of two `ld' runs.
-# Exclude non-ELF targets.
+# Exclude non-ELF targets and targets not supporting CFI.
-if ![is_elf_format] {
+if { ![is_elf_format] \
+ || (![istarget i?86-*-linux*] \
+ && ![istarget powerpc*-*-linux*] \
+ && ![istarget s390*-*-linux*] \
+ && ![istarget x86_64-*-linux*]) } {
return
}
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [patch] Fix C++ no .eh_frame_hdr table will be created (PR 6893)
2008-09-17 17:47 ` Jan Kratochvil
@ 2008-09-17 20:26 ` Andreas Schwab
2008-09-18 7:19 ` Nick Clifton
0 siblings, 1 reply; 9+ messages in thread
From: Andreas Schwab @ 2008-09-17 20:26 UTC (permalink / raw)
To: Jan Kratochvil; +Cc: binutils, Alan Modra
Jan Kratochvil <jan.kratochvil@redhat.com> writes:
> -if ![is_elf_format] {
> +if { ![is_elf_format] \
> + || (![istarget i?86-*-linux*] \
> + && ![istarget powerpc*-*-linux*] \
> + && ![istarget s390*-*-linux*] \
> + && ![istarget x86_64-*-linux*]) } {
There are more targets supporting cfi (all those that define
TARGET_USE_CFIPOP).
Andreas.
--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, MaxfeldstraÃe 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [patch] Fix C++ no .eh_frame_hdr table will be created (PR 6893)
2008-09-17 20:26 ` Andreas Schwab
@ 2008-09-18 7:19 ` Nick Clifton
2008-09-18 21:19 ` Jan Kratochvil
0 siblings, 1 reply; 9+ messages in thread
From: Nick Clifton @ 2008-09-18 7:19 UTC (permalink / raw)
To: Jan Kratochvil; +Cc: Andreas Schwab, binutils, Alan Modra
Hi Jan,
>> -if ![is_elf_format] {
>> +if { ![is_elf_format] \
>> + || (![istarget i?86-*-linux*] \
>> + && ![istarget powerpc*-*-linux*] \
>> + && ![istarget s390*-*-linux*] \
>> + && ![istarget x86_64-*-linux*]) } {
>
> There are more targets supporting cfi (all those that define
> TARGET_USE_CFIPOP).
If this test is needed for more than just one file then we ought to move
it into ld/testsuite/lib/ld-lib.exp so that bug fixes and additions can
be added in just one place.
Cheers
Nick
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [patch] Fix C++ no .eh_frame_hdr table will be created (PR 6893)
2008-09-18 7:19 ` Nick Clifton
@ 2008-09-18 21:19 ` Jan Kratochvil
2008-09-19 1:16 ` Alan Modra
0 siblings, 1 reply; 9+ messages in thread
From: Jan Kratochvil @ 2008-09-18 21:19 UTC (permalink / raw)
To: Nick Clifton; +Cc: Andreas Schwab, binutils, Alan Modra
[-- Attachment #1: Type: text/plain, Size: 845 bytes --]
Hi Nick,
On Thu, 18 Sep 2008 09:15:56 +0200, Nick Clifton wrote:
>>> -if ![is_elf_format] {
>>> +if { ![is_elf_format] \
>>> + || (![istarget i?86-*-linux*] \
>>> + && ![istarget powerpc*-*-linux*] \
>>> + && ![istarget s390*-*-linux*] \
>>> + && ![istarget x86_64-*-linux*]) } {
>>
>> There are more targets supporting cfi (all those that define
>> TARGET_USE_CFIPOP).
>
> If this test is needed for more than just one file then we ought to move
> it into ld/testsuite/lib/ld-lib.exp so that bug fixes and additions can
> be added in just one place.
Originally I just copied the style I saw there. Here is the general framework
for CFI tests.
Tested on: {alpha,arm,m68k,i386,ppc,sh,s390,sparc,hppa,mips}-linux
2.19 should IMO get only the ia64-fixing patch:
http://sourceware.org/ml/binutils/2008-09/msg00138.html
Thanks,
Jan
[-- Attachment #2: binutils-cfi.patch --]
[-- Type: text/plain, Size: 5854 bytes --]
2008-09-18 Jan Kratochvil <jan.kratochvil@redhat.com>
Provide virtual target "cfi" for targets supporting CFI.
* ld-elf/eh-frame-hdr.d: Replace target and xfail statements by single
`target: cfi'.
* ld-elf/eh-group.exp: Call check_as_cfi instead of is_elf_format.
* ld-elf/eh-group1.s, elf/eh-group2.s: Use more compatible section
flags prefix '%'.
* ld-elf/eh5.d: Replace target statement by `target: cfi'. Relax the
`Code alignment factor' matching.
* lib/ld-lib.exp: Rename istarget as istarget_ld.
(istarget, check_as_cfi): New procedure.
(run_dump_test): New comment for the virtual target `cfi'.
--- ld/testsuite/ld-elf/eh-frame-hdr.d 4 Dec 2006 08:57:09 -0000 1.1
+++ ld/testsuite/ld-elf/eh-frame-hdr.d 18 Sep 2008 20:40:59 -0000
@@ -1,17 +1,7 @@
#source: eh-frame-hdr.s
#ld: -e _start --eh-frame-hdr
#objdump: -hw
-#target: alpha*-*-*
-#target: arm*-*-*
-#target: i?86-*-*
-#target: m68k-*-*
-#target: mips*-*-*
-#target: powerpc*-*-*
-#target: s390*-*-*
-#target: sh*-*-*
-#xfail: sh*l*-*-*
-#target: sparc*-*-*
-#target: x86_64-*-*
+#target: cfi
#...
[0-9] .eh_frame_hdr 0*[12][048c] .*
#pass
--- ld/testsuite/ld-elf/eh-group.exp 17 Sep 2008 07:50:29 -0000 1.1
+++ ld/testsuite/ld-elf/eh-group.exp 18 Sep 2008 20:40:59 -0000
@@ -29,9 +29,9 @@
# executable trying to create .eh_frame_hdr. It needs a separate .exp file due
# to the requirement of two `ld' runs.
-# Exclude non-ELF targets.
+# Exclude non-CFI (such as ia64) targets.
-if ![is_elf_format] {
+if {![check_as_cfi]} {
return
}
--- ld/testsuite/ld-elf/eh-group1.s 17 Sep 2008 07:50:29 -0000 1.1
+++ ld/testsuite/ld-elf/eh-group1.s 18 Sep 2008 20:40:59 -0000
@@ -1,4 +1,4 @@
- .section sect, "axG", @progbits, sectgroup, comdat
+ .section sect, "axG", %progbits, sectgroup, comdat
.global _start
_start:
.cfi_startproc
--- ld/testsuite/ld-elf/eh-group2.s 17 Sep 2008 07:50:29 -0000 1.1
+++ ld/testsuite/ld-elf/eh-group2.s 18 Sep 2008 20:40:59 -0000
@@ -1,4 +1,4 @@
- .section sect, "axG", @progbits, sectgroup, comdat
+ .section sect, "axG", %progbits, sectgroup, comdat
.cfi_startproc
.skip 16
.cfi_endproc
--- ld/testsuite/ld-elf/eh5.d 28 Jan 2008 15:15:32 -0000 1.2
+++ ld/testsuite/ld-elf/eh5.d 18 Sep 2008 20:40:59 -0000
@@ -3,14 +3,14 @@
#source: eh5b.s
#ld:
#readelf: -wf
-#target: x86_64-*-* i?86-*-*
+#target: cfi
The section .eh_frame contains:
00000000 0000001[04] 00000000 CIE
Version: 1
Augmentation: "zR"
- Code alignment factor: 1
+ Code alignment factor: .*
Data alignment factor: .*
Return address column: .*
Augmentation data: 1b
@@ -29,7 +29,7 @@ The section .eh_frame contains:
000000(2c|30) 00000014 00000000 CIE
Version: 1
Augmentation: "zPR"
- Code alignment factor: 1
+ Code alignment factor: .*
Data alignment factor: .*
Return address column: .*
Augmentation data: 03 .. .. .. .. 1b
@@ -53,7 +53,7 @@ The section .eh_frame contains:
0000007[48] 0000001[8c] 00000000 CIE
Version: 1
Augmentation: "zPLR"
- Code alignment factor: 1
+ Code alignment factor: .*
Data alignment factor: .*
Return address column: .*
Augmentation data: 03 .. .. .. .. 0c 1b
@@ -74,7 +74,7 @@ The section .eh_frame contains:
000000b[08] 0000001[04] 00000000 CIE
Version: 1
Augmentation: "zR"
- Code alignment factor: 1
+ Code alignment factor: .*
Data alignment factor: .*
Return address column: .*
Augmentation data: 1b
@@ -89,7 +89,7 @@ The section .eh_frame contains:
000000[de]8 00000014 00000000 CIE
Version: 1
Augmentation: "zPR"
- Code alignment factor: 1
+ Code alignment factor: .*
Data alignment factor: .*
Return address column: .*
Augmentation data: 03 .. .. .. .. 1b
@@ -111,7 +111,7 @@ The section .eh_frame contains:
000001(1c|30) 0000001[8c] 00000000 CIE
Version: 1
Augmentation: "zPLR"
- Code alignment factor: 1
+ Code alignment factor: .*
Data alignment factor: .*
Return address column: .*
Augmentation data: 03 .. .. .. .. 0c 1b
--- ld/testsuite/lib/ld-lib.exp 18 Feb 2008 11:04:09 -0000 1.54
+++ ld/testsuite/lib/ld-lib.exp 18 Sep 2008 20:41:01 -0000
@@ -598,7 +598,8 @@ proc simple_diff { file_1 file_2 } {
#
# target: TARGET
# Only run the test for TARGET. This may occur more than once; the
-# target being tested must match at least one.
+# target being tested must match at least one. You may provide target
+# name "cfi" for any target supporting the CFI statements.
#
# notarget: TARGET
# Do not run the test for TARGET. This may occur more than once;
@@ -1569,3 +1570,39 @@ proc check_gc_sections_available { } {
}
return $gc_sections_available_saved
}
+
+# Check if the assembler supports CFI statements.
+
+proc check_as_cfi { } {
+ global check_as_cfi_result
+ global as
+ if [info exists check_as_cfi_result] {
+ return $check_as_cfi_result
+ }
+ set as_file "tmpdir/check_as_cfi.s"
+ set as_fh [open $as_file w 0666]
+ puts $as_fh "# Generated file. DO NOT EDIT"
+ puts $as_fh "\t.cfi_startproc"
+ puts $as_fh "\t.cfi_endproc"
+ close $as_fh
+ remote_download host $as_file
+ verbose -log "Checking CFI support:"
+ rename "perror" "check_as_cfi_perror"
+ proc perror { args } { }
+ set success [ld_assemble $as $as_file "/dev/null"]
+ rename "perror" ""
+ rename "check_as_cfi_perror" "perror"
+ #remote_file host delete $as_file
+ set check_as_cfi_result $success
+ return $success
+}
+
+# Provide virtual target "cfi" for targets supporting CFI.
+
+rename "istarget" "istarget_ld"
+proc istarget { target } {
+ if {$target == "cfi"} {
+ return [check_as_cfi]
+ }
+ return [istarget_ld $target]
+}
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [patch] Fix C++ no .eh_frame_hdr table will be created (PR 6893)
2008-09-18 21:19 ` Jan Kratochvil
@ 2008-09-19 1:16 ` Alan Modra
0 siblings, 0 replies; 9+ messages in thread
From: Alan Modra @ 2008-09-19 1:16 UTC (permalink / raw)
To: Jan Kratochvil; +Cc: Nick Clifton, Andreas Schwab, binutils
On Thu, Sep 18, 2008 at 11:18:35PM +0200, Jan Kratochvil wrote:
> Provide virtual target "cfi" for targets supporting CFI.
> * ld-elf/eh-frame-hdr.d: Replace target and xfail statements by single
> `target: cfi'.
> * ld-elf/eh-group.exp: Call check_as_cfi instead of is_elf_format.
> * ld-elf/eh-group1.s, elf/eh-group2.s: Use more compatible section
> flags prefix '%'.
> * ld-elf/eh5.d: Replace target statement by `target: cfi'. Relax the
> `Code alignment factor' matching.
> * lib/ld-lib.exp: Rename istarget as istarget_ld.
> (istarget, check_as_cfi): New procedure.
> (run_dump_test): New comment for the virtual target `cfi'.
OK.
--
Alan Modra
Australia Development Lab, IBM
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2008-09-19 1:16 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-09-16 14:09 [patch] Fix C++ no .eh_frame_hdr table will be created (PR 6893) Jan Kratochvil
2008-09-17 2:37 ` Alan Modra
2008-09-17 15:41 ` Andreas Schwab
2008-09-17 17:47 ` Jan Kratochvil
2008-09-17 20:26 ` Andreas Schwab
2008-09-18 7:19 ` Nick Clifton
2008-09-18 21:19 ` Jan Kratochvil
2008-09-19 1:16 ` Alan Modra
2008-09-17 15:50 ` Andreas Schwab
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).