[GAS][AARCH64]Don't try to align insn in non-executale section.

Renlin Li renlin.li@arm.com
Mon Apr 20 10:34:00 GMT 2015


Hi all,

After my previous patch, instruction will always try to align itself in 
non-text section. https://sourceware.org/ml/binutils/2015-03/msg00389.html

However, this is not required. Only the text section has strict 
alignment requirements. For other section, just leave as it is.
This fixes the latest Linux kernel build with aarch64 tool-chain.

We have got the following assembler in kernel code. 
.altinstr_replacement is not a executable section. with the previous 
patch, gas will try to align the ldarb insn, creating a new frag which 
is different for the one .L663 in.
".if" directive later complains about this: '''Error: non-constant 
expression in ".if" statement'''

661:
      ldrb w3, [x1]
662:
.pushsection .altinstructions,"a"
.word 661b - .
.word 663f - .
.hword 1
.byte 662b-661b
.byte 664f-663f
.popsection
.pushsection .altinstr_replacement, "a"
663:
      ldarb w3, [x1]
664:
      .popsection
      .if ((664b-663b) != (662b-661b))
          .error "Alternatives instruction length mismatch"
      .endif


With the patch, the behavior should be restored. Binuitls regression 
test runs Okay.
Okay to commit?

Regards,
Renlin Li

gas/ChangeLog:

2015-04-20  Renlin Li  <renlin.li@arm.com>

      * config/tc-aarch64.c (s_aarch64_inst): Don't align code for non-text
      section.
      (md_assemble): Likewise, move the align code outside the loop.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.diff
Type: text/x-patch
Size: 2106 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20150420/96f3aa86/attachment.bin>


More information about the Binutils mailing list