public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* gas patch: Check TC_EOL_IN_INSN in input-scrub.c
@ 2006-10-05 14:33 Bernd Schmidt
  2006-10-13 11:37 ` Nick Clifton
  0 siblings, 1 reply; 3+ messages in thread
From: Bernd Schmidt @ 2006-10-05 14:33 UTC (permalink / raw)
  To: binutils

[-- Attachment #1: Type: text/plain, Size: 469 bytes --]

The Blackfin port tries to use TC_EOL_IN_INSN to check for multi-line 
parallel instructions that have one of the following forms:

	R0 = R0 +|- R1 ||
	R1.L = [I0] ||
	NOP;

or
	R0 = R0 +|- R1
	|| R1.L = [I0]
	|| NOP;

Sometimes this fails because we're not looking at a large enough buffer, 
and parts of the insn get cut off.  We've fixed this in our local 
sources with the following patch - is this ok for mainline?  Any 
suggestions for a better approach?


Bernd

[-- Attachment #2: scrub.diff --]
[-- Type: text/plain, Size: 1324 bytes --]

	* input-scrub.c (input_scrub_next_buffer): Use TC_EOL_IN_INSN
	in addition to testing for '\n'.

Index: gas/input-scrub.c
===================================================================
RCS file: /cvsroot/gcc3/binutils/binutils-2.17/gas/input-scrub.c,v
retrieving revision 1.1
retrieving revision 1.3
diff -c -p -r1.1 -r1.3
*** gas/input-scrub.c	28 Jun 2006 15:54:14 -0000	1.1
--- gas/input-scrub.c	31 Jul 2006 13:47:25 -0000	1.3
*************** input_scrub_next_buffer (char **bufp)
*** 342,349 ****
    if (limit)
      {
        register char *p;		/* Find last newline.  */
! 
!       for (p = limit - 1; *p != '\n'; --p)
  	;
        ++p;
  
--- 342,350 ----
    if (limit)
      {
        register char *p;		/* Find last newline.  */
!       /* Terminate the buffer to avoid confusing TC_EOL_IN_INSN.  */
!       *limit = '\0';
!       for (p = limit - 1; *p != '\n' || TC_EOL_IN_INSN (p); --p)
  	;
        ++p;
  
*************** input_scrub_next_buffer (char **bufp)
*** 369,375 ****
  	      return NULL;
  	    }
  
! 	  for (p = limit - 1; *p != '\n'; --p)
  	    ;
  	  ++p;
  	}
--- 370,378 ----
  	      return NULL;
  	    }
  
! 	  /* Terminate the buffer to avoid confusing TC_EOL_IN_INSN.  */
! 	  *limit = '\0';
! 	  for (p = limit - 1; *p != '\n' || TC_EOL_IN_INSN (p); --p)
  	    ;
  	  ++p;
  	}

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

* Re: gas patch: Check TC_EOL_IN_INSN in input-scrub.c
  2006-10-05 14:33 gas patch: Check TC_EOL_IN_INSN in input-scrub.c Bernd Schmidt
@ 2006-10-13 11:37 ` Nick Clifton
  2006-10-16 20:53   ` Bernd Schmidt
  0 siblings, 1 reply; 3+ messages in thread
From: Nick Clifton @ 2006-10-13 11:37 UTC (permalink / raw)
  To: Bernd Schmidt; +Cc: binutils

Hi Bernd,

> 	* input-scrub.c (input_scrub_next_buffer): Use TC_EOL_IN_INSN
> 	in addition to testing for '\n'.

Approved - please apply.

(I looked at the code and did not see any obvious way to fix this 
problem other than your solution).

Cheers
   Nick

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

* Re: gas patch: Check TC_EOL_IN_INSN in input-scrub.c
  2006-10-13 11:37 ` Nick Clifton
