This is the mail archive of the binutils@sourceware.cygnus.com mailing list for the binutils project.


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

Re: HPPA/SOM Patch



In chasing this a bit further, I see that the problem arises while trying
to convert the dummy_symbol from a local symbol to real symbol after 
set_symtab has been called. I also see that in my cut/paste zealousness,
I blew the original patch. Here is an updated version:

1999-06-04  Mark Klein <mklein@dis.com>

        * config/tc-hppa.c (md_begin): Convert local symbol dummy_symbol to
          real. OBJ_SOM only.
          (tc_gen_reloc): Still need bfd_abs_symbol in some relocs.

Index: tc-hppa.c
===================================================================
RCS file: /cvs/binutils/binutils/gas/config/tc-hppa.c,v
retrieving revision 1.4
diff -c -r1.4 tc-hppa.c
*** tc-hppa.c	1999/06/03 12:42:35	1.4
--- tc-hppa.c	1999/06/05 03:49:48
***************
*** 702,710 ****
  /* Holds the last field selector.  */
  static int hppa_field_selector;
  
! 
  /* A dummy bfd symbol so that all relocations have symbols of some kind.  */
  static symbolS *dummy_symbol;
  
  /* Nonzero if errors are to be printed.  */
  static int print_errors = 1;
--- 702,711 ----
  /* Holds the last field selector.  */
  static int hppa_field_selector;
  
! #ifdef OBJ_SOM
  /* A dummy bfd symbol so that all relocations have symbols of some kind.  */
  static symbolS *dummy_symbol;
+ #endif
  
  /* Nonzero if errors are to be printed.  */
  static int print_errors = 1;
***************
*** 1339,1346 ****
--- 1340,1351 ----
       anything into the old one switch to the new one now.  */
    subseg_set (text_section, 0);
  
+ #ifdef OBJ_SOM
    dummy_symbol = symbol_find_or_make ("L$dummy");
    S_SET_SEGMENT (dummy_symbol, text_section);
+   /* Force the symbol to be converted to a real symbol. */
+   (void) symbol_get_bfdsym (dummy_symbol); 
+ #endif
  }
  
  /* Assemble a single instruction storing it into a frag.  */
