[ARC] General fixes.
authorClaudiu Zissulescu <claziss@synopsys.com>
Mon, 29 Feb 2016 15:07:48 +0000 (16:07 +0100)
committerClaudiu Zissulescu <claziss@synopsys.com>
Mon, 29 Feb 2016 15:07:48 +0000 (16:07 +0100)
bfd/
2016-02-29  Cupertino Miranda <Cupertino.Miranda@synopsys.com>

* elf32-arc.c (arc_elf_final_write_processing): Add condition to
the flag change.
        (elf_arc_relocate_section): Fixes and conditions to support PIE.
Assert for code sections dynamic relocs.

gas/
2016-02-29  Claudiu Zissulescu  <Claudiu.Zissulescu@synopsys.com>

* config/tc-arc.c: Enable code density instructions for ARC EM.

ld/
2016-02-29  Cupertino Miranda  <Cupertino.Miranda@synopsys.com>

* scripttempl/arclinux.sc: Force .tdata and .tbss to always be
generated.

bfd/ChangeLog
bfd/elf32-arc.c
gas/ChangeLog
gas/config/tc-arc.c
ld/ChangeLog
ld/scripttempl/arclinux.sc

index 8339eae9b32d346385716a1213b1847601a2b4bd..5d39624b7db408f66dd2487762901bf0a9ae3f2a 100644 (file)
@@ -1,3 +1,10 @@
+2016-02-29  Cupertino Miranda <Cupertino.Miranda@synopsys.com>
+
+       * elf32-arc.c (arc_elf_final_write_processing): Add condition to
+       the flag change.
+        (elf_arc_relocate_section): Fixes and conditions to support PIE.
+       Assert for code sections dynamic relocs.
+
 2016-02-26  Renlin Li  <renlin.li@arm.com>
 
        * elfnn-aarch64.c (elfNN_aarch64_howto_table): Fix signed overflow
index 8ffc23ad649f38d7699dd2432ceb9289fc1ad3b7..9993478742bdd635ed044bc5677b5cf41181a8ff 100644 (file)
@@ -688,10 +688,11 @@ arc_elf_final_write_processing (bfd * abfd,
     default:
       abort ();
     }
+  if ((elf_elfheader (abfd)->e_flags & EF_ARC_MACH) == EF_ARC_CPU_GENERIC)
+    elf_elfheader (abfd)->e_flags |= val;
 
-  elf_elfheader (abfd)->e_flags &= ~EF_ARC_MACH;
-  elf_elfheader (abfd)->e_flags |= val;
   elf_elfheader (abfd)->e_machine = emf;
+
   /* Record whatever is the current syscall ABI version.  */
   elf_elfheader (abfd)->e_flags |= E_ARC_OSABI_CURRENT;
 }
@@ -1319,14 +1320,24 @@ elf_arc_relocate_section (bfd *            output_bfd,
                }
              else if (is_reloc_for_PLT (howto))
                {
+                 /* Fail if it is linking for PIE and the symbol is
+                    undefined.  */
+                 if (bfd_link_executable (info)
+                     && !(*info->callbacks->undefined_symbol)
+                       (info, h->root.root.string, input_bfd, input_section,
+                        rel->r_offset, TRUE))
+                   {
+                     return FALSE;
+                   }
                  reloc_data.sym_value = h->plt.offset;
                  reloc_data.sym_section = htab->splt;
 
                  reloc_data.should_relocate = TRUE;
                }
-             else if (!(*info->callbacks->undefined_symbol)
+             else if (!bfd_link_pic (info)
+                      && !(*info->callbacks->undefined_symbol)
                       (info, h->root.root.string, input_bfd, input_section,
-                       rel->r_offset,!bfd_link_pic (info)))
+                       rel->r_offset, TRUE))
                {
                  return FALSE;
                }
