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]

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


The documents says .subsection "replaces the current subsection with `name'.
The current section is not changed" and .previous "swaps the current section
(and subsection) with most recently referenced section (and subsection) prior
to this one." But the following two lines in obj_elf_subsection make this
impossible:

        previous_section = now_seg;
        previous_subsection = now_subseg;


If the document is right, for:

        .section sec1
        .long 0x11111111

        .subsection 1
        .long 0x22222222

        .pushsection sec2
        .subsection 1
        .long 0x66666666
        .long 0x77777777

        .subsection 0
        .long 0x55555555

        .previous
        .long 0x33333333

we will get:

        a.out:     file format elf32-i386

        Contents of section sec1:
         0000 11111111 22222222 33333333   ....""""3333
        Contents of section sec2:
         0000 55555555 66666666 77777777   UUUUffffwwww

instead of:

        a.out:     file format elf32-i386

        Contents of section sec1:
         0000 11111111 22222222                    ....""""
        Contents of section sec2:
         0000 55555555 66666666 77777777 33333333  UUUUffffwwww3333

Of course, if the document is wrong, it need to be fixed. But anyway,
suppose the document is right, the attached patch will fix this.

Am I miss some thing?

lee


Index: src/gas/config/obj-elf.c
===================================================================
RCS file: /cvs/src/src/gas/config/obj-elf.c,v
retrieving revision 1.104
diff -p -u -r1.104 obj-elf.c
--- src/gas/config/obj-elf.c    4 Oct 2007 17:05:37 -0000       1.104
+++ src/gas/config/obj-elf.c    8 Oct 2007 02:11:10 -0000
@@ -1095,9 +1095,6 @@ obj_elf_subsection (int ignore ATTRIBUTE
   md_flush_pending_output ();
 #endif

-  previous_section = now_seg;
-  previous_subsection = now_subseg;
-
   temp = get_absolute_expression ();
   subseg_set (now_seg, (subsegT) temp);
   demand_empty_rest_of_line ();


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