The Solaris 11.2 x86 assembler is going to gain support for the cfi
directives.  To do things right this time, it will create read-only
.eh_frame sections, unlike what gas and gcc currently do.  The goal is
to let /bin/ld handle the required merging of read-only and read-write
.eh_frame sections, but that's not there yet and won't make the S11.2
release.  For the time being, gcc/configure.ac (gcc_cv_as_cfi_directive)
takes care of that and disables the support, but there's one issue left:
libitm does the cfi directive detection on its own, finds the assembler
support and uses it in config/x86/sjlj.S, which breaks linking the
32-bit libitm.so:

ld: fatal: file .libs/aatree.o; section [15].eh_frame and file .libs/sjlj.o; 
section [3].eh_frame have incompatibile attributes and cannot be merged into a 
single output section
collect2: error: ld returned 1 exit status
make[4]: *** [libitm.la] Error 1

To avoid this, libitm and gcc need to agree whether or not to use
assembler cfi support.

The following patch avoid this by checking __GCC_HAVE_DWARF2_CFI_ASM.

Alternatively, one could do away with
config/asmcfi.m4 (GCC_AS_CFI_PSEUDO_OP), and only check for
__GCC_HAVE_DWARF2_CFI_ASM under the assumption that libitm will only be
used in-tree with a matching gcc.

I've avoided changing config/asmcfi.m4 since that's also used by libffi,
which is external to the gcc tree and can be used with non-gcc
compilers.

The patch allowed i386-pc-solaris2.11 bootstraps to finish without
regressions on trunk and 4.8 branch, still need to test 4.7 branch.

Ok for trunk, 4.8 and 4.7 branches once testing completes?

        Rainer


2014-04-07  Rainer Orth  <r...@cebitec.uni-bielefeld.de>

        * config/generic/asmcfi.h: Also check for
        __GCC_HAVE_DWARF2_CFI_ASM.

# HG changeset patch
# Parent e003a40e0bb68a5019d8492cec81e453514988b0
Check if GCC uses assembler cfi support

diff --git a/libitm/config/generic/asmcfi.h b/libitm/config/generic/asmcfi.h
--- a/libitm/config/generic/asmcfi.h
+++ b/libitm/config/generic/asmcfi.h
@@ -24,7 +24,7 @@
 
 #include "config.h"
 
-#ifdef HAVE_AS_CFI_PSEUDO_OP
+#if defined(HAVE_AS_CFI_PSEUDO_OP) && defined(__GCC_HAVE_DWARF2_CFI_ASM)
 
 #define cfi_startproc			.cfi_startproc
 #define cfi_endproc			.cfi_endproc
@@ -50,4 +50,4 @@
 #define cfi_restore(r)
 #define cfi_undefined(r)
 
-#endif /* HAVE_AS_CFI_PSEUDO_OP */
+#endif /* HAVE_AS_CFI_PSEUDO_OP && __GCC_HAVE_DWARF2_CFI_ASM */
-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University

Reply via email to