From 29f628db8835fd86b85ffb40d4a9ed5b1c28f1e6 Mon Sep 17 00:00:00 2001 From: Dominik Vogt Date: Mon, 9 Nov 2015 17:12:56 +0100 Subject: bfd: Fix left shift of negative value. This patch fixes all occurences of left-shifting negative constants in C code which is undefined by the C standard. bfd/ChangeLog: * elf64-ppc.c (ppc64_elf_size_stubs, ppc64_elf_build_stubs): Fix left shift of negative value. * libbfd.c (safe_read_leb128): Likewise. * dwarf2.c (place_sections): Likewise. * bfd-in.h (align_power): Likewise. * bfd-in2.h (align_power): Likewise. --- bfd/dwarf2.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'bfd/dwarf2.c') diff --git a/bfd/dwarf2.c b/bfd/dwarf2.c index cbd4cf6..401ec43 100644 --- a/bfd/dwarf2.c +++ b/bfd/dwarf2.c @@ -3354,8 +3354,8 @@ place_sections (bfd *orig_bfd, struct dwarf2_debug *stash) /* Align the new address to the current section alignment. */ last_vma = ((last_vma - + ~((bfd_vma) -1 << sect->alignment_power)) - & ((bfd_vma) -1 << sect->alignment_power)); + + ~(-((bfd_vma) 1 << sect->alignment_power))) + & (-((bfd_vma) 1 << sect->alignment_power))); sect->vma = last_vma; last_vma += sz; } -- cgit v1.1