From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 49967 invoked by alias); 24 Apr 2015 12:53:06 -0000 Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org Received: (qmail 49957 invoked by uid 89); 24 Apr 2015 12:53:05 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL,BAYES_00,SPF_PASS autolearn=ham version=3.3.2 X-HELO: eu-smtp-delivery-143.mimecast.com Received: from eu-smtp-delivery-143.mimecast.com (HELO eu-smtp-delivery-143.mimecast.com) (146.101.78.143) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 24 Apr 2015 12:53:04 +0000 Received: from cam-owa2.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.140]) by uk-mta-19.uk.mimecast.lan; Fri, 24 Apr 2015 13:53:01 +0100 Received: from [10.2.207.14] ([10.1.2.79]) by cam-owa2.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.3959); Fri, 24 Apr 2015 13:53:01 +0100 Message-ID: <553A3CAD.3050208@arm.com> Date: Fri, 24 Apr 2015 12:53:00 -0000 From: Renlin Li User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: "binutils@sourceware.org" CC: Nicholas Clifton , Marcus Shawcroft , Richard Earnshaw Subject: [GAS][ARM]Positively emit symbols for alignment. X-MC-Unique: ENsxsZyYT729uyamhRzgFg-1 Content-Type: multipart/mixed; boundary="------------080204050305010608070207" X-IsSubscribed: yes X-SW-Source: 2015-04/txt/msg00381.txt.bz2 This is a multi-part message in MIME format. --------------080204050305010608070207 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable Content-length: 1901 Hi all, In arm_init_frag(), when ARM or THUMB are recorded, it will simply=20 return without doing anything. This is not correct in a few cases. For the following two cases: case 1: nop ----> MAP_ARM .long 0 ---> MAP_DATA .align 4 ---> ---->(1) ----> start new frag .word 0x12345678 (1) paddings here are all treated as data, because the previous state is=20 MAP_DATA. case 2: nop ----> MAP_ARM .long 0 ---> MAP_DATA .byte 1 .align 2 ---> (1) ----> (2) ----> start new frag .long 0x12345678 ----> (3) stage 1: while parsing the input file: (1) arm_init_frag early returns, No state change, no new symbol. (3)No=20 state change, no new symbol. stage 2: Later, while writing the object file: (2)MAP_DATA, MAP_ARM are inserted by insert_data_mapping_symol to handle=20 alignment. (3) interpreted as instruction because of the MAP_ARM=20 inserted at (2) This change might generate redundant symbols, some of them can be=20 removed later. In check_mapping_symbols(), the symbols at the end of a=20 section, and overlapping symbols will be removed. gas checked without any new issues. Okay to commit? By the way, Nick, aarch64 has the same issue. The same can be done to=20 aarch64_init_frag(). Another way is to remove=20 fragP->tc_frag_data.recorded. It's only used in a few places. But I am=20 sure what dose it intended to do, Could you please explain a little bit=20 for me? Regards, Renlin Li gas/ChangeLog: 2015-04-24 Renlin Li * config/tc-arm.c (arm_init_frag): Always emit mapping symbols. gas/testsuite/ChangeLog: 2015-04-24 Renlin Li * gas/arm/thumb2_vpool_be.d: Adjust the desired output. * gas/arm/vldconst_be.d: Ditto. --------------080204050305010608070207 Content-Type: text/x-patch; name=3.diff Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="3.diff" Content-length: 4005 diff --git a/gas/config/tc-arm.c b/gas/config/tc-arm.c index b17ea6c..5fa2790 100644 --- a/gas/config/tc-arm.c +++ b/gas/config/tc-arm.c @@ -21015,24 +21015,22 @@ arm_init_frag (fragS * fragP, int max_chars) /* If the current ARM vs THUMB mode has not already been recorded into this frag then do so now. */ if ((fragP->tc_frag_data.thumb_mode & MODE_RECORDED) =3D=3D 0) - { fragP->tc_frag_data.thumb_mode =3D thumb_mode | MODE_RECORDED; =20 - /* Record a mapping symbol for alignment frags. We will delete this - later if the alignment ends up empty. */ - switch (fragP->fr_type) - { - case rs_align: - case rs_align_test: - case rs_fill: - mapping_state_2 (MAP_DATA, max_chars); - break; - case rs_align_code: - mapping_state_2 (thumb_mode ? MAP_THUMB : MAP_ARM, max_chars); - break; - default: - break; - } + /* Record a mapping symbol for alignment frags. We will delete this + later if the alignment ends up empty. */ + switch (fragP->fr_type) + { + case rs_align: + case rs_align_test: + case rs_fill: + mapping_state_2 (MAP_DATA, max_chars); + break; + case rs_align_code: + mapping_state_2 (thumb_mode ? MAP_THUMB : MAP_ARM, max_chars); + break; + default: + break; } } =20 diff --git a/gas/testsuite/gas/arm/thumb2_vpool_be.d b/gas/testsuite/gas/ar= m/thumb2_vpool_be.d index 816cddc..15aafa5 100644 --- a/gas/testsuite/gas/arm/thumb2_vpool_be.d +++ b/gas/testsuite/gas/arm/thumb2_vpool_be.d @@ -125,8 +125,7 @@ Disassembly of section .text: 000001c8 0ff00fff .word 0x0ff00fff 000001cc f0000000 .word 0xf0000000 000001d0 ed9f 1b01 vldr d1, \[pc, #4\] ; 000001d8 -000001d4 0000 movs r0, r0 -000001d6 0000 movs r0, r0 +000001d4 00000000 .word 0x00000000 000001d8 0000fff0 .word 0x0000fff0 000001dc 00000000 .word 0x00000000 000001e0 f101 0000 add.w r0, r1, #0 @@ -150,8 +149,7 @@ Disassembly of section .text: 00000228 eddf 7a03 vldr s15, \[pc, #12\] ; 00000238 <= thumb2_ldr\+0x238> 0000022c eddf 0b14 vldr d16, \[pc, #80\] ; 00000280 <= thumb2_ldr\+0x280> 00000230 eddf 1b15 vldr d17, \[pc, #84\] ; 00000288 <= thumb2_ldr\+0x288> -00000234 0000 movs r0, r0 -00000236 0000 movs r0, r0 +00000234 00000000 .word 0x00000000 00000238 0000fff0 .word 0x0000fff0 0000023c 00000000 .word 0x00000000 00000240 ff000000 .word 0xff000000 diff --git a/gas/testsuite/gas/arm/vldconst_be.d b/gas/testsuite/gas/arm/vl= dconst_be.d index cf3dbf9..f99371b 100644 --- a/gas/testsuite/gas/arm/vldconst_be.d +++ b/gas/testsuite/gas/arm/vldconst_be.d @@ -236,7 +236,7 @@ Disassembly of section .text: 00000388 0000fff0 .word 0x0000fff0 0000038c 00000000 .word 0x00000000 00000390 ed9f1b00 vldr d1, \[pc\] ; 00000398 -00000394 00000000 andeq r0, r0, r0 +00000394 00000000 .word 0x00000000 00000398 0000fff0 .word 0x0000fff0 0000039c 00000000 .word 0x00000000 000003a0 e2810000 add r0, r1, #0 @@ -260,7 +260,7 @@ Disassembly of section .text: 000003e8 eddf7a02 vldr s15, \[pc, #8\] ; 000003f8 000003ec eddf0b13 vldr d16, \[pc, #76\] ; 00000440 000003f0 eddf1b14 vldr d17, \[pc, #80\] ; 00000448 -000003f4 00000000 andeq r0, r0, r0 +000003f4 00000000 .word 0x00000000 000003f8 0000fff0 .word 0x0000fff0 000003fc 00000000 .word 0x00000000 00000400 ff000000 .word 0xff000000 --------------080204050305010608070207--