* [PATCH] Fix s390{,x} ld-size-1 failures
@ 2004-05-04 14:53 Jakub Jelinek
2004-05-05 6:23 ` Alan Modra
0 siblings, 1 reply; 4+ messages in thread
From: Jakub Jelinek @ 2004-05-04 14:53 UTC (permalink / raw)
To: Martin Schwidefsky; +Cc: binutils
Hi!
We were alocating just 15 bytes instead of (1 << alignment) - 1
(s390* MAX_MEM_FOR_RS_ALIGN_CODE), but then s390_align_code calls
memset (fragP->fr_literal + fragP->fr_fix, 0x07, count);
with the whole count, not just at most 15 bytes.
This lead to potential corruption of any fragments following fragP.
Ok to commit?
2004-05-04 Jakub Jelinek <jakub@redhat.com>
* config/tc-s390.h (md_do_align): Pass (1 << n) - 1 instead of 15
as max_chars to frag_var.
--- gas/config/tc-s390.h.jj 2003-07-10 15:03:13.000000000 +0200
+++ gas/config/tc-s390.h 2004-05-04 16:42:12.724802992 +0200
@@ -80,7 +80,7 @@ extern int target_big_endian;
if ((n) && !need_pass_2 && (fill == 0) && \
(bfd_get_section_flags (stdoutput, now_seg) & SEC_CODE) != 0) { \
char *p; \
- p = frag_var (rs_align_code, 15, 1, (relax_substateT) max, \
+ p = frag_var (rs_align_code, (1 << (n)) - 1, 1, (relax_substateT) max,\
(symbolS *) 0, (offsetT) (n), (char *) 0); \
*p = 0x07; \
goto around; \
Jakub
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Fix s390{,x} ld-size-1 failures
2004-05-04 14:53 [PATCH] Fix s390{,x} ld-size-1 failures Jakub Jelinek
@ 2004-05-05 6:23 ` Alan Modra
2004-05-05 7:20 ` [PATCH] Fix s390{,x} ld-size-1 failures (take 2) Jakub Jelinek
0 siblings, 1 reply; 4+ messages in thread
From: Alan Modra @ 2004-05-05 6:23 UTC (permalink / raw)
To: Jakub Jelinek; +Cc: Martin Schwidefsky, binutils
On Tue, May 04, 2004 at 02:41:25PM +0200, Jakub Jelinek wrote:
> * config/tc-s390.h (md_do_align): Pass (1 << n) - 1 instead of 15
> as max_chars to frag_var.
I don't think this is the right fix. It looks to me that s390 shouldn't
be defining md_do_align or HANDLE_ALIGN, as s390 gas doesn't do special
nop fill patterns.
--
Alan Modra
IBM OzLabs - Linux Technology Centre
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] Fix s390{,x} ld-size-1 failures (take 2)
2004-05-05 6:23 ` Alan Modra
@ 2004-05-05 7:20 ` Jakub Jelinek
2004-05-05 7:38 ` Alan Modra
0 siblings, 1 reply; 4+ messages in thread
From: Jakub Jelinek @ 2004-05-05 7:20 UTC (permalink / raw)
To: Alan Modra, Martin Schwidefsky; +Cc: binutils
On Wed, May 05, 2004 at 03:53:53PM +0930, Alan Modra wrote:
> On Tue, May 04, 2004 at 02:41:25PM +0200, Jakub Jelinek wrote:
> > * config/tc-s390.h (md_do_align): Pass (1 << n) - 1 instead of 15
> > as max_chars to frag_var.
>
> I don't think this is the right fix. It looks to me that s390 shouldn't
> be defining md_do_align or HANDLE_ALIGN, as s390 gas doesn't do special
> nop fill patterns.
Like this?
2004-05-05 Jakub Jelinek <jakub@redhat.com>
* tc-s390.h (md_do_align, HANDLE_ALIGN): Remove.
(NOP_OPCODE): Define.
(s390_align_code): Remove prototype.
* tc-s390.c (s390_align_code): Remove.
--- gas/config/tc-s390.h.jj 2003-07-10 15:03:13.000000000 +0200
+++ gas/config/tc-s390.h 2004-05-05 09:09:53.083575145 +0200
@@ -1,5 +1,5 @@
/* tc-s390.h -- Header file for tc-s390.c.
- Copyright 2000, 2001, 2002 Free Software Foundation, Inc.
+ Copyright 2000, 2001, 2002, 2004 Free Software Foundation, Inc.
Written by Martin Schwidefsky (schwidefsky@de.ibm.com).
This file is part of GAS, the GNU Assembler.
@@ -76,23 +76,7 @@ extern int target_big_endian;
#define md_number_to_chars number_to_chars_bigendian
-#define md_do_align(n, fill, len, max, around) \
-if ((n) && !need_pass_2 && (fill == 0) && \
- (bfd_get_section_flags (stdoutput, now_seg) & SEC_CODE) != 0) { \
- char *p; \
- p = frag_var (rs_align_code, 15, 1, (relax_substateT) max, \
- (symbolS *) 0, (offsetT) (n), (char *) 0); \
- *p = 0x07; \
- goto around; \
-}
-
-extern void s390_align_code PARAMS ((fragS *, int));
-
-#define HANDLE_ALIGN(fragP) \
-if (fragP->fr_type == rs_align_code) \
- s390_align_code (fragP, (fragP->fr_next->fr_address \
- - fragP->fr_address \
- - fragP->fr_fix));
+#define NOP_OPCODE 0x07
/* call md_pcrel_from_section, not md_pcrel_from */
#define MD_PCREL_FROM_SECTION(FIX, SEC) md_pcrel_from_section(FIX, SEC)
--- gas/config/tc-s390.c.jj 2004-03-03 18:44:03.000000000 +0100
+++ gas/config/tc-s390.c 2004-05-05 09:10:17.651172312 +0200
@@ -1,5 +1,5 @@
/* tc-s390.c -- Assemble for the S390
- Copyright 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+ Copyright 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
This file is part of GAS, the GNU Assembler.
@@ -540,19 +540,6 @@ s390_md_end ()
bfd_set_arch_mach (stdoutput, bfd_arch_s390, bfd_mach_s390_31);
}
-void
-s390_align_code (fragP, count)
- fragS *fragP;
- int count;
-{
- /* We use nop pattern 0x0707. */
- if (count > 0)
- {
- memset (fragP->fr_literal + fragP->fr_fix, 0x07, count);
- fragP->fr_var = count;
- }
-}
-
/* Insert an operand value into an instruction. */
static void
Jakub
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Fix s390{,x} ld-size-1 failures (take 2)
2004-05-05 7:20 ` [PATCH] Fix s390{,x} ld-size-1 failures (take 2) Jakub Jelinek
@ 2004-05-05 7:38 ` Alan Modra
0 siblings, 0 replies; 4+ messages in thread
From: Alan Modra @ 2004-05-05 7:38 UTC (permalink / raw)
To: Jakub Jelinek; +Cc: Martin Schwidefsky, binutils
On Wed, May 05, 2004 at 07:05:30AM +0200, Jakub Jelinek wrote:
> On Wed, May 05, 2004 at 03:53:53PM +0930, Alan Modra wrote:
> > On Tue, May 04, 2004 at 02:41:25PM +0200, Jakub Jelinek wrote:
> > > * config/tc-s390.h (md_do_align): Pass (1 << n) - 1 instead of 15
> > > as max_chars to frag_var.
> >
> > I don't think this is the right fix. It looks to me that s390 shouldn't
> > be defining md_do_align or HANDLE_ALIGN, as s390 gas doesn't do special
> > nop fill patterns.
>
> Like this?
Exactly. Please wait on an OK from Martin though.
> * tc-s390.h (md_do_align, HANDLE_ALIGN): Remove.
> (NOP_OPCODE): Define.
> (s390_align_code): Remove prototype.
> * tc-s390.c (s390_align_code): Remove.
--
Alan Modra
IBM OzLabs - Linux Technology Centre
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2004-05-05 7:38 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-05-04 14:53 [PATCH] Fix s390{,x} ld-size-1 failures Jakub Jelinek
2004-05-05 6:23 ` Alan Modra
2004-05-05 7:20 ` [PATCH] Fix s390{,x} ld-size-1 failures (take 2) Jakub Jelinek
2004-05-05 7:38 ` Alan Modra
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).