This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[gold][patch] Fix comdat handling in replacement LTO objects


The gold plugin support did not expect replacement objects coming from
the LTO plugin to have comdat groups/linkonce sections in them, and
would discard any such comdat groups as duplicates of those originally
seen in the claimed plugin object. That turns out not to have been a
reasonable expectation, and it also complicates testing (we couldn't
just pass a sample object straight through a plugin). This patch
allows a comdat from a replacement file to override a comdat first
seen in a plugin file.

OK?

-cary


	* layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
	object to override a kept COMDAT group from a plugin object.


Index: layout.cc
===================================================================
RCS file: /cvs/src/src/gold/layout.cc,v
retrieving revision 1.114
diff -u -p -r1.114 layout.cc
--- layout.cc	5 Dec 2008 21:13:35 -0000	1.114
+++ layout.cc	9 Dec 2008 23:35:04 -0000
@@ -47,6 +47,7 @@
 #include "reloc.h"
 #include "descriptors.h"
 #include "layout.h"
+#include "plugin.h"

 namespace gold
 {
@@ -2959,6 +2960,14 @@ Layout::add_comdat(Relobj* object, unsig
   if (ins.first->second.group_)
     {
       // We've already seen a real section group with this signature.
+      // If the kept group is from a plugin object, and we're in
+      // the replacement phase, accept the new one as a replacement.
+      if (ins.first->second.object_ == NULL
+          && parameters->options().plugins()->in_replacement_phase())
+        {
+          ins.first->second = kept;
+          return true;
+        }
       return false;
     }
   else if (group)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]