This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[PATCH] RISC-V: Don't emit 2-byte NOPs if the C extension is disabled
- From: Palmer Dabbelt <palmer at dabbelt dot com>
- To: binutils at sourceware dot org
- Cc: patches at groups dot riscv dot org, Palmer Dabbelt <palmer at dabbelt dot com>
- Date: Fri, 20 Oct 2017 16:05:59 -0700
- Subject: [PATCH] RISC-V: Don't emit 2-byte NOPs if the C extension is disabled
- Authentication-results: sourceware.org; auth=none
Systems without the C extension mandate 4-byte alignment for
instructions, so there is no reason to allow for 2-byte alignment. This
change avoids emitting lots of unimplemented instructions into object
files on non-C targets, which users keep reporting as a bug. While this
isn't actually a bug (as none of the offsets in object files are
relevant until RISC-V), it is ugly.
gas/ChangeLog
2017-10-20 Palmer Dabbelt <palmer@dabbelt.com>
* config/tc-riscv.c (riscv_frag_align_code): Align code by 4
bytes on non-RVC systems.
---
gas/config/tc-riscv.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gas/config/tc-riscv.c b/gas/config/tc-riscv.c
index 189e40d11c7f..f4276c9fb5eb 100644
--- a/gas/config/tc-riscv.c
+++ b/gas/config/tc-riscv.c
@@ -2277,7 +2277,7 @@ bfd_boolean
riscv_frag_align_code (int n)
{
bfd_vma bytes = (bfd_vma) 1 << n;
- bfd_vma worst_case_bytes = bytes - 2;
+ bfd_vma worst_case_bytes = bytes - (riscv_opts.rvc ? 2 : 4);
char *nops = frag_more (worst_case_bytes);
expressionS ex;
--
2.13.6