public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Alan Modra <amodra@bigpond.net.au>
To: Andrew Lunn <andrew.lunn@ascom.ch>
Cc: binutils@sources.redhat.com
Subject: Re: Change in .ld syntax or a bug?
Date: Tue, 20 Sep 2005 02:59:00 -0000	[thread overview]
Message-ID: <20050919231813.GZ18783@bubble.grove.modra.org> (raw)
In-Reply-To: <20050919074246.GB4868@donkey.ma.tech.ascom.ch>

On Mon, Sep 19, 2005 at 09:42:46AM +0200, Andrew Lunn wrote:
> On Mon, Sep 19, 2005 at 12:25:03PM +0930, Alan Modra wrote:
> > Please let me know whether this cures the problem.
> 
> Nope.
> 
> I've created a bugzilla bug, #1353. I've also created a testcase which
> demonstrates the bug. Detains are in bugzilla.

Thanks.  So it's not that .vectors has no bfd_section created, but that
the section is zero sized.  The change to ignore alignment in zero size
sections also affects sections with an explicit address.

I've committed this patch to mainline.

	* ldlang.c (lang_size_sections_1): Process addr_tree earlier,
	so that unused output section statements affect dot.

Index: ld/ldlang.c
===================================================================
RCS file: /cvs/src/src/ld/ldlang.c,v
retrieving revision 1.195
diff -u -p -r1.195 ldlang.c
--- ld/ldlang.c	4 Aug 2005 06:22:12 -0000	1.195
+++ ld/ldlang.c	19 Sep 2005 23:10:46 -0000
@@ -3974,6 +3974,21 @@ lang_size_sections_1
 	    lang_output_section_statement_type *os;
 
 	    os = &s->output_section_statement;
+	    if (os->addr_tree != NULL)
+	      {
+		os->processed = -1;
+		exp_fold_tree (os->addr_tree, bfd_abs_section_ptr, &dot);
+		os->processed = 0;
+
+		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);
+
+		dot = expld.result.value + expld.result.section->vma;
+	      }
+
 	    if (os->bfd_section == NULL)
 	      /* This section was removed or never actually created.  */
 	      break;
@@ -4003,6 +4018,7 @@ lang_size_sections_1
 		break;
 	      }
 
+	    newdot = dot;
 	    if (bfd_is_abs_section (os->bfd_section))
 	      {
 		/* No matter what happens, an abs section starts at zero.  */
@@ -4074,22 +4090,6 @@ lang_size_sections_1
 				 os->name, (unsigned long) (newdot - savedot));
 		      }
 		  }
-		else
-		  {
-		    newdot = dot;
-		    os->processed = -1;
-		    exp_fold_tree (os->addr_tree, bfd_abs_section_ptr,
-				   &newdot);
-		    os->processed = 0;
-
-		    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.  */

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre

      reply	other threads:[~2005-09-19 23:18 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-09-15 13:01 Andrew Lunn
2005-09-15 13:39 ` Alan Modra
2005-09-15 13:43   ` Andrew Lunn
2005-09-16  5:36     ` Alan Modra
2005-09-16  8:25       ` Andrew Lunn
2005-09-19  7:44         ` Alan Modra
2005-09-19 14:23           ` Andrew Lunn
2005-09-20  2:59             ` Alan Modra [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050919231813.GZ18783@bubble.grove.modra.org \
    --to=amodra@bigpond.net.au \
    --cc=andrew.lunn@ascom.ch \
    --cc=binutils@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).