This is the mail archive of the 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


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)

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?


2012-08-21  Cary Coutant  <>

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

diff --git a/gold/ b/gold/
index 1e31cce..db6b6ac 100644
--- a/gold/
+++ b/gold/
@@ -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]