Currently, Solaris/x86 uses a private version of
ASM_PREFERRED_EH_DATA_FORMAT since older versions of the Solaris
assembler couldn't calculate the difference between labels in different
sections.  This restriction has been lifted in Solaris 10 patch
119961-07 from May 2010.  Since the redefinition causes us to lose
several cases in the i386 default (asm_preferred_eh_data_format) and the
unwinder can easily deal with different encodings, it's best to avoid
the redefinition if possible.

The following patch does just that.  I chose to only test for
!HAVE_AS_IX86_DIFF_SECT_DELTA to enable the redef, not also
HAVE_GAS_CFI_DIRECTIVE, to allow for the (admittedly unlikely) case the
the assembler supports cfi directives, but not inter-section label
diffs.  In this scenario, -fno-dwarf2-cfi-asm would be broken.

Tested on i386-pc-solaris2.1[10] with all different as/ld combos,
installed on mainline.

        Rainer


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

        * config/i386/sol2.h (ASM_PREFERRED_EH_DATA_FORMAT): Only redefine
        if not HAVE_AS_IX86_DIFF_SECT_DELTA.

# HG changeset patch
# Parent df024c74c75cec9fc9d7059928cfa014b5cd8559
Only redefine ASM_PREFERRED_EH_DATA_FORMAT if necessary on Solaris/x86

diff --git a/gcc/config/i386/sol2.h b/gcc/config/i386/sol2.h
--- a/gcc/config/i386/sol2.h
+++ b/gcc/config/i386/sol2.h
@@ -26,13 +26,15 @@ along with GCC; see the file COPYING3.  
 	(MASK_80387 | MASK_IEEE_FP | MASK_FLOAT_RETURNS | MASK_VECT8_RETURNS)
 
 /* Old versions of the Solaris assembler can not handle the difference of
-   labels in different sections, so force DW_EH_PE_datarel.  */
+   labels in different sections, so force DW_EH_PE_datarel if so.  */
+#ifndef HAVE_AS_IX86_DIFF_SECT_DELTA
 #undef ASM_PREFERRED_EH_DATA_FORMAT
 #define ASM_PREFERRED_EH_DATA_FORMAT(CODE,GLOBAL)			\
   (flag_pic ? ((GLOBAL ? DW_EH_PE_indirect : 0)				\
 	       | (TARGET_64BIT ? DW_EH_PE_pcrel | DW_EH_PE_sdata4	\
 		  : DW_EH_PE_datarel))					\
    : DW_EH_PE_absptr)
+#endif
 
 /* The Solaris linker will not merge a read-only .eh_frame section
    with a read-write .eh_frame section.  None of the encodings used
-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University

Reply via email to