This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
RE: bug fix for displaying load address in the map file
- From: "Ina Pandit" <InaP at KPITCummins dot com>
- To: "Alan Modra" <amodra at bigpond dot net dot au>
- Cc: <binutils at sources dot redhat dot com>
- Date: Tue, 12 Dec 2006 11:53:19 +0530
- Subject: RE: bug fix for displaying load address in the map file
Hi,
>>This should have told you that your patch was wrong. I think that
>>instead of trying to set load_base that it would be better to modify
>>print_output_section_statement to print the section lma if it is
>>different from the vma.
Thank you for your suggestion. I modified the patch according to your
suggestion. However, after regression, I found that one test case was
failing because the test case did not check for the "load address" in
the generated map file. I modified the test case also.
Please review the patch and let me know if it is OK.
Also let me know if the test case modification is OK.
ChangeLog:
2006-12-12 Ina Pandit <inap@kpitcummins.com>
ld/
* ldlang.c (print_output_section_statement): Print load address
only if lma and vma are different.
ld/testsuite/
* ld-scripts/overlay-size-map.d: Update.
===========================================================================
--- binutils-061206/ld/ldlang.c.orig 2006-12-11 16:51:14.000000000 +0530
+++ binutils-061206/ld/ldlang.c 2006-12-11 16:55:10.000000000 +0530
@@ -3412,13 +3412,9 @@ print_output_section_statement
minfo ("0x%V %W", section->vma, section->size);
- if (output_section_statement->load_base != NULL)
+ if (section->vma != section->lma)
{
- bfd_vma addr;
-
- addr = exp_get_abs_int (output_section_statement->load_base, 0,
- "load base");
- minfo (_(" load address 0x%V"), addr);
+ minfo (_(" load address 0x%V"), section->lma);
}
}
--- binutils-061206/ld/testsuite/ld-scripts/overlay-size-map.d.orig 2006-08-16 14:01:45.000000000 +0530
+++ binutils-061206/ld/testsuite/ld-scripts/overlay-size-map.d 2004-08-31 17:35:40.000000000 +0530
@@ -1,23 +1,23 @@
#...
\.bss1 *0x0*20000 *0x10
#...
-\.bss2 *0x0*20000 *0x30
+\.bss2 *0x0*20000 *0x30 load address 0x0*20010
#...
-\.bss3 *0x0*20000 *0x20
+\.bss3 *0x0*20000 *0x20 load address 0x0*20040
#...
-\.mtext *0x0*10000 *0x20
+\.mtext *0x0*10000 *0x20 load address 0x0*30000
#...
\.mbss *0x0*20030 *0x230 load address 0x0*20060
#...
-\.text1 *0x0*10020 *0x80
+\.text1 *0x0*10020 *0x80 load address 0x0*30020
#...
-\.text2 *0x0*10020 *0x40
+\.text2 *0x0*10020 *0x40 load address 0x0*300a0
#...
-\.text3 *0x0*10020 *0x20
+\.text3 *0x0*10020 *0x20 load address 0x0*300e0
#...
-\.data1 *0x0*20260 *0x30
+\.data1 *0x0*20260 *0x30 load address 0x0*30100
#...
-\.data2 *0x0*20260 *0x40
+\.data2 *0x0*20260 *0x40 load address 0x0*30130
#...
-\.data3 *0x0*20260 *0x50
+\.data3 *0x0*20260 *0x50 load address 0x0*30170
#pass
===========================================================================
?
Regards,
Ina Pandit
KPIT Cummins InfoSystems Ltd.
Pune, India
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Free download of GNU based tool-chains for Renesas' SH, H8, R8C, M16C
and M32C Series. The following site also offers free technical support
to its users. Visit http://www.kpitgnutools.com for details.
Latest versions of KPIT GNU tools were released on October 3, 2006.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-----Original Message-----
From: Alan Modra [mailto:amodra@bigpond.net.au]
Sent: Monday, December 11, 2006 6:07 AM
To: Ina Pandit
Cc: binutils@sources.redhat.com
Subject: Re: bug fix for displaying load address in the map file
On Fri, Dec 08, 2006 at 05:49:58PM +0530, Ina Pandit wrote:
> The "load address" of a section is not displayed in the map file when it is
> assigned using 'AT > lma_region' expression in the linker script i.e.
> .data {*(.data) } >ram AT>rom
>
> However, if the load address is assigned using AT(lma) expression
> in the linker script, i.e.
> .data : AT(lma) {*(.data)} >ram
> it is displayed in the map file.
>
> The function "print_output_section_statement" (in ldlang.c), prints
> the load address in the map file if "load_base" is not NULL. To solve
> this problem, I modified the function "lang_size_sections_1" (in ldlang.c).
>
> However, after this modification, the linker function LOADADDR(section),
> computed incorrect value of LMA of a section. The value computed was
> the sum of LMA and VMA.
This should have told you that your patch was wrong. I think that
instead of trying to set load_base that it would be better to modify
print_output_section_statement to print the section lma if it is
different from the vma.
--
Alan Modra
IBM OzLabs - Linux Technology Centre