From: "H. J. Lu" <hjl@lucon.org>
To: binutils@sources.redhat.com
Cc: amodra@bigpond.net.au
Subject: PATCH: Fix empty sections with alignment
Date: Tue, 27 Sep 2005 01:19:00 -0000 [thread overview]
Message-ID: <20050926223601.GA28885@lucon.org> (raw)
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. */
next reply other threads:[~2005-09-26 22:36 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-09-27 1:19 H. J. Lu [this message]
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
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=20050926223601.GA28885@lucon.org \
--to=hjl@lucon.org \
--cc=amodra@bigpond.net.au \
--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).