[RFC][ARM][AARCH64] Set DWARF2_LINE_MIN_INSN_LENGTH to 1

Nicholas Clifton nickc@redhat.com
Wed Apr 1 16:01:00 GMT 2015


Hi Renlin,

> If any cases left the last frag unaligned(size of the frag) to
> DWARF2_LINE_MIN_INSN_LENGTH, and assembled with -gdwarf-2 flag,
> The following error will be triggered.
>
> '''Error: unaligned opcodes detected in executable segment'''.
>
> For the following code snippet;
>
> .text
> ret
> .byte 0xf  --> data in .text section, minimum size is different.

I do not think that this is a bug.  The assembler is correctly reporting 
that the user has created a code section that ends not on a code 
alignment boundary.  It does appear however that this kind of thing is 
expected to work.  (See eg gas/testsuite/gas/elf/section7.s).  So maybe 
a solution is needed.

Setting DWARF2_LINE_MIN_INSN_LENGTH to 1 seems wrong to me.  For the 
normal case we want to use a dwarf insn length that matches the 
architecture's insn length.  So instead, how about the attached patch? 
It changes the dwarf2dbg.c code so that it computes a maximum allowable 
value for DWARF2_LINE_MIN_INSN_LENGTH automatically, using the target 
supplied value as a starting point, but reducing it if necessary to 
support pathological assembly programming.

What do you think ?

Cheers
   Nick








-------------- next part --------------
A non-text attachment was scrubbed...
Name: dwarf2_line_min_insn_length.patch
Type: text/x-patch
Size: 5162 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20150401/4b71ce28/attachment.bin>


More information about the Binutils mailing list