* config/tc-v850.c (CHECK_): Remove token pasting operator.
[deliverable/binutils-gdb.git] / bfd / elf32-i386.c
index b71d78eb073dbb46a9f1fb893499153966c0c3ba..483b8a5589aed0311eeb15bc9f0c3c5c7bde2b50 100644 (file)
@@ -2617,36 +2617,40 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section,
                  BFD_ASSERT (rel->r_offset >= 1);
                  val = bfd_get_8 (input_bfd, contents + rel->r_offset - 1);
                  BFD_ASSERT (rel->r_offset + 4 <= input_section->_raw_size);
-                 if (val != 0xa1)
-                   {
-                     BFD_ASSERT (rel->r_offset >= 2);
-                     type = bfd_get_8 (input_bfd, contents + rel->r_offset - 2);
-                   }
                  if (val == 0xa1)
                    {
                      /* movl foo, %eax.  */
-                     bfd_put_8 (output_bfd, 0xb8, contents + rel->r_offset - 2);
-                   }
-                 else if (type == 0x8b)
-                   {
-                     /* movl */
-                     BFD_ASSERT ((val & 0xc7) == 0x05);
-                     bfd_put_8 (output_bfd, 0xc7,
-                                contents + rel->r_offset - 2);
-                     bfd_put_8 (output_bfd, 0xc0 | ((val >> 3) & 7),
-                                contents + rel->r_offset - 1);
+                     bfd_put_8 (output_bfd, 0xb8, contents + rel->r_offset - 1);
                    }
-                 else if (type == 0x03)
+                 else
                    {
-                     /* addl */
-                     BFD_ASSERT ((val & 0xc7) == 0x05);
-                     bfd_put_8 (output_bfd, 0x81,
-                                contents + rel->r_offset - 2);
-                     bfd_put_8 (output_bfd, 0xc0 | ((val >> 3) & 7),
-                                contents + rel->r_offset - 1);
+                     BFD_ASSERT (rel->r_offset >= 2);
+                     type = bfd_get_8 (input_bfd, contents + rel->r_offset - 2);
+                     switch (type)
+                       {
+                       case 0x8b:
+                         /* movl */
+                         BFD_ASSERT ((val & 0xc7) == 0x05);
+                         bfd_put_8 (output_bfd, 0xc7,
+                                    contents + rel->r_offset - 2);
+                         bfd_put_8 (output_bfd,
+                                    0xc0 | ((val >> 3) & 7),
+                                    contents + rel->r_offset - 1);
+                         break;
+                       case 0x03:
+                         /* addl */
+                         BFD_ASSERT ((val & 0xc7) == 0x05);
+                         bfd_put_8 (output_bfd, 0x81,
+                                    contents + rel->r_offset - 2);
+                         bfd_put_8 (output_bfd,
+                                    0xc0 | ((val >> 3) & 7),
+                                    contents + rel->r_offset - 1);
+                         break;
+                       default:
+                         BFD_FAIL ();
+                         break;
+                       }
                    }
-                 else
-                   BFD_FAIL ();
                  bfd_put_32 (output_bfd, -tpoff (info, relocation),
                              contents + rel->r_offset);
                  continue;
@@ -2926,7 +2930,7 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section,
          break;
 
        case R_386_TLS_LDO_32:
-         if (info->shared)
+         if (info->shared || (input_section->flags & SEC_CODE) == 0)
            relocation -= dtpoff_base (info);
          else
            /* When converting LDO to LE, we must negate.  */
This page took 0.039595 seconds and 4 git commands to generate.