This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
dot moved backwards warning
- From: Alan Modra <amodra at bigpond dot net dot au>
- To: binutils at sourceware dot org
- Date: Thu, 8 Mar 2007 14:59:47 +1030
- Subject: dot moved backwards warning
After looking at testsuite results, I've convinced myself that the
"dot moved backwards" warning isn't a generally good idea. A number
of targets do move dot backwards in their standard link scripts.
eg. ip2k and iq2000 have .data before .text. I also saw a case where
.stack was placed before .text, but can't remember which target that
was.
* ldlang.c (lang_size_sections_1): Correct backwards dot move
test to not trigger on overlays. Only warn on backwards move
if non-default lma.
Index: ld/ldlang.c
===================================================================
RCS file: /cvs/src/src/ld/ldlang.c,v
retrieving revision 1.251
diff -u -p -r1.251 ldlang.c
--- ld/ldlang.c 21 Feb 2007 16:43:50 -0000 1.251
+++ ld/ldlang.c 7 Mar 2007 09:55:02 -0000
@@ -4411,19 +4411,21 @@ lang_size_sections_1
/* A backwards move of dot should be accompanied by
an explicit assignment to the section LMA (ie.
- os->load_base set) because backwards moves normally
+ os->load_base set) because backwards moves can
create overlapping LMAs. */
if (dot < last->vma
- && os->bfd_section->size != 0)
+ && os->bfd_section->size != 0
+ && dot + os->bfd_section->size <= last->vma)
{
- einfo (_("%P: warning: dot moved backwards before `%s'\n"),
- os->name);
-
/* If dot moved backwards then leave lma equal to
vma. This is the old default lma, which might
just happen to work when the backwards move is
- sufficiently large. Nag anyway, so people fix
- their linker scripts. */
+ sufficiently large. Nag if this changes anything,
+ so people can fix their linker scripts. */
+
+ if (last->vma != last->lma)
+ einfo (_("%P: warning: dot moved backwards before `%s'\n"),
+ os->name);
}
else
{
--
Alan Modra
IBM OzLabs - Linux Technology Centre