public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [patch][gold] Check for --section-start while processing scripts
@ 2010-05-24 17:54 Rafael Espindola
  2010-05-26  0:34 ` Ian Lance Taylor
  0 siblings, 1 reply; 2+ messages in thread
From: Rafael Espindola @ 2010-05-24 17:54 UTC (permalink / raw)
  To: Binutils; +Cc: Ian Lance Taylor

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

Currently gold is only using --section-start when not processing a
linker script. This is different from the gnu ld. The attached patch
fixes that.

2010-05-24  Rafael Espindola  <espindola@google.com>

	* script-sections.cc (Output_section_definition::set_section_addresses):
	Check for --section-start.

Cheers,
-- 
Rafael Ávila de Espíndola

[-- Attachment #2: section-start.patch --]
[-- Type: application/octet-stream, Size: 1230 bytes --]

diff --git a/gold/script-sections.cc b/gold/script-sections.cc
index 952444e..3266115 100644
--- a/gold/script-sections.cc
+++ b/gold/script-sections.cc
@@ -1939,14 +1939,23 @@ Output_section_definition::set_section_addresses(Symbol_table* symtab,
   uint64_t old_dot_value = *dot_value;
   uint64_t old_load_address = *load_address;
 
-  if (this->address_ == NULL)
-    address = *dot_value;
-  else
+  // Check for --section-start.
+  bool is_address_set = false;
+  if (this->output_section_ != NULL)
+    is_address_set =
+      parameters->options().section_start(this->output_section_->name(),
+                                          &address);
+  if (!is_address_set)
     {
-      Output_section* dummy;
-      address = this->address_->eval_with_dot(symtab, layout, true,
-					      *dot_value, NULL, &dummy,
-					      dot_alignment);
+      if (this->address_ == NULL)
+        address = *dot_value;
+      else
+        {
+          Output_section* dummy;
+          address = this->address_->eval_with_dot(symtab, layout, true,
+                                                  *dot_value, NULL, &dummy,
+                                                  dot_alignment);
+        }
     }
 
   uint64_t align;

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

* Re: [patch][gold] Check for --section-start while processing scripts
  2010-05-24 17:54 [patch][gold] Check for --section-start while processing scripts Rafael Espindola
@ 2010-05-26  0:34 ` Ian Lance Taylor
  0 siblings, 0 replies; 2+ messages in thread
From: Ian Lance Taylor @ 2010-05-26  0:34 UTC (permalink / raw)
  To: Rafael Espindola; +Cc: Binutils

Rafael Espindola <espindola@google.com> writes:

> 2010-05-24  Rafael Espindola  <espindola@google.com>
>
> 	* script-sections.cc (Output_section_definition::set_section_addresses):
> 	Check for --section-start.

This is OK.

Thanks.

Ian

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

end of thread, other threads:[~2010-05-26  0:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-05-24 17:54 [patch][gold] Check for --section-start while processing scripts Rafael Espindola
2010-05-26  0:34 ` 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).