public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [Patch] ld: DEFINED builtin is not correctly computed in map file
@ 2007-08-27 18:23 Tristan Gingold
  2007-08-31 15:01 ` Nick Clifton
  0 siblings, 1 reply; 2+ messages in thread
From: Tristan Gingold @ 2007-08-27 18:23 UTC (permalink / raw)
  To: binutils

Hi,

this patch fixed a small bug during map file generation.  Because  
lang_statement_iteration was not incremented,
all defined symbols appear to be defined from the beginning.  This is  
not correct according to the
documentation.

Reg-tested on x86-linux, test included.

Tristan.

d/ChangeLog:
2007-08-27  Tristan Gingold  <gingold@adacore.com>

         * ldlang.c (lang_map): Increment lang_statement_iteration so  
that
         DEFINED() expressions are correctly computed.

ld/testsuite/ChangeLog
2007-08-27  Tristan Gingold  <gingold@adacore.com>

         * ld-script/map-address.d,
         * ld-script/map-address.t: Add a test for testing DEFINED in  
map
         output.

--- ld/ldlang.c 29 Jul 2007 12:33:37 -0000      1.268
+++ ld/ldlang.c 27 Aug 2007 14:56:32 -0000
@@ -1811,6 +1811,7 @@
         bfd_map_over_sections (p, init_map_userdata, 0);
        bfd_link_hash_traverse (link_info.hash, sort_def_symbol, 0);
      }
+  lang_statement_iteration++;
    print_statements ();
}
@@ -3539,8 +3540,8 @@
               value = h->u.def.value;
               if (expld.result.section)
-             value += expld.result.section->vma;
+               value += expld.result.section->vma;
               minfo ("[0x%V]", value);
             }
--- ld/testsuite/ld-scripts/map-address.d       28 Aug 2002 00:11:40  
-0000      1.2
+++ ld/testsuite/ld-scripts/map-address.d       27 Aug 2007 14:56:35  
-0000
@@ -1,7 +1,9 @@
#...
Linker script and memory map
#...
+ *0x0*000020 *def1 = .*
+ *0x0*000020 *def2 = def1
   *0x0*010001 *\. = 0x10001
   *0x0*010001 *foo = \.
   *0x0*010201 *\. = \(\. \+ 0x200\)
--- ld/testsuite/ld-scripts/map-address.t       30 Apr 2002 09:23:14  
-0000      1.1
+++ ld/testsuite/ld-scripts/map-address.t       27 Aug 2007 14:56:35  
-0000
@@ -1,5 +1,7 @@
SECTIONS
{
+  def1 = DEFINED(foo) ? 0x10 : 0x20;
+  def2 = def1;
    . = 0x10001;
    foo = .;
    . += 0x200;

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Patch] ld: DEFINED builtin is not correctly computed in map  file
  2007-08-27 18:23 [Patch] ld: DEFINED builtin is not correctly computed in map file Tristan Gingold
@ 2007-08-31 15:01 ` Nick Clifton
  0 siblings, 0 replies; 2+ messages in thread
From: Nick Clifton @ 2007-08-31 15:01 UTC (permalink / raw)
  To: Tristan Gingold; +Cc: binutils

Hi Tristan,

> ld/ChangeLog:
> 2007-08-27  Tristan Gingold  <gingold@adacore.com>
> 
>         * ldlang.c (lang_map): Increment lang_statement_iteration so that
>         DEFINED() expressions are correctly computed.
> 
> ld/testsuite/ChangeLog
> 2007-08-27  Tristan Gingold  <gingold@adacore.com>
> 
>         * ld-script/map-address.d,
>         * ld-script/map-address.t: Add a test for testing DEFINED in map
>         output.

Approved and applied.  Thanks very much for finding and fixing this bug.

Cheers
   Nick

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-08-31 14:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-08-27 18:23 [Patch] ld: DEFINED builtin is not correctly computed in map file Tristan Gingold
2007-08-31 15:01 ` Nick Clifton

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).