* [PATCH]: Fix ld bug triggered in arm-*-pe (?)
@ 2006-08-15 0:30 Pedro Alves
2006-08-15 3:00 ` Alan Modra
0 siblings, 1 reply; 5+ messages in thread
From: Pedro Alves @ 2006-08-15 0:30 UTC (permalink / raw)
To: binutils
[-- Attachment #1: Type: text/plain, Size: 1491 bytes --]
Hi all,
While doing the arm-pe/arm-wince-pe split, I noticed that
the ld/ld-scripts/script.exp [script] test would fail for arm-wince-pe
but not for arm-epoc-pe.
Here is the script.t file for reference (with minor editing for better
mail reading):
SECTIONS
{
.text 0x100 : { text_start = .; *(.text) *(.pr) text_end = .; }
. = 0x1000;
.data : { data_start = .; *(.data) *(.rw) data_end = .; }
}
Without the attached patch, I am getting a data_start == 0x00000104,
that is, the dot assignment
is being lost.
nm output:
U .bss
00000104 d .data
00000100 t .text
(...)
I traced it to the fact that the default section alignment for
arm-wince-pe/arm-pe is 0x1000
while for arm-epoc-pe it is 0x400.
If I change 0x1000 to something else, say 0x1010, and retest in
arm-wince-pe,
the dot assign is *not* ignored. If I change the 0x1000 to 0x400 and
test with arm-epoc-pe,
I get the same bug.
I tried reproducing with i686-pc-cygwin, but I couldn't.
This may have something to do with the ".glue_7*" sections not being
present there.
The attached patch fixes the problem, but I am not sure if I'm not fixing
the symptom instead.
Tested on arm-pe, arm-wince-pe, arm-epoc-pe and i686-pc-cygwin for
regressions.
Cheers,
Pedro Alves
---
ld/ChangeLog
2006-08-14 Pedro Alves <pedro_alves@portugalmail.pt>
* ldlang.c (lang_size_sections_1, lang_assignment_statement_enum):
Adjust the current address of DEFAULT_MEMORY_REGION even
when dot hasn't changed.
[-- Attachment #2: ldlang.c.diff --]
[-- Type: text/plain, Size: 900 bytes --]
Index: ldlang.c
===================================================================
RCS file: /cvs/src/src/ld/ldlang.c,v
retrieving revision 1.233
diff -u -p -r1.233 ldlang.c
--- ldlang.c 8 Aug 2006 16:08:47 -0000 1.233
+++ ldlang.c 14 Aug 2006 20:34:28 -0000
@@ -4535,7 +4535,7 @@ lang_size_sections_1
output_section_statement->bfd_section,
&newdot);
- if (newdot != dot && !output_section_statement->ignored)
+ if (!output_section_statement->ignored)
{
if (output_section_statement == abs_output_section)
{
@@ -4544,8 +4544,8 @@ lang_size_sections_1
lang_memory_region_lookup (DEFAULT_MEMORY_REGION,
FALSE)->current = newdot;
}
- else
- {
+ else if (newdot != dot)
+ {
/* Insert a pad after this statement. We can't
put the pad before when relaxing, in case the
assignment references dot. */
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH]: Fix ld bug triggered in arm-*-pe (?)
2006-08-15 0:30 [PATCH]: Fix ld bug triggered in arm-*-pe (?) Pedro Alves
@ 2006-08-15 3:00 ` Alan Modra
2006-08-24 15:23 ` Pedro Alves
0 siblings, 1 reply; 5+ messages in thread
From: Alan Modra @ 2006-08-15 3:00 UTC (permalink / raw)
To: Pedro Alves; +Cc: binutils
On Mon, Aug 14, 2006 at 11:52:04PM +0100, Pedro Alves wrote:
> * ldlang.c (lang_size_sections_1, lang_assignment_statement_enum):
> Adjust the current address of DEFAULT_MEMORY_REGION even
> when dot hasn't changed.
This is OK.
--
Alan Modra
IBM OzLabs - Linux Technology Centre
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH]: Fix ld bug triggered in arm-*-pe (?)
2006-08-15 3:00 ` Alan Modra
@ 2006-08-24 15:23 ` Pedro Alves
2006-08-24 15:38 ` Nick Clifton
0 siblings, 1 reply; 5+ messages in thread
From: Pedro Alves @ 2006-08-24 15:23 UTC (permalink / raw)
To: binutils
[-- Attachment #1: Type: text/plain, Size: 653 bytes --]
Alan Modra wrote:
> On Mon, Aug 14, 2006 at 11:52:04PM +0100, Pedro Alves wrote:
>> * ldlang.c (lang_size_sections_1, lang_assignment_statement_enum):
>> Adjust the current address of DEFAULT_MEMORY_REGION even
>> when dot hasn't changed.
>
> This is OK.
>
Thanks,
Could someone commit this, please?
Attached is the same patch, but with the formatting fixed,
for your convenience.
Cheers,
Pedro Alves
---
ld/ChangeLog
2006-08-24 Pedro Alves <pedro_alves@portugalmail.pt>
* ldlang.c (lang_size_sections_1, lang_assignment_statement_enum):
Adjust the current address of DEFAULT_MEMORY_REGION even
when dot hasn't changed.
[-- Attachment #2: ldlang.c.diff --]
[-- Type: text/plain, Size: 849 bytes --]
Index: ldlang.c
===================================================================
RCS file: /cvs/src/src/ld/ldlang.c,v
retrieving revision 1.235
diff -u -p -r1.235 ldlang.c
--- ldlang.c 22 Aug 2006 07:41:05 -0000 1.235
+++ ldlang.c 24 Aug 2006 12:56:38 -0000
@@ -4621,7 +4621,7 @@ lang_size_sections_1
output_section_statement->bfd_section,
&newdot);
- if (newdot != dot && !output_section_statement->ignored)
+ if (!output_section_statement->ignored)
{
if (output_section_statement == abs_output_section)
{
@@ -4630,7 +4630,7 @@ lang_size_sections_1
lang_memory_region_lookup (DEFAULT_MEMORY_REGION,
FALSE)->current = newdot;
}
- else
+ else if (newdot != dot)
{
/* Insert a pad after this statement. We can't
put the pad before when relaxing, in case the
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH]: Fix ld bug triggered in arm-*-pe (?)
2006-08-24 15:23 ` Pedro Alves
@ 2006-08-24 15:38 ` Nick Clifton
2006-08-25 0:34 ` Pedro Alves
0 siblings, 1 reply; 5+ messages in thread
From: Nick Clifton @ 2006-08-24 15:38 UTC (permalink / raw)
To: Pedro Alves; +Cc: binutils
Hi Pedro,
> Could someone commit this, please?
> ld/ChangeLog
> 2006-08-24 Pedro Alves <pedro_alves@portugalmail.pt>
>
> * ldlang.c (lang_size_sections_1, lang_assignment_statement_enum):
> Adjust the current address of DEFAULT_MEMORY_REGION even
> when dot hasn't changed.
Applied.
Cheers
Nick
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH]: Fix ld bug triggered in arm-*-pe (?)
2006-08-24 15:38 ` Nick Clifton
@ 2006-08-25 0:34 ` Pedro Alves
0 siblings, 0 replies; 5+ messages in thread
From: Pedro Alves @ 2006-08-25 0:34 UTC (permalink / raw)
To: Nick Clifton; +Cc: binutils
Nick Clifton wrote:
>
>> ld/ChangeLog
>> 2006-08-24 Pedro Alves <pedro_alves@portugalmail.pt>
>>
>> * ldlang.c (lang_size_sections_1, lang_assignment_statement_enum):
>> Adjust the current address of DEFAULT_MEMORY_REGION even
>> when dot hasn't changed.
>
>
> Applied.
>
>
Thank you.
Cheers,
Pedro Alves
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2006-08-24 15:48 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-08-15 0:30 [PATCH]: Fix ld bug triggered in arm-*-pe (?) Pedro Alves
2006-08-15 3:00 ` Alan Modra
2006-08-24 15:23 ` Pedro Alves
2006-08-24 15:38 ` Nick Clifton
2006-08-25 0:34 ` Pedro Alves
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).