NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: toolchain/43314: pc relative relocations are "off by 1*size" on vax



The following reply was made to PR toolchain/43314; it has been noted by GNATS.

From: "Valeriy E. Ushakov" <uwe%stderr.spb.ru@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc: 
Subject: Re: toolchain/43314: pc relative relocations are "off by 1*size" on vax
Date: Sun, 28 Nov 2010 20:30:21 +0300

 Readelf also needs something like the patch below to correctly show
 DWARF2 frame info (-wf and -wF) in relocatable files.
 
 --- readelf.c  17 Feb 2006 16:14:25 +0300      1.2
 +++ readelf.c  28 Nov 2010 03:34:10 +0300      
 @@ -10261,11 +10261,15 @@
            encoded_ptr_size = size_of_encoded_value (fc->fde_encoding);
  
          fc->pc_begin = get_encoded_value (start, fc->fde_encoding);
 -        if ((fc->fde_encoding & 0x70) == DW_EH_PE_pcrel
 +        if ((fc->fde_encoding & 0x70) == DW_EH_PE_pcrel)
 +          {
 +            if (elf_header.e_type != ET_REL)
 +              fc->pc_begin += section->sh_addr + (start - section_start);
              /* Don't adjust for ET_REL since there's invariably a pcrel
                 reloc here, which we haven't applied.  */
 -            && elf_header.e_type != ET_REL)
 -          fc->pc_begin += section->sh_addr + (start - section_start);
 +            else if (elf_header.e_machine == EM_VAX)
 +              fc->pc_begin -= 4;
 +          }
          start += encoded_ptr_size;
          fc->pc_range = byte_get (start, encoded_ptr_size);
          start += encoded_ptr_size;
 @@ -10464,9 +10468,13 @@
  
            case DW_CFA_set_loc:
              vma = get_encoded_value (start, fc->fde_encoding);
 -            if ((fc->fde_encoding & 0x70) == DW_EH_PE_pcrel
 -                && elf_header.e_type != ET_REL)
 -              vma += section->sh_addr + (start - section_start);
 +            if ((fc->fde_encoding & 0x70) == DW_EH_PE_pcrel)
 +              {
 +                if (elf_header.e_type != ET_REL)
 +                  vma += section->sh_addr + (start - section_start);
 +                else if (elf_header.e_machine == EM_VAX)
 +                  vma -= 4;
 +              }
              start += encoded_ptr_size;
              if (do_debug_frames_interp)
                frame_display_row (fc, &need_col_headers, &max_regs);
 
 
 -uwe
 


Home | Main Index | Thread Index | Old Index