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

Renlin Li renlin.li@arm.com
Fri Mar 27 16:37:00 GMT 2015


Hi all,

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.

scale_addr_delta will fail because the addr_delta (for the above asm 
code in aarch64 case, it is 5) are not aligned to 
DWARF2_LINE_MIN_INSN_LENGTH.

This is a common problem. I have tested on the following targets: arm, 
aarch64, arc, sparc, m68k, sh, hppa. They all suffers.

AFAIK, ia64 and sh64 both set it 1. Is there a general fix for this?
Another solution is to call frag_align() in md_cleanup(), but this 
causes several regressions. or we can only hack it this way currently?


gas/ChangeLog:

2015-03-27  Renlin Li  <renlin.li@arm.com>

     * config/tc-aarch64.h: set DWARF2_LINE_MIN_INSN_LENGTH
         to 1.
     * config/tc-arm.h: Likewise.


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


More information about the Binutils mailing list