***************
*** 2813,2819 ****
      {
        code = *codes[i];
  
!       relocs[i]->sym_ptr_ptr = &fixp->fx_addsy->bsym;
        relocs[i]->howto = bfd_reloc_type_lookup (stdoutput, code);
        relocs[i]->address = fixp->fx_frag->fr_address + fixp->fx_where;
  
--- 2818,2825 ----
      {
        code = *codes[i];
  
!       relocs[i]->sym_ptr_ptr = (asymbol **) xmalloc (sizeof (asymbol *));
!       *relocs[i]->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
        relocs[i]->howto = bfd_reloc_type_lookup (stdoutput, code);
        relocs[i]->address = fixp->fx_frag->fr_address + fixp->fx_where;
  
***************
*** 2824,2846 ****
  	     of two symbols.  With that in mind we fill in all four
  	     relocs now and break out of the loop.  */
  	  assert (i == 1);
! 	  relocs[0]->sym_ptr_ptr = (asymbol **) &bfd_abs_symbol;
  	  relocs[0]->howto = bfd_reloc_type_lookup (stdoutput, *codes[0]);
  	  relocs[0]->address = fixp->fx_frag->fr_address + fixp->fx_where;
  	  relocs[0]->addend = 0;
! 	  relocs[1]->sym_ptr_ptr = &fixp->fx_addsy->bsym;
  	  relocs[1]->howto = bfd_reloc_type_lookup (stdoutput, *codes[1]);
  	  relocs[1]->address = fixp->fx_frag->fr_address + fixp->fx_where;
  	  relocs[1]->addend = 0;
! 	  relocs[2]->sym_ptr_ptr = &fixp->fx_subsy->bsym;
  	  relocs[2]->howto = bfd_reloc_type_lookup (stdoutput, *codes[2]);
  	  relocs[2]->address = fixp->fx_frag->fr_address + fixp->fx_where;
  	  relocs[2]->addend = 0;
! 	  relocs[3]->sym_ptr_ptr = (asymbol **) &bfd_abs_symbol;
  	  relocs[3]->howto = bfd_reloc_type_lookup (stdoutput, *codes[3]);
  	  relocs[3]->address = fixp->fx_frag->fr_address + fixp->fx_where;
  	  relocs[3]->addend = 0;
! 	  relocs[4]->sym_ptr_ptr = (asymbol **) &bfd_abs_symbol;
  	  relocs[4]->howto = bfd_reloc_type_lookup (stdoutput, *codes[4]);
  	  relocs[4]->address = fixp->fx_frag->fr_address + fixp->fx_where;
  	  relocs[4]->addend = 0;
--- 2830,2854 ----
  	     of two symbols.  With that in mind we fill in all four
  	     relocs now and break out of the loop.  */
  	  assert (i == 1);
! 	  relocs[0]->sym_ptr_ptr = (asymbol **) &(bfd_abs_symbol);
  	  relocs[0]->howto = bfd_reloc_type_lookup (stdoutput, *codes[0]);
  	  relocs[0]->address = fixp->fx_frag->fr_address + fixp->fx_where;
  	  relocs[0]->addend = 0;
! 	  relocs[1]->sym_ptr_ptr = (asymbol **) xmalloc (sizeof (asymbol *));
! 	  *relocs[1]->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
  	  relocs[1]->howto = bfd_reloc_type_lookup (stdoutput, *codes[1]);
  	  relocs[1]->address = fixp->fx_frag->fr_address + fixp->fx_where;
  	  relocs[1]->addend = 0;
! 	  relocs[2]->sym_ptr_ptr = (asymbol **) xmalloc (sizeof (asymbol *));
! 	  *relocs[2]->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_subsy);
  	  relocs[2]->howto = bfd_reloc_type_lookup (stdoutput, *codes[2]);
  	  relocs[2]->address = fixp->fx_frag->fr_address + fixp->fx_where;
  	  relocs[2]->addend = 0;
! 	  relocs[3]->sym_ptr_ptr = (asymbol **) &(bfd_abs_symbol);
  	  relocs[3]->howto = bfd_reloc_type_lookup (stdoutput, *codes[3]);
  	  relocs[3]->address = fixp->fx_frag->fr_address + fixp->fx_where;
  	  relocs[3]->addend = 0;
! 	  relocs[4]->sym_ptr_ptr = (asymbol **) &(bfd_abs_symbol);
  	  relocs[4]->howto = bfd_reloc_type_lookup (stdoutput, *codes[4]);
  	  relocs[4]->address = fixp->fx_frag->fr_address + fixp->fx_where;
  	  relocs[4]->addend = 0;
***************
*** 2878,2884 ****
  	case R_N0SEL:
  	case R_N1SEL:
  	  /* There is no symbol or addend associated with these fixups.  */
! 	  relocs[i]->sym_ptr_ptr = &dummy_symbol->bsym;
  	  relocs[i]->addend = 0;
  	  break;
  
--- 2886,2893 ----
  	case R_N0SEL:
  	case R_N1SEL:
  	  /* There is no symbol or addend associated with these fixups.  */
!           relocs[i]->sym_ptr_ptr = (asymbol **) xmalloc (sizeof (asymbol *));
!           *relocs[i]->sym_ptr_ptr = symbol_get_bfdsym (dummy_symbol);
  	  relocs[i]->addend = 0;
  	  break;
  
***************
*** 2886,2892 ****
  	case R_ENTRY:
  	case R_EXIT:
  	  /* There is no symbol associated with these fixups.  */
! 	  relocs[i]->sym_ptr_ptr = &dummy_symbol->bsym;
  	  relocs[i]->addend = fixp->fx_offset;
  	  break;
  
--- 2895,2902 ----
  	case R_ENTRY:
  	case R_EXIT:
  	  /* There is no symbol associated with these fixups.  */
!           relocs[i]->sym_ptr_ptr = (asymbol **) xmalloc (sizeof (asymbol *));
!           *relocs[i]->sym_ptr_ptr = symbol_get_bfdsym (dummy_symbol);
  	  relocs[i]->addend = fixp->fx_offset;
  	  break;
  
***************
*** 6555,6561 ****
        && (hppa_fix->segment->flags & SEC_CODE))
      {
        /* Apparently sy_used_in_reloc never gets set for sub symbols.  */
!       fixp->fx_subsy->sy_used_in_reloc = 1;
        return 0;
      }
  
--- 6565,6571 ----
        && (hppa_fix->segment->flags & SEC_CODE))
      {
        /* Apparently sy_used_in_reloc never gets set for sub symbols.  */
!       symbol_mark_used_in_reloc (fixp->fx_subsy);
        return 0;
      }
  

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