[PATCH] The behavior of gas .subsection/.previous does not confirm descriptions in document
Lee Duhem
lee.duhem@gmail.com
Mon Oct 8 04:13:00 GMT 2007
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 ();
More information about the Binutils
mailing list