diff options
author | Andrew Waterman <waterman@cs.berkeley.edu> | 2015-09-17 17:12:46 -0700 |
---|---|---|
committer | Palmer Dabbelt <palmer.dabbelt@eecs.berkeley.edu> | 2015-09-19 00:34:12 -0700 |
commit | 11c69401b1225965d9929f0ba4018deaca5ea0b9 (patch) | |
tree | 038c8fb84720a562916bba703979eb83b594cd3f /binutils | |
parent | 54f01e7959eb9be24bf9b2bf06b5657233b8ee6e (diff) | |
download | riscv-gnu-toolchain-11c69401b1225965d9929f0ba4018deaca5ea0b9.zip riscv-gnu-toolchain-11c69401b1225965d9929f0ba4018deaca5ea0b9.tar.gz riscv-gnu-toolchain-11c69401b1225965d9929f0ba4018deaca5ea0b9.tar.bz2 |
binutils: add LUI reloc overflow check
Diffstat (limited to 'binutils')
-rw-r--r-- | binutils/bfd/elfnn-riscv.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/binutils/bfd/elfnn-riscv.c b/binutils/bfd/elfnn-riscv.c index 53b28a0..d430c94 100644 --- a/binutils/bfd/elfnn-riscv.c +++ b/binutils/bfd/elfnn-riscv.c @@ -1482,6 +1482,8 @@ perform_relocation (const reloc_howto_type *howto, case R_RISCV_GOT_HI20: case R_RISCV_TLS_GOT_HI20: case R_RISCV_TLS_GD_HI20: + if (!VALID_UTYPE_IMM (RISCV_CONST_HIGH_PART (value))) + return bfd_reloc_overflow; value = ENCODE_UTYPE_IMM (RISCV_CONST_HIGH_PART (value)); break; |