public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [gold patch obvious] Fix problem where TEXTREL is set incorrectly
@ 2010-12-23 23:27 Cary Coutant
  2010-12-24  3:40 ` Ian Lance Taylor
  0 siblings, 1 reply; 2+ messages in thread
From: Cary Coutant @ 2010-12-23 23:27 UTC (permalink / raw)
  To: Binutils, Ian Lance Taylor

When a TLS_GD relocation is seen (and not optimized), gold creates a
pair of GOT entries with dynamic relocations, but sets the
has_dynamic_reloc flag on the section which is the target of the
relocation rather than the GOT section where the relocation applies.
This causes gold to set the TEXTREL flag in the dynamic table even
though the text segment has no dynamic relocations.

I will commit the following patch as obvious and trivial. (The missing
Output_data* parameter from the second form of the function was
undetected previously because that form is never called.)

-cary

        * output.h (Output_data_reloc::add_output_section): Pass OD instead
        of OS to this->add.  Add OD parameter to second form of the function.


Index: output.h
===================================================================
RCS file: /cvs/src/src/gold/output.h,v
retrieving revision 1.117
diff -u -p -r1.117 output.h
--- output.h	16 Nov 2010 19:18:31 -0000	1.117
+++ output.h	23 Dec 2010 19:42:15 -0000
@@ -1789,13 +1789,13 @@ class Output_data_reloc<elfcpp::SHT_RELA
   void
   add_output_section(Output_section* os, unsigned int type, Output_data* od,
 		     Address address, Addend addend)
-  { this->add(os, Output_reloc_type(os, type, od, address, addend)); }
+  { this->add(od, Output_reloc_type(os, type, od, address, addend)); }

   void
-  add_output_section(Output_section* os, unsigned int type,
+  add_output_section(Output_section* os, unsigned int type, Output_data* od,
                      Sized_relobj<size, big_endian>* relobj,
 		     unsigned int shndx, Address address, Addend addend)
-  { this->add(os, Output_reloc_type(os, type, relobj, shndx, address,
+  { this->add(od, Output_reloc_type(os, type, relobj, shndx, address,
                                     addend)); }

   // Add an absolute relocation.

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

* Re: [gold patch obvious] Fix problem where TEXTREL is set incorrectly
  2010-12-23 23:27 [gold patch obvious] Fix problem where TEXTREL is set incorrectly Cary Coutant
@ 2010-12-24  3:40 ` Ian Lance Taylor
  0 siblings, 0 replies; 2+ messages in thread
From: Ian Lance Taylor @ 2010-12-24  3:40 UTC (permalink / raw)
  To: Cary Coutant; +Cc: Binutils

Cary Coutant <ccoutant@google.com> writes:

> I will commit the following patch as obvious and trivial. (The missing
> Output_data* parameter from the second form of the function was
> undetected previously because that form is never called.)

>         * output.h (Output_data_reloc::add_output_section): Pass OD instead
>         of OS to this->add.  Add OD parameter to second form of the function.

This is a bug, plain and simple, so I've copied this patch over to the
binutils 2.21 branch for the next release.

Ian

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

end of thread, other threads:[~2010-12-23 23:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-23 23:27 [gold patch obvious] Fix problem where TEXTREL is set incorrectly Cary Coutant
2010-12-24  3:40 ` Ian Lance Taylor

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