[binutils-gdb] PR25081, Discrepancy between VMA and LMA after ALIGN
Alan Modra
amodra@sourceware.org
Wed Oct 9 11:30:00 GMT 2019
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=8610e0fd93ea253f9beb9ebb6e50e8807ed83327
commit 8610e0fd93ea253f9beb9ebb6e50e8807ed83327
Author: Alan Modra <amodra@gmail.com>
Date: Wed Oct 9 21:25:25 2019 +1030
PR25081, Discrepancy between VMA and LMA after ALIGN
The testcase in the PR has two empty output sections, .sec1 with an
ALIGN and symbol assignment, and .sec2 just with an empty input
section. The symbol assignment results in .sec1 being kept, but
because it is empty this section doesn't take space from the memory
region as you might expect from the ALIGN. Instead the next section
.sec2, has vma/lma as if .sec1 wasn't present. However, .sec2 is
discarded and os->ignored set, which unfortunately meant that dot
wasn't set from .sec2 vma. That in turn results in .sec2 lma being
set incorrectly. That vma/lma difference is then propagated to
.sec3 where it is seen as an overlap.
PR 25081
* ldlang.c (lang_size_sections_1): Set lma from section vma
rather than dot.
Diff:
---
ld/ChangeLog | 6 ++++++
ld/ldlang.c | 2 +-
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/ld/ChangeLog b/ld/ChangeLog
index c20425b..d3d045c 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,9 @@
+2019-10-09 Alan Modra <amodra@gmail.com>
+
+ PR 25081
+ * ldlang.c (lang_size_sections_1): Set lma from section vma
+ rather than dot.
+
2019-10-08 Alan Modra <amodra@gmail.com>
* testsuite/ld-powerpc/localgot.s,
diff --git a/ld/ldlang.c b/ld/ldlang.c
index 2f72a7c..df7f659 100644
--- a/ld/ldlang.c
+++ b/ld/ldlang.c
@@ -5691,7 +5691,7 @@ lang_size_sections_1
/* Otherwise, keep the same lma to vma relationship
as the previous section. */
else
- lma = dot + last->lma - last->vma;
+ lma = os->bfd_section->vma + last->lma - last->vma;
if (section_alignment > 0)
lma = align_power (lma, section_alignment);
More information about the Binutils-cvs
mailing list