Fix an integer overflow in RISC-V relocation handling

* elfnn-riscv.c (bfd_riscv_get_max_alignment): Return bfd_vma
	instead of unsigned int.
This commit is contained in:
Andrew Waterman 2016-12-18 22:53:49 -08:00 committed by Alan Modra
parent 45f764234a
commit 1d61f7949f
2 changed files with 7 additions and 2 deletions

View File

@ -1,3 +1,8 @@
2016-12-20 Andrew Waterman <andrew@sifive.com>
* elfnn-riscv.c (bfd_riscv_get_max_alignment): Return bfd_vma
instead of unsigned int.
2016-12-20 Andrew Waterman <andrew@sifive.com>
Kuan-Lin Chen <kuanlinchentw@gmail.com>

View File

@ -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. */