public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Create ".dynamic" section earlier
@ 2006-06-09 14:43 Fred Fish
  2006-06-09 15:38 ` H. J. Lu
  0 siblings, 1 reply; 6+ messages in thread
From: Fred Fish @ 2006-06-09 14:43 UTC (permalink / raw)
  To: binutils; +Cc: fnf

When testing gdb for various mips*-elf toolchains I'm getting link errors like the following
edited message:

  gdb compile failed, ld: gdb1555.so: The first section in the PT_DYNAMIC segment is not the .dynamic section
  ld: final link failed: Bad value
  collect2: ld returned 1 exit status

Attached is a patch that fixes it, though I'm not sure it is the best
way to handle the issue.

-Fred

2006-06-05  Fred Fish  <fnf@specifix.com>

	* elflink.c (_bfd_elf_link_create_dynamic_sections): Create
	the ".dynamic" section earlier, so it ends up as the first
	section in the PT_DYNAMIC segment, a condition enforced by
	the linker.

Index: binutils/bfd/elflink.c
===================================================================
RCS file: /cvsroots/latest/src/binutils/bfd/elflink.c,v
retrieving revision 1.1.1.16
diff -u -p -r1.1.1.16 elflink.c
--- binutils/bfd/elflink.c	28 May 2006 10:10:47 -0000	1.1.1.16
+++ binutils/bfd/elflink.c	5 Jun 2006 16:39:06 -0000
@@ -215,6 +215,11 @@ _bfd_elf_link_create_dynamic_sections (b
       || ! bfd_set_section_alignment (abfd, s, bed->s->log_file_align))
     return FALSE;
 
+  s = bfd_make_section_with_flags (abfd, ".dynamic", flags);
+  if (s == NULL
+      || ! bfd_set_section_alignment (abfd, s, bed->s->log_file_align))
+    return FALSE;
+
   s = bfd_make_section_with_flags (abfd, ".dynsym",
 				   flags | SEC_READONLY);
   if (s == NULL
@@ -226,11 +231,6 @@ _bfd_elf_link_create_dynamic_sections (b
   if (s == NULL)
     return FALSE;
 
-  s = bfd_make_section_with_flags (abfd, ".dynamic", flags);
-  if (s == NULL
-      || ! bfd_set_section_alignment (abfd, s, bed->s->log_file_align))
-    return FALSE;
-
   /* The special symbol _DYNAMIC is always set to the start of the
      .dynamic section.  We could set _DYNAMIC in a linker script, but we
      only want to define it if we are, in fact, creating a .dynamic


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2006-06-09 18:28 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-06-09 14:43 [PATCH] Create ".dynamic" section earlier Fred Fish
2006-06-09 15:38 ` H. J. Lu
2006-06-09 15:46   ` Fred Fish
2006-06-09 16:53     ` H. J. Lu
2006-06-09 17:08       ` Fred Fish
2006-06-09 19:16     ` Daniel Jacobowitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).