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 internal error with --emit-relocs and SHT_GROUP sections


Ian,

The --emit-relocs option causes an assert when an SHT_GROUP section
makes its way down to Layout::include_section. As far as I can tell,
it really ought to expect that case. Back in
Sized_relobj_file::do_layout, we have this check:

      if (relocatable && shdr.get_sh_type() == elfcpp::SHT_GROUP)
	continue;

which will skip Layout::layout for GROUP sections if -r is given, but
falls on through for --emit-relocs. I don't see any reason why
SHT_GROUP sections should be processed any differently at that point
for vanilla links than for --emit-relocs links, so I think the right
thing to do is simply adjust the assert. I tried linking the Linux
kernel with this patch, and the output looks reasonable.

What do you think?

-cary


2012-08-21  Cary Coutant  <ccoutant@google.com>

gold/
	* layout.cc (Layout::include_section): Don't assert on GROUP
	sections with --emit-relocs.


diff --git a/gold/layout.cc b/gold/layout.cc
index 1e31cce..db6b6ac 100644
--- a/gold/layout.cc
+++ b/gold/layout.cc
@@ -606,8 +606,7 @@ Layout::include_section(Sized_relobj_file<size,
big_endian>*, const char* name,
     case elfcpp::SHT_GROUP:
       // If we are emitting relocations these should be handled
       // elsewhere.
-      gold_assert(!parameters->options().relocatable()
-                 && !parameters->options().emit_relocs());
+      gold_assert(!parameters->options().relocatable());
       return false;

     case elfcpp::SHT_PROGBITS:


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