@ 2006-10-16 20:53   ` Bernd Schmidt
  0 siblings, 0 replies; 3+ messages in thread
From: Bernd Schmidt @ 2006-10-16 20:53 UTC (permalink / raw)
  To: Nick Clifton; +Cc: binutils

[-- Attachment #1: Type: text/plain, Size: 433 bytes --]

Nick Clifton wrote:
> Hi Bernd,
> 
>>     * input-scrub.c (input_scrub_next_buffer): Use TC_EOL_IN_INSN
>>     in addition to testing for '\n'.
> 
> Approved - please apply.
> 
> (I looked at the code and did not see any obvious way to fix this 
> problem other than your solution).

Thanks.  I've had to add a default definition of TC_EOL_IN_INSN as it 
otherwise failed to compile on i686-linux.  Here's what I committed.


Bernd


[-- Attachment #2: scrub2.diff --]
[-- Type: text/plain, Size: 2228 bytes --]

Index: ChangeLog
===================================================================
RCS file: /cvs/src/src/gas/ChangeLog,v
retrieving revision 1.3023
diff -c -p -r1.3023 ChangeLog
*** ChangeLog	13 Oct 2006 11:36:02 -0000	1.3023
--- ChangeLog	16 Oct 2006 11:58:37 -0000
***************
*** 1,3 ****
--- 1,9 ----
+ 2006-10-16  Bernd Schmidt  <bernd.schmidt@analog.com>
+ 
+ 	* input-scrub.c (input_scrub_next_buffer): Use TC_EOL_IN_INSN
+ 	in addition to testing for '\n'.
+ 	(TC_EOL_IN_INSN): Provide a default definition if necessary.
+ 
  2006-10-13  Sterling Augstine  <sterling@tensilica.com>
  
  	* dwarf2dbg.c (out_debug_info): Use TC_DWARF2_EMIT_OFFSET to emit
Index: input-scrub.c
===================================================================
RCS file: /cvs/src/src/gas/input-scrub.c,v
retrieving revision 1.16
diff -c -p -r1.16 input-scrub.c
*** input-scrub.c	7 Jun 2006 11:27:57 -0000	1.16
--- input-scrub.c	16 Oct 2006 11:58:37 -0000
***************
*** 56,61 ****
--- 56,65 ----
  #define BEFORE_SIZE (1)
  #define AFTER_SIZE  (1)
  
+ #ifndef TC_EOL_IN_INSN
+ #define TC_EOL_IN_INSN(P) 0
+ #endif
+ 
  static char *buffer_start;	/*->1st char of full buffer area.  */
  static char *partial_where;	/*->after last full line in buffer.  */
  static int partial_size;	/* >=0. Number of chars in partial line in buffer.  */
*************** input_scrub_next_buffer (char **bufp)
*** 341,348 ****
    if (limit)
      {
        register char *p;		/* Find last newline.  */
! 
!       for (p = limit - 1; *p != '\n'; --p)
  	;
        ++p;
  
--- 345,353 ----
    if (limit)
      {
        register char *p;		/* Find last newline.  */
!       /* Terminate the buffer to avoid confusing TC_EOL_IN_INSN.  */
!       *limit = '\0';
!       for (p = limit - 1; *p != '\n' || TC_EOL_IN_INSN (p); --p)
  	;
        ++p;
  
*************** input_scrub_next_buffer (char **bufp)
*** 368,374 ****
  	      return NULL;
  	    }
  
! 	  for (p = limit - 1; *p != '\n'; --p)
  	    ;
  	  ++p;
  	}
--- 373,381 ----
  	      return NULL;
  	    }
  
! 	  /* Terminate the buffer to avoid confusing TC_EOL_IN_INSN.  */
! 	  *limit = '\0';
! 	  for (p = limit - 1; *p != '\n' || TC_EOL_IN_INSN (p); --p)
  	    ;
  	  ++p;
  	}

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

end of thread, other threads:[~2006-10-16 12:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-10-05 14:33 gas patch: Check TC_EOL_IN_INSN in input-scrub.c Bernd Schmidt
2006-10-13 11:37 ` Nick Clifton
2006-10-16 20:53   ` Bernd Schmidt

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