3.0 PATCH: Enable shared libstdc++ v3 on Tru64 UNIX

Richard Henderson rth@redhat.com
Wed May 30 18:01:00 GMT 2001


On Wed, May 30, 2001 at 02:04:21PM +0200, Rainer Orth wrote:
> > Ug.  Did they turn on unaligned access checks by default for 5.1?
> > That's the dynamic linker choaking.
> 
> No, they didn't.  It's still the same as on V4.0F:
> 
> % uac p
> parent printing is on
>        fixup is on
>        sigbus is off
> 
> Yet those failures are still unique to V5.1.

Huh.  Well, give the following a try and see if it helps.


r~



Index: dwarf2.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/dwarf2.h,v
retrieving revision 1.16.6.1
diff -c -p -d -r1.16.6.1 dwarf2.h
*** dwarf2.h	2001/05/13 07:09:52	1.16.6.1
--- dwarf2.h	2001/05/31 00:56:36
*************** enum dwarf_macinfo_record_type
*** 580,584 ****
--- 580,585 ----
  #define DW_EH_PE_textrel	0x20
  #define DW_EH_PE_datarel	0x30
  #define DW_EH_PE_funcrel	0x40
+ #define DW_EH_PE_aligned	0x50
  
  #define DW_EH_PE_indirect	0x80
Index: dwarf2asm.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/dwarf2asm.c,v
retrieving revision 1.6.2.3
diff -c -p -d -r1.6.2.3 dwarf2asm.c
*** dwarf2asm.c	2001/05/16 22:44:50	1.6.2.3
--- dwarf2asm.c	2001/05/31 00:56:36
*************** eh_data_format_name (format)
*** 490,495 ****
--- 490,496 ----
  
    S(DW_EH_PE_absptr, "absolute")
    S(DW_EH_PE_omit, "omit")
+   S(DW_EH_PE_aligned, "aligned absolute")
  
    S(DW_EH_PE_uleb128, "uleb128")
    S(DW_EH_PE_udata2, "udata2")
*************** dw2_asm_output_encoded_addr_rtx VPARAMS 
*** 946,951 ****
--- 947,958 ----
  #endif
  
    size = size_of_encoded_value (encoding);
+ 
+   if (encoding == DW_EH_PE_aligned)
+     {
+       assemble_align (POINTER_SIZE);
+       encoding = DW_EH_PE_absptr;
+     }
  
    /* NULL is _always_ represented as a plain zero.  */
    if (addr == const0_rtx)
Index: dwarf2out.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/dwarf2out.c,v
retrieving revision 1.242.2.18
diff -c -p -d -r1.242.2.18 dwarf2out.c
*** dwarf2out.c	2001/05/21 23:29:41	1.242.2.18
--- dwarf2out.c	2001/05/31 00:56:36
*************** output_call_frame_info (for_eh)
*** 1820,1825 ****
--- 1820,1847 ----
  	  augmentation[0] = 'z';
            *p = '\0';
  	}
+ 
+       /* Ug.  Some platforms can't do unaligned dynamic relocations at all.  */
+       if (eh_personality_libfunc && per_encoding == DW_EH_PE_aligned)
+ 	{
+ 	  int offset = (  4		/* Length */
+ 			+ 4		/* CIE Id */
+ 			+ 1		/* CIE version */
+ 			+ strlen (augmentation) + 1	/* Augmentation */
+ 			+ size_of_uleb128 (1)		/* Code alignment */
+ 			+ size_of_sleb128 (DWARF_CIE_DATA_ALIGNMENT)
+ 			+ 1		/* RA column */
+ 			+ 1		/* Augmentation size */
+ 			+ 1		/* Personality encoding */ );
+ 	  int pad = -offset & (PTR_SIZE - 1);
+ 
+ 	  augmentation_size += pad;
+ 
+ 	  /* Augmentations should be small, so there's scarce need to
+ 	     iterate for a solution.  Die if we exceed one uleb128 byte.  */
+ 	  if (size_of_uleb128 (augmentation_size) != 1)
+ 	    abort ();
+ 	}
      }
    dw2_asm_output_nstring (augmentation, -1, "CIE Augmentation");
  
