This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[RFC][ARM][AARCH64] Set DWARF2_LINE_MIN_INSN_LENGTH to 1
- From: Renlin Li <renlin dot li at arm dot com>
- To: "binutils at sourceware dot org" <binutils at sourceware dot org>
- Cc: Marcus Shawcroft <Marcus dot Shawcroft at arm dot com>, Nicholas Clifton <nickc at redhat dot com>
- Date: Fri, 27 Mar 2015 16:37:45 +0000
- Subject: [RFC][ARM][AARCH64] Set DWARF2_LINE_MIN_INSN_LENGTH to 1
- Authentication-results: sourceware.org; auth=none
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.
diff --git a/gas/config/tc-aarch64.h b/gas/config/tc-aarch64.h
index 19b9eae..8b58a34 100644
--- a/gas/config/tc-aarch64.h
+++ b/gas/config/tc-aarch64.h
@@ -146,7 +146,7 @@ struct aarch64_frag_type
goto LABEL; \
}
-#define DWARF2_LINE_MIN_INSN_LENGTH 4
+#define DWARF2_LINE_MIN_INSN_LENGTH 1
/* The lr register is r30. */
#define DWARF2_DEFAULT_RETURN_COLUMN 30
diff --git a/gas/config/tc-arm.h b/gas/config/tc-arm.h
index 91db285..54d76f1 100644
--- a/gas/config/tc-arm.h
+++ b/gas/config/tc-arm.h
@@ -248,7 +248,7 @@ struct arm_frag_type
goto LABEL; \
}
-#define DWARF2_LINE_MIN_INSN_LENGTH 2
+#define DWARF2_LINE_MIN_INSN_LENGTH 1
/* The lr register is r14. */
#define DWARF2_DEFAULT_RETURN_COLUMN 14