aboutsummaryrefslogtreecommitdiff
path: root/bfd/elfnn-riscv.c
diff options
context:
space:
mode:
authorAndrew Waterman <andrew@sifive.com>2016-12-18 22:53:49 -0800
committerAlan Modra <amodra@gmail.com>2016-12-20 12:26:33 +1030
commit1d61f7949f77796ee407466f3ca7f42dcde9251b (patch)
tree211118dfa45c495a60a49de0bde53c6973489c29 /bfd/elfnn-riscv.c
parent45f764234a71431b581340957a3c8338e0593fdb (diff)
downloadgdb-1d61f7949f77796ee407466f3ca7f42dcde9251b.zip
gdb-1d61f7949f77796ee407466f3ca7f42dcde9251b.tar.gz
gdb-1d61f7949f77796ee407466f3ca7f42dcde9251b.tar.bz2
Fix an integer overflow in RISC-V relocation handling
* elfnn-riscv.c (bfd_riscv_get_max_alignment): Return bfd_vma instead of unsigned int.
Diffstat (limited to 'bfd/elfnn-riscv.c')
-rw-r--r--bfd/elfnn-riscv.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/bfd/elfnn-riscv.c b/bfd/elfnn-riscv.c
index 51a2a10..a9b0ac6 100644
--- a/bfd/elfnn-riscv.c
+++ b/bfd/elfnn-riscv.c
@@ -2759,7 +2759,7 @@ _bfd_riscv_relax_call (bfd *abfd, asection *sec, asection *sym_sec,
/* Traverse all output sections and return the max alignment. */
-static unsigned int
+static bfd_vma
_bfd_riscv_get_max_alignment (asection *sec)
{
unsigned int max_alignment_power = 0;
@@ -2771,7 +2771,7 @@ _bfd_riscv_get_max_alignment (asection *sec)
max_alignment_power = o->alignment_power;
}
- return 1 << max_alignment_power;
+ return (bfd_vma) 1 << max_alignment_power;
}
/* Relax non-PIC global variable references. */