summaryrefslogtreecommitdiff
blob: 518284188fbd943c5722f7305899d5babbf460e7 (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
2003-08-05  Jakub Jelinek  <jakub@redhat.com>

	* emultempl/elf32.em (gld${EMULATION_NAME}_place_orphan): If secname
	is in the linker script but os->bfd_section is NULL, use
	output_prev_sec_find to place it on the right place in the section
	list.
	* emulparams/elf64ppc.sh (OTHER_GOT_RELOC_SECTIONS): Add .rela.opd.

--- ld/emulparams/elf64ppc.sh.jj	2003-07-28 10:24:45.000000000 -0400
+++ ld/emulparams/elf64ppc.sh	2003-08-05 08:35:58.000000000 -0400
@@ -28,7 +28,8 @@ else
   .toc		0 : { *(.toc) }"
 fi
 OTHER_GOT_RELOC_SECTIONS="
-  .rela.toc	${RELOCATING-0} : { *(.rela.toc) }"
+  .rela.toc	${RELOCATING-0} : { *(.rela.toc) }
+  .rela.opd	${RELOCATING-0} : { *(.rela.opd) }"
 OTHER_READWRITE_SECTIONS="
   .toc1		${RELOCATING-0}${RELOCATING+ALIGN(8)} : { *(.toc1) }
   .opd		${RELOCATING-0}${RELOCATING+ALIGN(8)} : { KEEP (*(.opd)) }"
--- ld/emultempl/elf32.em.jj	2003-08-05 06:59:49.000000000 -0400
+++ ld/emultempl/elf32.em	2003-08-05 08:27:23.000000000 -0400
@@ -1138,7 +1138,27 @@ gld${EMULATION_NAME}_place_orphan (lang_
 	{
 	  /* We already have an output section statement with this
 	     name, and its bfd section, if any, has compatible flags.  */
-	  lang_add_section (&os->children, s, os, file);
+	  if (os->bfd_section != NULL)
+	    lang_add_section (&os->children, s, os, file);
+	  else
+	    {
+	      asection *prev_section = output_prev_sec_find (os);
+	      lang_add_section (&os->children, s, os, file);
+	      if (prev_section != NULL)
+		{
+		  asection *snew = os->bfd_section, **pps;
+
+		  /* Unlink the section.  */
+		  for (pps = &output_bfd->sections; *pps != snew;
+		       pps = &(*pps)->next)
+		    ;
+		  bfd_section_list_remove (output_bfd, pps);
+
+		  /* Now tack it on to the "os" section list.  */
+		  bfd_section_list_insert (output_bfd, &prev_section->next,
+					   snew);
+		}
+	    }
 	  return TRUE;
 	}
     }