From: Andrew Waterman Date: Mon, 19 Dec 2016 06:53:49 +0000 (-0800) Subject: Fix an integer overflow in RISC-V relocation handling X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=1d61f7949f77796ee407466f3ca7f42dcde9251b;p=binutils-gdb.git Fix an integer overflow in RISC-V relocation handling * elfnn-riscv.c (bfd_riscv_get_max_alignment): Return bfd_vma instead of unsigned int. --- diff --git a/bfd/ChangeLog b/bfd/ChangeLog index b6bba2ac3e0..f2b1707e5a1 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,8 @@ +2016-12-20 Andrew Waterman + + * elfnn-riscv.c (bfd_riscv_get_max_alignment): Return bfd_vma + instead of unsigned int. + 2016-12-20 Andrew Waterman Kuan-Lin Chen diff --git a/bfd/elfnn-riscv.c b/bfd/elfnn-riscv.c index 51a2a10e03a..a9b0ac6be09 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. */