From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25632 invoked by alias); 13 Apr 2005 13:41:20 -0000 Mailing-List: contact binutils-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sources.redhat.com Received: (qmail 25559 invoked from network); 13 Apr 2005 13:41:00 -0000 Received: from unknown (HELO emea1-mh.id2.novell.com) (195.33.99.129) by sourceware.org with SMTP; 13 Apr 2005 13:41:00 -0000 Received: from EMEA1-MTA by emea1-mh.id2.novell.com with Novell_GroupWise; Wed, 13 Apr 2005 14:40:59 +0200 Message-Id: Date: Wed, 13 Apr 2005 13:41:00 -0000 From: "Jan Beulich" To: Subject: [PATCH] ELF: make .struct interact with .previous Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__Part25063773.0__=" X-SW-Source: 2005-04/txt/msg00313.txt.bz2 This is a MIME message. If you are reading this text, you may want to consider changing to a mail reader or gateway that understands how to properly handle MIME multipart messages. --=__Part25063773.0__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Content-length: 2808 struct did not interact correctly with ELF's .previous. Built and tested on i686-pc-linux-gnu. Jan gas/ 2005-04-13 Jan Beulich * config/obj-elf.c (obj_elf_struct): New. (elf_pseudo_table). Use it for .offset and .struct. gas/testsuite/ 2005-04-13 Jan Beulich * gas/elf/struct.[sd]: New. * gas/elf/elf.exp: Run new test. --- /home/jbeulich/src/binutils/mainline/2005-04-11/gas/config/obj-elf.c 20= 05-02-28 08:27:13.000000000 +0100 +++ 2005-04-11/gas/config/obj-elf.c 2005-04-13 15:25:24.000000000 +0200 @@ -65,6 +65,7 @@ static void obj_elf_subsection (int); static void obj_elf_popsection (int); static void obj_elf_tls_common (int); static void obj_elf_lcomm (int); +static void obj_elf_struct (int); =20 static const pseudo_typeS elf_pseudo_table[] =3D { @@ -113,6 +114,8 @@ static const pseudo_typeS elf_pseudo_tab =20 /* We need to trap the section changing calls to handle .previous. */ {"data", obj_elf_data, 0}, + {"offset", obj_elf_struct, 0}, + {"struct", obj_elf_struct, 0}, {"text", obj_elf_text, 0}, =20 {"tls_common", obj_elf_tls_common, 0}, @@ -1036,6 +1039,24 @@ obj_elf_text (int i) #endif } =20 +/* Change to the *ABS* section. */ + +void +obj_elf_struct (int i) +{ +#ifdef md_flush_pending_output + md_flush_pending_output (); +#endif + + previous_section =3D now_seg; + previous_subsection =3D now_subseg; + s_struct (i); + +#ifdef md_elf_section_change_hook + md_elf_section_change_hook (); +#endif +} + static void obj_elf_subsection (int ignore ATTRIBUTE_UNUSED) { --- /home/jbeulich/src/binutils/mainline/2005-04-11/gas/testsuite/gas/elf/e= lf.exp 2005-01-18 10:43:34.000000000 +0100 +++ 2005-04-11/gas/testsuite/gas/elf/elf.exp 2005-04-13 15:26:20.000000000 = +0200 @@ -61,6 +61,7 @@ if { ([istarget "*-*-*elf*"]=09=09 run_dump_test "section3"=20 run_dump_test "section4" run_list_test "section5" "" "-al" "-SW" "| grep \" \\\\.test\\\[0-9\\\= ]\""=20 + run_dump_test "struct"=20 run_dump_test "symver"=20 run_list_test "type" "" "" "-s" "| grep \"1 \\\[FONT\\\]\""=20 } --- /home/jbeulich/src/binutils/mainline/2005-04-11/gas/testsuite/gas/elf/s= truct.d 1970-01-01 01:00:00.000000000 +0100 +++ 2005-04-11/gas/testsuite/gas/elf/struct.d 2005-04-12 11:48:51.000000000= +0200 @@ -0,0 +1,10 @@ +#nm: --extern-only +#name: struct + +# Test the .struct pseudo-op. + +0+0 D l1 +0+4 D l2 +0+1 A w1 +0+3 A w2 +0+5 A w3 --- /home/jbeulich/src/binutils/mainline/2005-04-11/gas/testsuite/gas/elf/s= truct.s 1970-01-01 01:00:00.000000000 +0100 +++ 2005-04-11/gas/testsuite/gas/elf/struct.s 2005-04-12 11:45:06.000000000= +0200 @@ -0,0 +1,9 @@ + .globl w1, w2, w3, l1, l2 + .data +l1: .long 0 + .struct 1 +w1: .short 0 +w2: .short 0 +w3: .short 0 + .previous +l2: .long 0 --=__Part25063773.0__= Content-Type: text/plain; name="binutils-mainline-elf-struct.patch" Content-Transfer-Encoding: 8bit Content-Disposition: attachment; filename="binutils-mainline-elf-struct.patch" Content-length: 2760 struct did not interact correctly with ELF's .previous. Built and tested on i686-pc-linux-gnu. Jan gas/ 2005-04-13 Jan Beulich * config/obj-elf.c (obj_elf_struct): New. (elf_pseudo_table). Use it for .offset and .struct. gas/testsuite/ 2005-04-13 Jan Beulich * gas/elf/struct.[sd]: New. * gas/elf/elf.exp: Run new test. --- /home/jbeulich/src/binutils/mainline/2005-04-11/gas/config/obj-elf.c 2005-02-28 08:27:13.000000000 +0100 +++ 2005-04-11/gas/config/obj-elf.c 2005-04-13 15:25:24.000000000 +0200 @@ -65,6 +65,7 @@ static void obj_elf_subsection (int); static void obj_elf_popsection (int); static void obj_elf_tls_common (int); static void obj_elf_lcomm (int); +static void obj_elf_struct (int); static const pseudo_typeS elf_pseudo_table[] = { @@ -113,6 +114,8 @@ static const pseudo_typeS elf_pseudo_tab /* We need to trap the section changing calls to handle .previous. */ {"data", obj_elf_data, 0}, + {"offset", obj_elf_struct, 0}, + {"struct", obj_elf_struct, 0}, {"text", obj_elf_text, 0}, {"tls_common", obj_elf_tls_common, 0}, @@ -1036,6 +1039,24 @@ obj_elf_text (int i) #endif } +/* Change to the *ABS* section. */ + +void +obj_elf_struct (int i) +{ +#ifdef md_flush_pending_output + md_flush_pending_output (); +#endif + + previous_section = now_seg; + previous_subsection = now_subseg; + s_struct (i); + +#ifdef md_elf_section_change_hook + md_elf_section_change_hook (); +#endif +} + static void obj_elf_subsection (int ignore ATTRIBUTE_UNUSED) { --- /home/jbeulich/src/binutils/mainline/2005-04-11/gas/testsuite/gas/elf/elf.exp 2005-01-18 10:43:34.000000000 +0100 +++ 2005-04-11/gas/testsuite/gas/elf/elf.exp 2005-04-13 15:26:20.000000000 +0200 @@ -61,6 +61,7 @@ if { ([istarget "*-*-*elf*"] run_dump_test "section3" run_dump_test "section4" run_list_test "section5" "" "-al" "-SW" "| grep \" \\\\.test\\\[0-9\\\]\"" + run_dump_test "struct" run_dump_test "symver" run_list_test "type" "" "" "-s" "| grep \"1 \\\[FONT\\\]\"" } --- /home/jbeulich/src/binutils/mainline/2005-04-11/gas/testsuite/gas/elf/struct.d 1970-01-01 01:00:00.000000000 +0100 +++ 2005-04-11/gas/testsuite/gas/elf/struct.d 2005-04-12 11:48:51.000000000 +0200 @@ -0,0 +1,10 @@ +#nm: --extern-only +#name: struct + +# Test the .struct pseudo-op. + +0+0 D l1 +0+4 D l2 +0+1 A w1 +0+3 A w2 +0+5 A w3 --- /home/jbeulich/src/binutils/mainline/2005-04-11/gas/testsuite/gas/elf/struct.s 1970-01-01 01:00:00.000000000 +0100 +++ 2005-04-11/gas/testsuite/gas/elf/struct.s 2005-04-12 11:45:06.000000000 +0200 @@ -0,0 +1,9 @@ + .globl w1, w2, w3, l1, l2 + .data +l1: .long 0 + .struct 1 +w1: .short 0 +w2: .short 0 +w3: .short 0 + .previous +l2: .long 0 --=__Part25063773.0__=--