public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [Bug15639][ARM]  gold and -flto always fails with an internal error on arm-linux-gnueabi*
@ 2014-01-29 11:27 Kugan
  2014-02-18  6:43 ` Kugan
       [not found] ` <CAH9SEo6WWhKyVJ22io5gbifxWyNUVQPMzRpu1--ds_pyrbwwSQ@mail.gmail.com>
  0 siblings, 2 replies; 5+ messages in thread
From: Kugan @ 2014-01-29 11:27 UTC (permalink / raw)
  To: binutils; +Cc: patches

[-- Attachment #1: Type: text/plain, Size: 528 bytes --]

Hi,

In Sized_relobj_file<size,
big_endian>::do_layout_deferred_sections(Layout* layout), while reading
.eh_frame, Arm_relobj<big_endian>::do_read_symbols(Read_symbols_data*
sd) is called second time around and this triggering the assert.

This patch removes the assert and skips reading if this section is
already read.

Is this OK?

Thanks,
Kugan


gold/
+2014-01-29  Kugan Vivekanandarajah  <kuganv@linaro.org>
+
+	* arm.cc (Arm_relobj<big_endian>::do_read_symbols): Skip reading
+	.ARM.attributes section if already read.
+

[-- Attachment #2: p1.txt --]
[-- Type: text/plain, Size: 645 bytes --]

diff --git a/gold/arm.cc b/gold/arm.cc
index 560f380..4588b94 100644
--- a/gold/arm.cc
+++ b/gold/arm.cc
@@ -6729,9 +6729,9 @@ Arm_relobj<big_endian>::do_read_symbols(Read_symbols_data* sd)
 	// be conservative.
 	must_merge_flags_and_attributes = true;
 
-      if (shdr.get_sh_type() == elfcpp::SHT_ARM_ATTRIBUTES)
+      if ((shdr.get_sh_type() == elfcpp::SHT_ARM_ATTRIBUTES)
+	  && (this->attributes_section_data_ == NULL))
 	{
-	  gold_assert(this->attributes_section_data_ == NULL);
 	  section_offset_type section_offset = shdr.get_sh_offset();
 	  section_size_type section_size =
 	    convert_to_section_size_type(shdr.get_sh_size());

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

* Re: [Bug15639][ARM]  gold and -flto always fails with an internal error on arm-linux-gnueabi*
  2014-01-29 11:27 [Bug15639][ARM] gold and -flto always fails with an internal error on arm-linux-gnueabi* Kugan
@ 2014-02-18  6:43 ` Kugan
  2014-07-04 14:44   ` Will Newton
       [not found] ` <CAH9SEo6WWhKyVJ22io5gbifxWyNUVQPMzRpu1--ds_pyrbwwSQ@mail.gmail.com>
  1 sibling, 1 reply; 5+ messages in thread
From: Kugan @ 2014-02-18  6:43 UTC (permalink / raw)
  To: binutils; +Cc: ccoutant



On 29/01/14 22:27, Kugan wrote:
> Hi,
> 
> In Sized_relobj_file<size,
> big_endian>::do_layout_deferred_sections(Layout* layout), while reading
> .eh_frame, Arm_relobj<big_endian>::do_read_symbols(Read_symbols_data*
> sd) is called second time around and this triggering the assert.
> 
> This patch removes the assert and skips reading if this section is
> already read.
> 
> Is this OK?
> 
> Thanks,
> Kugan
> 
> 
> gold/
> +2014-01-29  Kugan Vivekanandarajah  <kuganv@linaro.org>
> +
> +	* arm.cc (Arm_relobj<big_endian>::do_read_symbols): Skip reading
> +	.ARM.attributes section if already read.
> +
> 

ping ?

Thanks,
Kugan

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

* Re: [Bug15639][ARM] gold and -flto always fails with an internal error on arm-linux-gnueabi*
  2014-02-18  6:43 ` Kugan
@ 2014-07-04 14:44   ` Will Newton
  0 siblings, 0 replies; 5+ messages in thread
From: Will Newton @ 2014-07-04 14:44 UTC (permalink / raw)
  To: Kugan; +Cc: binutils, ccoutant

On 18 February 2014 06:43, Kugan <kugan.vivekanandarajah@linaro.org> wrote:
>
>
> On 29/01/14 22:27, Kugan wrote:
>> Hi,
>>
>> In Sized_relobj_file<size,
>> big_endian>::do_layout_deferred_sections(Layout* layout), while reading
>> .eh_frame, Arm_relobj<big_endian>::do_read_symbols(Read_symbols_data*
>> sd) is called second time around and this triggering the assert.
>>
>> This patch removes the assert and skips reading if this section is
>> already read.
>>
>> Is this OK?
>>
>> Thanks,
>> Kugan
>>
>>
>> gold/
>> +2014-01-29  Kugan Vivekanandarajah  <kuganv@linaro.org>
>> +
>> +     * arm.cc (Arm_relobj<big_endian>::do_read_symbols): Skip reading
>> +     .ARM.attributes section if already read.
>> +
>>
>
> ping ?

Another ping for this old patch. Does anybody have any comments?

Thanks,

-- 
Will Newton
Toolchain Working Group, Linaro

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

* Re: [Bug15639][ARM] gold and -flto always fails with an internal error on arm-linux-gnueabi*
       [not found] ` <CAH9SEo6WWhKyVJ22io5gbifxWyNUVQPMzRpu1--ds_pyrbwwSQ@mail.gmail.com>
@ 2014-07-07 17:23   ` Cary Coutant
  2014-07-08  9:28     ` Will Newton
  0 siblings, 1 reply; 5+ messages in thread
From: Cary Coutant @ 2014-07-07 17:23 UTC (permalink / raw)
  To: Doug Kwan (關振德); +Cc: Kugan, binutils, patches

[-- Attachment #1: Type: text/plain, Size: 1737 bytes --]

My apologies -- I must have missed this patch (and your ping).

My first reaction is that we probably shouldn't be calling the Target
version of do_read_symbols from do_layout_deferred_sections. This same
problem could occur on other targets that have an override of
do_read_symbols.

I'd suggest instead factoring out the body of
Sized_relobj_file::do_read_symbols() into a non-virtual, protected,
method Sized_relobj_file::base_read_symbols(), and have
Sized_relobj_file::do_read_symbols() call it. Then call that instead
of read_symbols() from do_layout_deferred_sections(). The
target-specific overrides of do_read_symbols() should also call the
new method directly instead of calling the base class'
do_read_symbols().

Could you give the attached patch a try and see if it fixes your problem?

-cary


On Fri, Jul 4, 2014 at 2:47 PM, Doug Kwan (關振德) <dougkwan@google.com> wrote:
> Looks good to me.  I don't have approval power.  Cary, could you approval
> this?
>
> -Doug
>
>
> On Wed, Jan 29, 2014 at 3:27 AM, Kugan <kugan.vivekanandarajah@linaro.org>
> wrote:
>>
>> Hi,
>>
>> In Sized_relobj_file<size,
>> big_endian>::do_layout_deferred_sections(Layout* layout), while reading
>> .eh_frame, Arm_relobj<big_endian>::do_read_symbols(Read_symbols_data*
>> sd) is called second time around and this triggering the assert.
>>
>> This patch removes the assert and skips reading if this section is
>> already read.
>>
>> Is this OK?
>>
>> Thanks,
>> Kugan
>>
>>
>> gold/
>> +2014-01-29  Kugan Vivekanandarajah  <kuganv@linaro.org>
>> +
>> +       * arm.cc (Arm_relobj<big_endian>::do_read_symbols): Skip reading
>> +       .ARM.attributes section if already read.
>> +
>
>

[-- Attachment #2: arm-lto-patch.txt --]
[-- Type: text/plain, Size: 6030 bytes --]

commit bc0b896929c1cc8735f391b82940f5e46f38dcb9
Author: Cary Coutant <ccoutant@google.com>
Date:   Mon Jul 7 10:14:45 2014 -0700

    Fix internal error with LTO on ARM.
    
    This prevents the target-specific do_read_symbols methods from being called
    twice when do_layout_deferred_sections needs to layout an .eh_frame section.
    
    gold/
    	* dynobj.h (Sized_dynobj::base_read_symbols): New method.
    	* dynobj.cc (Sized_dynobj::do_read_symbols): Move body to...
    	(Sized_dynobj::base_read_symbols): ...new method.
    	* object.h (Sized_relobj_file::base_read_symbols): New method.
    	* object.cc (Sized_relobj_file::do_read_symbols): Move body to...
    	(Sized_relobj_file::base_read_symbols): ...new method.
    	* arm.cc (Arm_relobj::do_read_symbols): Call base_read_symbols.
    	* mips.cc: (Mips_relobj::do_read_symbols): Likewise.
    	* powerpc.cc (Powerpc_dynobj::do_read_symbols): Likewise.

diff --git a/gold/arm.cc b/gold/arm.cc
index 607f9d6..6c472bb 100644
--- a/gold/arm.cc
+++ b/gold/arm.cc
@@ -6683,7 +6683,7 @@ void
 Arm_relobj<big_endian>::do_read_symbols(Read_symbols_data* sd)
 {
   // Call parent class to read symbol information.
-  Sized_relobj_file<32, big_endian>::do_read_symbols(sd);
+  this->base_read_symbols(sd);
 
   // If this input file is a binary file, it has no processor
   // specific flags and attributes section.
@@ -6974,7 +6974,7 @@ void
 Arm_dynobj<big_endian>::do_read_symbols(Read_symbols_data* sd)
 {
   // Call parent class to read symbol information.
-  Sized_dynobj<32, big_endian>::do_read_symbols(sd);
+  this->base_read_symbols(sd);
 
   // Read processor-specific flags in ELF file header.
   const unsigned char* pehdr = this->get_view(elfcpp::file_header_offset,
diff --git a/gold/dynobj.cc b/gold/dynobj.cc
index 2a1b9a3..baf8489 100644
--- a/gold/dynobj.cc
+++ b/gold/dynobj.cc
@@ -336,6 +336,17 @@ template<int size, bool big_endian>
 void
 Sized_dynobj<size, big_endian>::do_read_symbols(Read_symbols_data* sd)
 {
+  this->base_read_symbols(sd);
+}
+
+// Read the symbols and sections from a dynamic object.  We read the
+// dynamic symbols, not the normal symbols.  This is common code for
+// all target-specific overrides of do_read_symbols().
+
+template<int size, bool big_endian>
+void
+Sized_dynobj<size, big_endian>::base_read_symbols(Read_symbols_data* sd)
+{
   this->read_section_data(&this->elf_file_, sd);
 
   const unsigned char* const pshdrs = sd->section_headers->data();
diff --git a/gold/dynobj.h b/gold/dynobj.h
index b8d4b90..03b8053 100644
--- a/gold/dynobj.h
+++ b/gold/dynobj.h
@@ -270,6 +270,12 @@ class Sized_dynobj : public Dynobj
   do_get_global_symbols() const
   { return this->symbols_; }
 
+ protected:
+  // Read the symbols.  This is common code for all target-specific
+  // overrides of do_read_symbols().
+  void
+  base_read_symbols(Read_symbols_data*);
+
  private:
   // For convenience.
   typedef Sized_dynobj<size, big_endian> This;
diff --git a/gold/mips.cc b/gold/mips.cc
index 50d0227..450883e 100644
--- a/gold/mips.cc
+++ b/gold/mips.cc
@@ -5857,7 +5857,7 @@ void
 Mips_relobj<size, big_endian>::do_read_symbols(Read_symbols_data* sd)
 {
   // Call parent class to read symbol information.
-  Sized_relobj_file<size, big_endian>::do_read_symbols(sd);
+  this->base_read_symbols(sd);
 
   // Read processor-specific flags in ELF file header.
   const unsigned char* pehdr = this->get_view(elfcpp::file_header_offset,
diff --git a/gold/object.cc b/gold/object.cc
index c894c13..1811cda 100644
--- a/gold/object.cc
+++ b/gold/object.cc
@@ -755,6 +755,16 @@ template<int size, bool big_endian>
 void
 Sized_relobj_file<size, big_endian>::do_read_symbols(Read_symbols_data* sd)
 {
+  this->base_read_symbols(sd);
+}
+
+// Read the sections and symbols from an object file.  This is common
+// code for all target-specific overrides of do_read_symbols().
+
+template<int size, bool big_endian>
+void
+Sized_relobj_file<size, big_endian>::base_read_symbols(Read_symbols_data* sd)
+{
   this->read_section_data(&this->elf_file_, sd);
 
   const unsigned char* const pshdrs = sd->section_headers->data();
@@ -1848,7 +1858,7 @@ Sized_relobj_file<size, big_endian>::do_layout_deferred_sections(Layout* layout)
 
 	  // Reading the symbols again here may be slow.
 	  Read_symbols_data sd;
-	  this->read_symbols(&sd);
+	  this->base_read_symbols(&sd);
 	  this->layout_eh_frame_section(layout,
 					sd.symbols->data(),
 					sd.symbols_size,
diff --git a/gold/object.h b/gold/object.h
index 38b06f0..92cdbdd 100644
--- a/gold/object.h
+++ b/gold/object.h
@@ -2214,6 +2214,11 @@ class Sized_relobj_file : public Sized_relobj<size, big_endian>
   void
   do_read_symbols(Read_symbols_data*);
 
+  // Read the symbols.  This is common code for all target-specific
+  // overrides of do_read_symbols.
+  void
+  base_read_symbols(Read_symbols_data*);
+
   // Return the value of a local symbol.
   uint64_t
   do_local_symbol_value(unsigned int symndx, uint64_t addend) const
diff --git a/gold/powerpc.cc b/gold/powerpc.cc
index 96432ed..0a9ab7d 100644
--- a/gold/powerpc.cc
+++ b/gold/powerpc.cc
@@ -1839,7 +1839,7 @@ template<int size, bool big_endian>
 void
 Powerpc_relobj<size, big_endian>::do_read_symbols(Read_symbols_data* sd)
 {
-  Sized_relobj_file<size, big_endian>::do_read_symbols(sd);
+  this->base_read_symbols(sd);
   if (size == 64)
     {
       const int shdr_size = elfcpp::Elf_sizes<size>::shdr_size;
@@ -1896,14 +1896,14 @@ Powerpc_dynobj<size, big_endian>::set_abiversion(int ver)
     }
 }
 
-// Call Sized_dynobj::do_read_symbols to read the symbols then
+// Call Sized_dynobj::base_read_symbols to read the symbols then
 // read .opd from a dynamic object, filling in opd_ent_ vector,
 
 template<int size, bool big_endian>
 void
 Powerpc_dynobj<size, big_endian>::do_read_symbols(Read_symbols_data* sd)
 {
-  Sized_dynobj<size, big_endian>::do_read_symbols(sd);
+  this->base_read_symbols(sd);
   if (size == 64)
     {
       const int shdr_size = elfcpp::Elf_sizes<size>::shdr_size;

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

* Re: [Bug15639][ARM] gold and -flto always fails with an internal error on arm-linux-gnueabi*
  2014-07-07 17:23   ` Cary Coutant
@ 2014-07-08  9:28     ` Will Newton
  0 siblings, 0 replies; 5+ messages in thread
From: Will Newton @ 2014-07-08  9:28 UTC (permalink / raw)
  To: Cary Coutant
  Cc: Doug Kwan (關振德), Kugan, binutils, patches

On 7 July 2014 18:22, Cary Coutant <ccoutant@google.com> wrote:
> My apologies -- I must have missed this patch (and your ping).
>
> My first reaction is that we probably shouldn't be calling the Target
> version of do_read_symbols from do_layout_deferred_sections. This same
> problem could occur on other targets that have an override of
> do_read_symbols.
>
> I'd suggest instead factoring out the body of
> Sized_relobj_file::do_read_symbols() into a non-virtual, protected,
> method Sized_relobj_file::base_read_symbols(), and have
> Sized_relobj_file::do_read_symbols() call it. Then call that instead
> of read_symbols() from do_layout_deferred_sections(). The
> target-specific overrides of do_read_symbols() should also call the
> new method directly instead of calling the base class'
> do_read_symbols().
>
> Could you give the attached patch a try and see if it fixes your problem?

Yes, this fixes the problem for me. Thanks!

> -cary
>
>
> On Fri, Jul 4, 2014 at 2:47 PM, Doug Kwan (關振德) <dougkwan@google.com> wrote:
>> Looks good to me.  I don't have approval power.  Cary, could you approval
>> this?
>>
>> -Doug
>>
>>
>> On Wed, Jan 29, 2014 at 3:27 AM, Kugan <kugan.vivekanandarajah@linaro.org>
>> wrote:
>>>
>>> Hi,
>>>
>>> In Sized_relobj_file<size,
>>> big_endian>::do_layout_deferred_sections(Layout* layout), while reading
>>> .eh_frame, Arm_relobj<big_endian>::do_read_symbols(Read_symbols_data*
>>> sd) is called second time around and this triggering the assert.
>>>
>>> This patch removes the assert and skips reading if this section is
>>> already read.
>>>
>>> Is this OK?
>>>
>>> Thanks,
>>> Kugan
>>>
>>>
>>> gold/
>>> +2014-01-29  Kugan Vivekanandarajah  <kuganv@linaro.org>
>>> +
>>> +       * arm.cc (Arm_relobj<big_endian>::do_read_symbols): Skip reading
>>> +       .ARM.attributes section if already read.
>>> +
>>
>>



-- 
Will Newton
Toolchain Working Group, Linaro

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

end of thread, other threads:[~2014-07-08  9:28 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-29 11:27 [Bug15639][ARM] gold and -flto always fails with an internal error on arm-linux-gnueabi* Kugan
2014-02-18  6:43 ` Kugan
2014-07-04 14:44   ` Will Newton
     [not found] ` <CAH9SEo6WWhKyVJ22io5gbifxWyNUVQPMzRpu1--ds_pyrbwwSQ@mail.gmail.com>
2014-07-07 17:23   ` Cary Coutant
2014-07-08  9:28     ` Will Newton

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).