public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH][ARM] Adjust view for all relaxed section types during   relocation.
@ 2010-02-03 18:38 Doug Kwan (關振德)
  2010-02-03 19:29 ` Ian Lance Taylor
  0 siblings, 1 reply; 2+ messages in thread
From: Doug Kwan (關振德) @ 2010-02-03 18:38 UTC (permalink / raw)
  To: Ian Lance Taylor, binutils

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

Hi,

    This patch generalizes code in Target_arm::relocate_section to do
view adjustment for all relaxed section types.  Previously we only
handled relaxed text input sections but we missed relaxed EXIDX input
sections.  That caused some incorrect relocations in the output EXIDX
section.

-Doug

2010-02-02  Doug Kwan  <dougkwan@google.com>

        * arm.cc (Target_arm::relocate_section): Do view adjustment for all
        types of relaxed input section.

[-- Attachment #2: patch-adjust-view.txt --]
[-- Type: text/plain, Size: 2012 bytes --]

Index: gold/arm.cc
===================================================================
RCS file: /cvs/src/src/gold/arm.cc,v
retrieving revision 1.74
diff -u -u -p -r1.74 arm.cc
--- gold/arm.cc	3 Feb 2010 05:36:55 -0000	1.74
+++ gold/arm.cc	3 Feb 2010 18:31:32 -0000
@@ -7916,26 +7916,27 @@ Target_arm<big_endian>::relocate_section
   typedef typename Target_arm<big_endian>::Relocate Arm_relocate;
   gold_assert(sh_type == elfcpp::SHT_REL);
 
-  Arm_input_section<big_endian>* arm_input_section =
-    this->find_arm_input_section(relinfo->object, relinfo->data_shndx);
+  // See if we are relocating a relaxed input section.  If so, the view
+  // covers the whole output section and we need to adjust accordingly.
+  if (needs_special_offset_handling)
+    {
+      const Output_relaxed_input_section* poris =
+	output_section->find_relaxed_input_section(relinfo->object,
+						   relinfo->data_shndx);
+      if (poris != NULL)
+	{
+	  Arm_address section_address = poris->address();
+	  section_size_type section_size = poris->data_size();
 
-  // This is an ARM input section and the view covers the whole output
-  // section.
-  if (arm_input_section != NULL)
-    {
-      gold_assert(needs_special_offset_handling);
-      Arm_address section_address = arm_input_section->address();
-      section_size_type section_size = arm_input_section->data_size();
-
-      gold_assert((arm_input_section->address() >= address)
-		  && ((arm_input_section->address()
-		       + arm_input_section->data_size())
-		      <= (address + view_size)));
-
-      off_t offset = section_address - address;
-      view += offset;
-      address += offset;
-      view_size = section_size;
+	  gold_assert((section_address >= address)
+		      && ((section_address + section_size)
+			  <= (address + view_size)));
+
+	  off_t offset = section_address - address;
+	  view += offset;
+	  address += offset;
+	  view_size = section_size;
+	}
     }
 
   gold::relocate_section<32, big_endian, Target_arm, elfcpp::SHT_REL,

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

* Re: [PATCH][ARM] Adjust view for all relaxed section types during  relocation.
  2010-02-03 18:38 [PATCH][ARM] Adjust view for all relaxed section types during relocation Doug Kwan (關振德)
@ 2010-02-03 19:29 ` Ian Lance Taylor
  0 siblings, 0 replies; 2+ messages in thread
From: Ian Lance Taylor @ 2010-02-03 19:29 UTC (permalink / raw)
  To: Doug Kwan (關振德); +Cc: binutils

"Doug Kwan (關振德)" <dougkwan@google.com> writes:

> 2010-02-02  Doug Kwan  <dougkwan@google.com>
>
>         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
>         types of relaxed input section.

This is OK.

Thanks.

Ian

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

end of thread, other threads:[~2010-02-03 19:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-02-03 18:38 [PATCH][ARM] Adjust view for all relaxed section types during relocation Doug Kwan (關振德)
2010-02-03 19:29 ` 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).