@@ -1443,7 +1454,7 @@ elf_arc_relocate_section (bfd *              output_bfd,
          case R_ARC_32_ME:
          case R_ARC_PC32:
          case R_ARC_32_PCREL:
-           if (bfd_link_pic (info)
+           if (bfd_link_pic (info) && !bfd_link_pie (info)
                && ((r_type != R_ARC_PC32 && r_type != R_ARC_32_PCREL)
                    || (h != NULL
                        && h->dynindx != -1
@@ -1509,6 +1520,11 @@ elf_arc_relocate_section (bfd *             output_bfd,
                    else
                      {
                        BFD_ASSERT (h->dynindx != -1);
+
+                       /* This type of dynamic relocation cannot be created
+                          for code sections.  */
+                       BFD_ASSERT ((input_section->flags & SEC_CODE) == 0);
+
                        if ((input_section->flags & SEC_ALLOC) != 0)
                          relocate = FALSE;
                        else
@@ -1715,7 +1731,7 @@ elf_arc_check_relocs (bfd *                        abfd,
            /* FALLTHROUGH */
          case R_ARC_PC32:
          case R_ARC_32_PCREL:
-           if (bfd_link_pic (info)
+           if (bfd_link_pic (info) && !bfd_link_pie (info)
                && ((r_type != R_ARC_PC32 && r_type != R_ARC_32_PCREL)
                    || (h != NULL
                        && h->dynindx != -1
index 5faa925ca94095fdb02ded55fdc38f5a128bdb93..1815655183384f94154a417f5af1eb60db4777b5 100644 (file)
@@ -1,3 +1,7 @@
+2016-02-29  Claudiu Zissulescu  <Claudiu.Zissulescu@synopsys.com>
+
+       * config/tc-arc.c: Enable code density instructions for ARC EM.
+
 2016-02-26  H.J. Lu  <hongjiu.lu@intel.com>
 
        PR ld/19645
index 82cff9aebd8300e35fb94c150a1642986f459143..70a47f9d4b1786e6bc6ad6e048fddc5c2dec2e1c 100644 (file)
@@ -343,7 +343,7 @@ static const struct cpu_type
   { "arc700", ARC_OPCODE_ARC700,  bfd_mach_arc_arc700,
     E_ARC_MACH_ARC700,  0x00},
   { "arcem",  ARC_OPCODE_ARCv2EM, bfd_mach_arc_arcv2,
-    EF_ARC_CPU_ARCV2EM, 0x00},
+    EF_ARC_CPU_ARCV2EM, ARC_CD},
   { "archs",  ARC_OPCODE_ARCv2HS, bfd_mach_arc_arcv2,
     EF_ARC_CPU_ARCV2HS, ARC_CD},
   { "all",    ARC_OPCODE_BASE,    bfd_mach_arc_arcv2,
index 24a913fd275f7ddacffbea348304ea1b395857d7..e24a457e49c422d69ee2829ad7ca6d649d0c8fac 100644 (file)
@@ -1,3 +1,8 @@
+2016-02-29  Cupertino Miranda  <Cupertino.Miranda@synopsys.com>
+
+       * scripttempl/arclinux.sc: Force .tdata and .tbss to always be
+       generated.
+
 2016-02-26  Renlin Li  <renlin.li@arm.com>
 
        * testsuite/ld-aarch64/aarch64-elf.exp: Run new testcases.
index 9d43ca31cbb1c7893433f36e68c92c8f5d7b4322..bef5336fb7e4f9832174664923d53b04f25119cb 100644 (file)
@@ -326,8 +326,8 @@ cat <<EOF
   .data1        ${RELOCATING-0} : { *(.data1) }
   /* TLS local dynamic uses .tdata as a reference point.  */
   ${RELOCATING+${CREATE_SHLIB+PROVIDE_HIDDEN (.tdata = .);}}
-  .tdata       ${RELOCATING-0} : { *(.tdata${RELOCATING+ .tdata.* .gnu.linkonce.td.*}) }
-  .tbss                ${RELOCATING-0} : { *(.tbss${RELOCATING+ .tbss.* .gnu.linkonce.tb.*})${RELOCATING+ *(.tcommon)} }
+  .tdata       ${RELOCATING-0} : { PROVIDE_HIDDEN(.tdata = .); *(.tdata${RELOCATING+ .tdata.* .gnu.linkonce.td.*}) }
+  .tbss                ${RELOCATING-0} : { PROVIDE_HIDDEN(.tbss = .); *(.tbss${RELOCATING+ .tbss.* .gnu.linkonce.tb.*})${RELOCATING+ *(.tcommon)} }
   .eh_frame     ${RELOCATING-0} : { KEEP (*(.eh_frame)) }
   .gcc_except_table ${RELOCATING-0} : { *(.gcc_except_table) }
   ${WRITABLE_RODATA+${RODATA}}
This page took 0.032092 seconds and 4 git commands to generate.