summaryrefslogtreecommitdiff
path: root/toolchain/binutils/patches/arc-2016.09-release/openadk_binutils_fix.patch
blob: d54fb1667775ae886507eba3f60cb2c36c3f0f45 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
diff --git a/bfd/elf32-arc.c b/bfd/elf32-arc.c
index fba58cb..d99da93 100644
--- a/bfd/elf32-arc.c
+++ b/bfd/elf32-arc.c
@@ -70,13 +70,7 @@ name_for_global_symbol (struct elf_link_hash_entry *h)
 struct dynamic_sections
 {
   bfd_boolean	  initialized;
-  asection *      sgot;
-  asection *      srelgot;
-  asection *      sgotplt;
-  asection *      srelgotplt;
   asection *      sdyn;
-  asection *      splt;
-  asection *      srelplt;
 };
 
 enum dyn_section_types
@@ -1578,13 +1572,7 @@ arc_create_dynamic_sections (bfd * abfd, struct bfd_link_info *info)
   struct dynamic_sections ds =
     {
       .initialized = FALSE,
-      .sgot = NULL,
-      .srelgot = NULL,
-      .sgotplt = NULL,
-      .srelgotplt = NULL,
       .sdyn = NULL,
-      .splt = NULL,
-      .srelplt = NULL
     };
 
   htab = elf_hash_table (info);
@@ -1592,7 +1580,7 @@ arc_create_dynamic_sections (bfd * abfd, struct bfd_link_info *info)
 
   /* Create dynamic sections for relocatable executables so that we
      can copy relocations.  */
-  if (! htab->dynamic_sections_created && bfd_link_pic (info))
+  if (! htab->dynamic_sections_created)
     {
       if (! _bfd_elf_link_create_dynamic_sections (abfd, info))
 	BFD_ASSERT (0);
@@ -1600,18 +1588,6 @@ arc_create_dynamic_sections (bfd * abfd, struct bfd_link_info *info)
 
   dynobj = (elf_hash_table (info))->dynobj;
 
-  if (dynobj)
-    {
-      ds.sgot = htab->sgot;
-      ds.srelgot = htab->srelgot;
-
-      ds.sgotplt = bfd_get_section_by_name (dynobj, ".got.plt");
-      ds.srelgotplt = ds.srelplt;
-
-      ds.splt = bfd_get_section_by_name (dynobj, ".plt");
-      ds.srelplt = bfd_get_section_by_name (dynobj, ".rela.plt");
-    }
-
   if (htab->dynamic_sections_created)
     {
       ds.sdyn = bfd_get_section_by_name (dynobj, ".dynamic");
@@ -1634,10 +1610,20 @@ elf_arc_check_relocs (bfd *			 abfd,
   const Elf_Internal_Rela *	rel_end;
   bfd *				dynobj;
   asection *			sreloc = NULL;
+  struct elf_link_hash_table *	htab = elf_hash_table (info);
 
   if (bfd_link_relocatable (info))
     return TRUE;
 
+  if (htab->dynobj == NULL)
+    htab->dynobj = abfd;
+
+  if (! htab->dynamic_sections_created)
+    {
+      if (! _bfd_elf_link_create_dynamic_sections (abfd, info))
+	return FALSE;
+    }
+
   dynobj = (elf_hash_table (info))->dynobj;
   symtab_hdr = &((elf_tdata (abfd))->symtab_hdr);
   sym_hashes = elf_sym_hashes (abfd);
@@ -1659,15 +1645,6 @@ elf_arc_check_relocs (bfd *			 abfd,
 	}
       howto = arc_elf_howto (r_type);
 
-      if (dynobj == NULL
-	  && (is_reloc_for_GOT (howto) == TRUE
-	      || is_reloc_for_TLS (howto) == TRUE))
-	{
-	  dynobj = elf_hash_table (info)->dynobj = abfd;
-	  if (! _bfd_elf_create_got_section (abfd, info))
-	    return FALSE;
-	}
-
       /* Load symbol information.  */
       r_symndx = ELF32_R_SYM (rel->r_info);
       if (r_symndx < symtab_hdr->sh_info) /* Is a local symbol.  */