This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Fix handling of LABEL_REF in ARM PIC.



The following patch fixes an ICE that occurs when building libstdc++-v3 on 
arm-netbsd.

2001-12-13  Richard Earnshaw  <rearnsha@arm.com>

	* arm.c (legitimize_pic_address): Handle LABEL_REFs in substantially
	the same way as we handle SYMBOL_REFS.


Index: config/arm/arm.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/arm/arm.c,v
retrieving revision 1.178
diff -p -r1.178 arm.c
*** arm.c	2001/12/09 20:13:06	1.178
--- arm.c	2001/12/13 11:12:00
*************** legitimize_pic_address (orig, mode, reg)
*** 2254,2260 ****
       enum machine_mode mode;
       rtx reg;
  {
!   if (GET_CODE (orig) == SYMBOL_REF)
      {
  #ifndef AOF_ASSEMBLER
        rtx pic_ref, address;
--- 2254,2261 ----
       enum machine_mode mode;
       rtx reg;
  {
!   if (GET_CODE (orig) == SYMBOL_REF
!       || GET_CODE (orig) == LABEL_REF)
      {
  #ifndef AOF_ASSEMBLER
        rtx pic_ref, address;
*************** legitimize_pic_address (orig, mode, reg)
*** 2287,2296 ****
        else
  	emit_insn (gen_pic_load_addr_thumb (address, orig));
  
!       pic_ref = gen_rtx_MEM (Pmode,
! 			     gen_rtx_PLUS (Pmode, pic_offset_table_rtx,
! 					   address));
!       RTX_UNCHANGING_P (pic_ref) = 1;
        insn = emit_move_insn (reg, pic_ref);
  #endif
        current_function_uses_pic_offset_table = 1;
--- 2288,2303 ----
        else
  	emit_insn (gen_pic_load_addr_thumb (address, orig));
  
!       if (GET_CODE (orig) == LABEL_REF && NEED_GOT_RELOC)
! 	pic_ref = gen_rtx_PLUS (Pmode, pic_offset_table_rtx, address);
!       else
! 	{
! 	  pic_ref = gen_rtx_MEM (Pmode,
! 				 gen_rtx_PLUS (Pmode, pic_offset_table_rtx,
! 					       address));
! 	  RTX_UNCHANGING_P (pic_ref) = 1;
! 	}
! 
        insn = emit_move_insn (reg, pic_ref);
  #endif
        current_function_uses_pic_offset_table = 1;
*************** legitimize_pic_address (orig, mode, reg)
*** 2350,2374 ****
  	}
  
        return gen_rtx_PLUS (Pmode, base, offset);
-     }
-   else if (GET_CODE (orig) == LABEL_REF)
-     {
-       current_function_uses_pic_offset_table = 1;
-       
-       if (NEED_GOT_RELOC)
- 	{
- 	  rtx pic_ref, address = gen_reg_rtx (Pmode);
- 
- 	  if (TARGET_ARM)
- 	    emit_insn (gen_pic_load_addr_arm (address, orig));
- 	  else
- 	    emit_insn (gen_pic_load_addr_thumb (address, orig));
- 
- 	  pic_ref = gen_rtx_PLUS (Pmode, pic_offset_table_rtx, address);
- 	  
- 	  emit_move_insn (address, pic_ref);
- 	  return address;
- 	}
      }
  
    return orig;
--- 2357,2362 ----

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]