bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug ld/16345] ld emits errors on .eh_frame from partial linking


From: hjl.tools at gmail dot com
Subject: [Bug ld/16345] ld emits errors on .eh_frame from partial linking
Date: Fri, 20 Dec 2013 13:42:00 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=16345

--- Comment #2 from H.J. Lu <hjl.tools at gmail dot com> ---
Both .init and .fini sections are special.  This
patch warns about using "ld -r" on them:

diff --git a/ld/emultempl/elf32.em b/ld/emultempl/elf32.em
index 9a2fe89..098f423 100644
--- a/ld/emultempl/elf32.em
+++ b/ld/emultempl/elf32.em
@@ -1114,7 +1114,20 @@ gld${EMULATION_NAME}_after_open (void)
     }

   if (link_info.relocatable)
-    return;
+    {
+      bfd *abfd;
+
+      for (abfd = link_info.input_bfds; abfd; abfd = abfd->link_next)
+    {
+      if (bfd_get_section_by_name (abfd, ".init"))
+        einfo ("%P: warning: -r on %B with .init section may lead"
+           " to incorrect output.\n", abfd);
+      if (bfd_get_section_by_name (abfd, ".fini"))
+        einfo ("%P: warning: -r on %B with .fini section may lead"
+           " to incorrect output.\n", abfd);
+    }
+      return;
+    }

   if (link_info.eh_frame_hdr
       && !link_info.traditional_format)

-- 
You are receiving this mail because:
You are on the CC list for the bug.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]