summaryrefslogtreecommitdiffstats
path: root/bfd
diff options
context:
space:
mode:
authorDoug Gilbert <dgilbert999@users.noreply.github.com>2017-02-15 11:25:51 -0600
committerGitHub <noreply@github.com>2017-02-15 11:25:51 -0600
commit48b125d266b5776711a6b70886f6bf64fe168c84 (patch)
tree04598b483570648284bb93fcff2b4ba540f3f529 /bfd
parent5b161fc30519a965f16e7e73c3410a388140cba1 (diff)
parent65f124c64b37ab763c224819271bdeecafec3da0 (diff)
downloadppe42-binutils-48b125d266b5776711a6b70886f6bf64fe168c84.tar.gz
ppe42-binutils-48b125d266b5776711a6b70886f6bf64fe168c84.zip
Merge pull request #2 from dgilbert999/binutils-2_24-ppe42
Code clean up to satisfy gcc version 6
Diffstat (limited to 'bfd')
-rw-r--r--bfd/bfd-in.h2
-rw-r--r--bfd/bfd-in2.h31
-rw-r--r--bfd/dwarf2.c4
-rw-r--r--bfd/elf64-ppc.c10
-rw-r--r--bfd/libbfd.c2
5 files changed, 37 insertions, 12 deletions
diff --git a/bfd/bfd-in.h b/bfd/bfd-in.h
index 3afd71b915..398fe74fa7 100644
--- a/bfd/bfd-in.h
+++ b/bfd/bfd-in.h
@@ -272,7 +272,7 @@ alent;
/* Object and core file sections. */
#define align_power(addr, align) \
- (((addr) + ((bfd_vma) 1 << (align)) - 1) & ((bfd_vma) -1 << (align)))
+ (((addr) + ((bfd_vma) 1 << (align)) - 1) & (-((bfd_vma) 1 << (align))))
typedef struct bfd_section *sec_ptr;
diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
index 3fbe27da71..2addeca529 100644
--- a/bfd/bfd-in2.h
+++ b/bfd/bfd-in2.h
@@ -279,7 +279,7 @@ alent;
/* Object and core file sections. */
#define align_power(addr, align) \
- (((addr) + ((bfd_vma) 1 << (align)) - 1) & ((bfd_vma) -1 << (align)))
+ (((addr) + ((bfd_vma) 1 << (align)) - 1) & (-((bfd_vma) 1 << (align))))
typedef struct bfd_section *sec_ptr;
@@ -299,9 +299,6 @@ typedef struct bfd_section *sec_ptr;
#define bfd_is_com_section(ptr) (((ptr)->flags & SEC_IS_COMMON) != 0)
-#define bfd_set_section_vma(bfd, ptr, val) (((ptr)->vma = (ptr)->lma = (val)), ((ptr)->user_set_vma = TRUE), TRUE)
-#define bfd_set_section_alignment(bfd, ptr, val) (((ptr)->alignment_power = (val)),TRUE)
-#define bfd_set_section_userdata(bfd, ptr, val) (((ptr)->userdata = (val)),TRUE)
/* Find the address one past the end of SEC. */
#define bfd_get_section_limit(bfd, sec) \
(((bfd)->direction != write_direction && (sec)->rawsize != 0 \
@@ -1594,6 +1591,32 @@ struct relax_table {
int size;
};
+/* Note: the following are provided as inline functions rather than macros
+ because not all callers use the return value. A macro implementation
+ would use a comma expression, eg: "((ptr)->foo = val, TRUE)" and some
+ compilers will complain about comma expressions that have no effect. */
+static inline bfd_boolean
+bfd_set_section_userdata (bfd * abfd ATTRIBUTE_UNUSED, asection * ptr, void * val)
+{
+ ptr->userdata = val;
+ return TRUE;
+}
+
+static inline bfd_boolean
+bfd_set_section_vma (bfd * abfd ATTRIBUTE_UNUSED, asection * ptr, bfd_vma val)
+{
+ ptr->vma = ptr->lma = val;
+ ptr->user_set_vma = TRUE;
+ return TRUE;
+}
+
+static inline bfd_boolean
+bfd_set_section_alignment (bfd * abfd ATTRIBUTE_UNUSED, asection * ptr, unsigned int val)
+{
+ ptr->alignment_power = val;
+ return TRUE;
+}
+
/* These sections are global, and are managed by BFD. The application
and target back end are not permitted to change the values in
these sections. */
diff --git a/bfd/dwarf2.c b/bfd/dwarf2.c
index c9349da34a..d5ed605077 100644
--- a/bfd/dwarf2.c
+++ b/bfd/dwarf2.c
@@ -3074,8 +3074,8 @@ place_sections (bfd *abfd, 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 += sect->vma + sz;
}
diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c
index bf13a5da6b..e5ac88485c 100644
--- a/bfd/elf64-ppc.c
+++ b/bfd/elf64-ppc.c
@@ -12253,8 +12253,9 @@ ppc64_elf_size_stubs (struct bfd_link_info *info, bfd_signed_vma group_size,
stub_sec != NULL;
stub_sec = stub_sec->next)
if ((stub_sec->flags & SEC_LINKER_CREATED) == 0)
- stub_sec->size = ((stub_sec->size + (1 << htab->plt_stub_align) - 1)
- & (-1 << htab->plt_stub_align));
+ stub_sec->size = ((stub_sec->size
+ + (1 << htab->plt_stub_align) - 1)
+ & -(1 << htab->plt_stub_align));
for (stub_sec = htab->stub_bfd->sections;
stub_sec != NULL;
@@ -12721,8 +12722,9 @@ ppc64_elf_build_stubs (bfd_boolean emit_stub_syms,
stub_sec != NULL;
stub_sec = stub_sec->next)
if ((stub_sec->flags & SEC_LINKER_CREATED) == 0)
- stub_sec->size = ((stub_sec->size + (1 << htab->plt_stub_align) - 1)
- & (-1 << htab->plt_stub_align));
+ stub_sec->size = ((stub_sec->size
+ + (1 << htab->plt_stub_align) - 1)
+ & -(1 << htab->plt_stub_align));
for (stub_sec = htab->stub_bfd->sections;
stub_sec != NULL;
diff --git a/bfd/libbfd.c b/bfd/libbfd.c
index 553c729562..28f64d95d8 100644
--- a/bfd/libbfd.c
+++ b/bfd/libbfd.c
@@ -1102,7 +1102,7 @@ read_signed_leb128 (bfd *abfd ATTRIBUTE_UNUSED,
}
while (byte & 0x80);
if (shift < 8 * sizeof (result) && (byte & 0x40))
- result |= (((bfd_vma) -1) << shift);
+ result |= -((bfd_vma) 1 << shift);
*bytes_read_ptr = num_read;
return result;
}
OpenPOWER on IntegriCloud