This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] The behavior of gas .subsection/.previous does not confirm descriptions in document


Hi Lee,

Here we are in sec2, subsection 1.

        .subsection 0
        .long 0x55555555
Now we are in sec2, subsection 0.

.previous
So .previous takes you back to sec2, subsection 1.

I think .previous takes me back to sec1 is more natural, because
for current section sec2, sec1 is the previous section(instead of sec2).

Possibly, but I think that it would be a bad idea to change the behaviour of the .previous pseudo-op now. There are bound to be assembler source files that rely upon the current behaviour.


But if the behavior of .subsection/.previous is intended, add some examples
in documents maybe helpful.

Agreed. What do you think of this patch ?


Cheers
  Nick

gas/ChangeLog
2007-10-08  Nick Clifton  <nickc@redhat.com>

	* doc/as.texinfo (Previous): Update description of this pseudo op
	and include a couple of examples of how it works.

Index: gas/doc/as.texinfo
===================================================================
RCS file: /cvs/src/src/gas/doc/as.texinfo,v
retrieving revision 1.168
diff -c -3 -p -r1.168 as.texinfo
*** gas/doc/as.texinfo	4 Oct 2007 17:05:37 -0000	1.168
--- gas/doc/as.texinfo	8 Oct 2007 09:59:12 -0000
*************** This is one of the ELF section stack man
*** 5346,5354 ****
  (@pxref{PopSection}).
  
  This directive swaps the current section (and subsection) with most recently
! referenced section (and subsection) prior to this one.  Multiple
  @code{.previous} directives in a row will flip between two sections (and their
! subsections).
  
  In terms of the section stack, this directive swaps the current section with
  the top section on the section stack.
--- 5346,5383 ----
  (@pxref{PopSection}).
  
  This directive swaps the current section (and subsection) with most recently
! referenced section/subsection pair prior to this one.  Multiple
  @code{.previous} directives in a row will flip between two sections (and their
! subsections).  For example:
! 
! @smallexample
! .section A
!  .subsection 1
!   .word 0x1234
!  .subsection 2
!   .word 0x5678
! .previous
!  .word 0x9abc
! @end smallexample
! 
! Will place 0x1234 and 0x9abc into subsection 1 and 0x5678 into subsection 2 of
! section A.  Whilst:
! 
! @smallexample
! .section A
!  .subsection 1
!   .word 0x1234
! .section B
!  .subsection 0
!   .word 0x5678
!  .subsection 1
!   .word 0x9abc
! .previous
!  .word 0xdef0
! @end smallexample
! 
! Will place 0x1234 into section A, 0x5678 and 0xdef0 into subsection 0 of
! section B and 0x9abc into subsection 1 of section B.
  
  In terms of the section stack, this directive swaps the current section with
  the top section on the section stack.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]