From: Alan Modra <amodra@gmail.com>
To: Sebastian Huber <sebastian.huber@embedded-brains.de>
Cc: binutils@sourceware.org
Subject: Re: Strange LMA/VMA behavior with regions
Date: Wed, 01 Dec 2010 13:13:00 -0000 [thread overview]
Message-ID: <20101201131250.GN15607@bubble.grove.modra.org> (raw)
In-Reply-To: <4CF51061.2040405@embedded-brains.de>
Please test this for me. I think it will cure the problem.
* ldlang.c (lang_size_sections_1): Align lma using same alignment
as for vma.
Index: ld/ldlang.c
===================================================================
RCS file: /cvs/src/src/ld/ldlang.c,v
retrieving revision 1.348
diff -u -p -r1.348 ldlang.c
--- ld/ldlang.c 21 Nov 2010 20:36:24 -0000 1.348
+++ ld/ldlang.c 1 Dec 2010 12:24:41 -0000
@@ -4788,6 +4788,7 @@ lang_size_sections_1
bfd_vma newdot, after;
lang_output_section_statement_type *os;
lang_memory_region_type *r;
+ int section_alignment = 0;
os = &s->output_section_statement;
if (os->constraint == -1)
@@ -4857,8 +4858,6 @@ lang_size_sections_1
}
else
{
- int align;
-
if (os->addr_tree == NULL)
{
/* No address specified for this section, get one
@@ -4909,16 +4908,16 @@ lang_size_sections_1
}
newdot = os->region->current;
- align = os->bfd_section->alignment_power;
+ section_alignment = os->bfd_section->alignment_power;
}
else
- align = os->section_alignment;
+ section_alignment = os->section_alignment;
/* Align to what the section needs. */
- if (align > 0)
+ if (section_alignment > 0)
{
bfd_vma savedot = newdot;
- newdot = align_power (newdot, align);
+ newdot = align_power (newdot, section_alignment);
if (newdot != savedot
&& (config.warn_section_align
@@ -4974,8 +4973,8 @@ lang_size_sections_1
{
bfd_vma lma = os->lma_region->current;
- if (os->section_alignment != -1)
- lma = align_power (lma, os->section_alignment);
+ if (section_alignment > 0)
+ lma = align_power (lma, section_alignment);
os->bfd_section->lma = lma;
}
else if (r->last_os != NULL
@@ -5016,8 +5015,8 @@ lang_size_sections_1
else
lma = dot + last->lma - last->vma;
- if (os->section_alignment != -1)
- lma = align_power (lma, os->section_alignment);
+ if (section_alignment > 0)
+ lma = align_power (lma, section_alignment);
os->bfd_section->lma = lma;
}
}
--
Alan Modra
Australia Development Lab, IBM
next prev parent reply other threads:[~2010-12-01 13:13 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-29 13:15 Sebastian Huber
2010-11-30 17:00 ` Sebastian Huber
2010-12-01 13:13 ` Alan Modra [this message]
2010-12-01 15:03 ` Sebastian Huber
2010-12-02 0:46 ` Alan Modra
2010-12-02 8:03 ` Sebastian Huber
2011-05-11 7:20 Abnikant Singh
2011-05-11 7:45 ` Alan Modra
[not found] <BANLkTi=+O9YvCp42jT3k0fKiC4z0opvAdA@mail.gmail.com>
[not found] ` <BANLkTinEBMoiGna1KJKn1KqtvNsHdHynoA@mail.gmail.com>
2011-05-12 14:09 ` Anitha Boyapati
2011-05-12 23:34 ` Alan Modra
2011-05-13 2:44 ` Anitha Boyapati
2011-05-13 3:41 ` Alan Modra
2011-05-13 4:15 ` Anitha Boyapati
2011-05-13 5:26 ` Alan Modra
2011-05-13 5:45 ` Boyapati, Anitha
2011-05-13 5:02 ` Boyapati, Anitha
2011-05-13 5:42 ` 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=20101201131250.GN15607@bubble.grove.modra.org \
--to=amodra@gmail.com \
--cc=binutils@sourceware.org \
--cc=sebastian.huber@embedded-brains.de \
/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).