* config/tc-rl78.c (rl78_cons_fix_new): Handle user-specified
authorDJ Delorie <dj@redhat.com>
Tue, 29 Jan 2013 22:17:53 +0000 (22:17 +0000)
committerDJ Delorie <dj@redhat.com>
Tue, 29 Jan 2013 22:17:53 +0000 (22:17 +0000)
relocs in .word/.etc statements.

bfd/elf32-rx.c
gas/ChangeLog
gas/config/tc-rl78.c

index 5000eb7be0cf1d54688708187807b1d493057a95..8b61142d4bf3c53d3d15185937ffe719748d21f0 100644 (file)
@@ -3098,9 +3098,15 @@ rx_elf_object_p (bfd * abfd)
        {
          Elf_Internal_Shdr *sec = elf_tdata(abfd)->elf_sect_ptr[u];
 
+<<<<<<< elf32-rx.c
+         if (phdr[i].p_offset <= (bfd_vma) sec->sh_offset
+             && (bfd_vma)sec->sh_offset <= phdr[i].p_offset + (phdr[i].p_filesz - 1)
+             && sec->sh_size > 0)
+=======
          if (phdr[i].p_filesz
              && phdr[i].p_offset <= (bfd_vma) sec->sh_offset
              && (bfd_vma)sec->sh_offset <= phdr[i].p_offset + (phdr[i].p_filesz - 1))
+>>>>>>> 1.20
            {
              /* Found one!  The difference between the two addresses,
                 plus the difference between the two file offsets, is
@@ -3113,7 +3119,7 @@ rx_elf_object_p (bfd * abfd)
                 The correct LMA for the section is fffc0140 + (2050-2010).
              */
 
-             phdr[i].p_vaddr = sec->sh_addr + (sec->sh_offset - phdr[i].p_offset);
+             phdr[i].p_vaddr = sec->sh_addr - (sec->sh_offset - phdr[i].p_offset);
              break;
            }
        }
@@ -3123,9 +3129,15 @@ rx_elf_object_p (bfd * abfd)
       bsec = abfd->sections;
       while (bsec)
        {
+<<<<<<< elf32-rx.c
+         if (bsec->flags & (SEC_LOAD | SEC_ALLOC)
+             && phdr[i].p_offset <= (bfd_vma) bsec->filepos
+             && (bfd_vma) bsec->filepos <= phdr[i].p_offset + (phdr[i].p_filesz - 1))
+=======
          if (phdr[i].p_filesz
              && phdr[i].p_vaddr <= bsec->vma
              && bsec->vma <= phdr[i].p_vaddr + (phdr[i].p_filesz - 1))
+>>>>>>> 1.20
            {
              bsec->lma = phdr[i].p_paddr + (bsec->vma - phdr[i].p_vaddr);
            }
index 3083caeda25c07934a415132a971d5444317d0b6..b4a211f594b088825ddc6626dc96b1df7f5857e6 100644 (file)
@@ -1,3 +1,8 @@
+2013-01-29  DJ Delorie  <dj@redhat.com>
+
+       * config/tc-rl78.c (rl78_cons_fix_new): Handle user-specified
+       relocs in .word/.etc statements.
+
 2013-01-29  Roland McGrath  <mcgrathr@google.com>
 
        * config/tc-arm.c (md_apply_fix): Use as_bad_where for "bad
index 53d3df2f2b619df6fc3813c9fa08a51f9336a87b..bd964dc163003d9222a04c0499230ac3eee68d45 100644 (file)
@@ -554,6 +554,23 @@ rl78_cons_fix_new (fragS * frag,
       return;
     }
 
+  switch (exp->X_md)
+    {
+    case BFD_RELOC_RL78_LO16:
+    case BFD_RELOC_RL78_HI16:
+      if (size != 2)
+       as_bad (_("%%hi16/%%lo16 only applies to .short or .hword"));
+      type = exp->X_md;
+      break;
+    case BFD_RELOC_RL78_HI8:
+      if (size != 1)
+       as_bad (_("%%hi8 only applies to .byte"));
+      type = exp->X_md;
+      break;
+    default:
+      break;
+    }
+
   if (exp->X_op == O_subtract && exp->X_op_symbol)
     {
       if (size != 4 && size != 2 && size != 1)