*************** output_call_frame_info (for_eh)
*** 1909,1917 ****
  	{
  	  if (any_lsda_needed)
  	    {
! 	      dw2_asm_output_data_uleb128 (
! 		size_of_encoded_value (lsda_encoding), "Augmentation size");
  
  	      if (fde->uses_eh_lsda)
  	        {
  	          ASM_GENERATE_INTERNAL_LABEL (l1, "LLSDA",
--- 1931,1953 ----
  	{
  	  if (any_lsda_needed)
  	    {
! 	      int size = size_of_encoded_value (lsda_encoding);
  
+ 	      if (lsda_encoding == DW_EH_PE_aligned)
+ 		{
+ 		  int offset = (  4		/* Length */
+ 				+ 4		/* CIE offset */
+ 				+ 2 * size_of_encoded_value (fde_encoding)
+ 				+ 1		/* Augmentation size */ );
+ 		  int pad = -offset & (PTR_SIZE - 1);
+ 
+ 		  size += pad;
+ 		  if (size_of_uleb128 (size) != 1)
+ 		    abort ();
+ 		}
+ 
+ 	      dw2_asm_output_data_uleb128 (size, "Augmentation size");
+ 
  	      if (fde->uses_eh_lsda)
  	        {
  	          ASM_GENERATE_INTERNAL_LABEL (l1, "LLSDA",
*************** output_call_frame_info (for_eh)
*** 1921,1928 ****
  		 	"Language Specific Data Area");
  	        }
  	      else
! 	        dw2_asm_output_data (size_of_encoded_value (lsda_encoding),
! 				     0, "Language Specific Data Area (none)");
  	    }
  	  else
  	    dw2_asm_output_data_uleb128 (0, "Augmentation size");
--- 1957,1968 ----
  		 	"Language Specific Data Area");
  	        }
  	      else
! 		{
! 		  if (lsda_encoding == DW_EH_PE_aligned)
! 		    ASM_OUTPUT_ALIGN (asm_out_file, floor_log2 (PTR_SIZE));
! 		  dw2_asm_output_data (size_of_encoded_value (lsda_encoding),
! 				       0, "Language Specific Data Area (none)");
! 		}
  	    }
  	  else
  	    dw2_asm_output_data_uleb128 (0, "Augmentation size");
Index: unwind-dw2-fde.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/unwind-dw2-fde.c,v
retrieving revision 1.2.2.4
diff -c -p -d -r1.2.2.4 unwind-dw2-fde.c
*** unwind-dw2-fde.c	2001/05/23 01:26:59	1.2.2.4
--- unwind-dw2-fde.c	2001/05/31 00:56:37
*************** base_from_object (unsigned char encoding
*** 233,238 ****
--- 233,239 ----
      {
      case DW_EH_PE_absptr:
      case DW_EH_PE_pcrel:
+     case DW_EH_PE_aligned:
        return 0;
  
      case DW_EH_PE_textrel:
*************** get_cie_encoding (struct dwarf_cie *cie)
*** 270,276 ****
  	return *p;
        /* Personality encoding and pointer.  */
        else if (*aug == 'P')
! 	p = read_encoded_value_with_base (*p & 0xF, 0, p + 1, &dummy);
        /* LSDA encoding.  */
        else if (*aug == 'L')
  	p++;
--- 271,282 ----
  	return *p;
        /* Personality encoding and pointer.  */
        else if (*aug == 'P')
! 	{
! 	  /* ??? Avoid dereferencing indirect pointers, since we're
! 	     faking the base address.  Gotta keep DW_EH_PE_aligned
! 	     intact, however.  */
! 	  p = read_encoded_value_with_base (*p & 0x7F, 0, p + 1, &dummy);
! 	}
        /* LSDA encoding.  */
        else if (*aug == 'L')
  	p++;
Index: unwind-pe.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/unwind-pe.h,v
retrieving revision 1.2.2.2
diff -c -p -d -r1.2.2.2 unwind-pe.h
*** unwind-pe.h	2001/05/16 19:29:55	1.2.2.2
--- unwind-pe.h	2001/05/31 00:56:37
***************
*** 40,45 ****
--- 40,46 ----
  #define DW_EH_PE_textrel        0x20
  #define DW_EH_PE_datarel        0x30
  #define DW_EH_PE_funcrel        0x40
+ #define DW_EH_PE_aligned        0x50
  
  #define DW_EH_PE_indirect	0x80
  
*************** base_of_encoded_value (unsigned char enc
*** 83,88 ****
--- 84,90 ----
      {
      case DW_EH_PE_absptr:
      case DW_EH_PE_pcrel:
+     case DW_EH_PE_aligned:
        return 0;
  
      case DW_EH_PE_textrel:
*************** read_encoded_value_with_base (unsigned c
*** 117,122 ****
--- 119,133 ----
    union unaligned *u = (union unaligned *) p;
    _Unwind_Ptr result;
  
+   if (encoding == DW_EH_PE_aligned)
+     {
+       _Unwind_Ptr a = (_Unwind_Ptr)p;
+       a = (a + sizeof (void *) - 1) & - sizeof(void *);
+       result = *(_Unwind_Ptr *) a;
+       p = (const unsigned char *)(a + sizeof (void *));
+     }
+   else
+   {
    switch (encoding & 0x0f)
      {
      case DW_EH_PE_absptr:
*************** read_encoded_value_with_base (unsigned c
*** 195,200 ****
--- 206,212 ----
        if (encoding & DW_EH_PE_indirect)
  	result = *(_Unwind_Ptr *)result;
      }
+   }
  
    *val = result;
    return p;
Index: config/alpha/osf.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/alpha/osf.h,v
retrieving revision 1.15
diff -c -p -d -r1.15 osf.h
*** osf.h	2001/01/13 12:34:02	1.15
--- osf.h	2001/05/31 00:56:37
*************** __enable_execute_stack (addr)						\
*** 153,155 ****
--- 153,166 ----
  #define HAS_INIT_SECTION
  #define LD_INIT_SWITCH "-init"
  #define LD_FINI_SWITCH "-fini"
+ 
+ /* Select a format to encode pointers in exception handling data.  CODE
+    is 0 for data, 1 for code labels, 2 for function pointers.  GLOBAL is
+    true if the symbol may be affected by dynamic relocations.
+    
+    We really ought to be using the SREL32 relocations that ECOFF has,
+    but no version of the assembler supports creating such things, and
+    Compaq has no plans to rectify this.  Worse, the dynamic loader
+    cannot handle unaligned relocations, so we have to make sure that
+    things get padded appropriately.  */
+ #define ASM_PREFERRED_EH_DATA_FORMAT(CODE,GLOBAL)  DW_EH_PE_aligned



More information about the Gcc-patches mailing list