public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* PATCH: Fix empty sections with alignment
@ 2005-09-27  1:19 H. J. Lu
  2005-09-27  9:25 ` Alan Modra
  0 siblings, 1 reply; 5+ messages in thread
From: H. J. Lu @ 2005-09-27  1:19 UTC (permalink / raw)
  To: binutils; +Cc: amodra

This patch

http://sourceware.org/ml/binutils/2005-09/msg00215.html

breaks empty sections with alignment. The patch here works for me.


H.J.
----
2005-09-26  H.J. Lu  <hongjiu.lu@intel.com>

	* ldlang.c (lang_size_sections_1): Process alignment addr_tree
	later.

--- ld/ldlang.c.empty	2005-09-26 13:12:55.000000000 -0700
+++ ld/ldlang.c	2005-09-26 15:21:08.000000000 -0700
@@ -4044,7 +4044,9 @@ lang_size_sections_1
 	    lang_output_section_statement_type *os;
 
 	    os = &s->output_section_statement;
-	    if (os->addr_tree != NULL)
+	    if (os->addr_tree != NULL
+		&& !(os->addr_tree->type.node_class == etree_unary
+		     && os->addr_tree->type.node_code == ALIGN_K))
 	      {
 		os->processed = FALSE;
 		exp_fold_tree (os->addr_tree, bfd_abs_section_ptr, &dot);
@@ -4159,6 +4161,22 @@ lang_size_sections_1
 				 os->name, (unsigned long) (newdot - savedot));
 		      }
 		  }
+		else if (os->addr_tree->type.node_class == etree_unary
+			 && os->addr_tree->type.node_code == ALIGN_K)
+		  {
+		    newdot = dot;
+		    os->processed = FALSE;
+		    exp_fold_tree (os->addr_tree, bfd_abs_section_ptr,
+				   &newdot);
+
+		    if (!expld.result.valid_p
+			&& expld.phase != lang_mark_phase_enum)
+		      einfo (_("%F%S: non constant or forward reference"
+			       " address expression for section %s\n"),
+			     os->name);
+
+		    newdot = expld.result.value + expld.result.section->vma;
+		  }
 
 		/* The section starts here.
 		   First, align to what the section needs.  */

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

end of thread, other threads:[~2005-09-27 23:54 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-09-27  1:19 PATCH: Fix empty sections with alignment H. J. Lu
2005-09-27  9:25 ` Alan Modra
2005-09-27 18:34   ` H. J. Lu
2005-09-27 21:21     ` H. J. Lu
2005-09-28  8:39       ` Alan Modra

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