summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDouglas Gilbert <dgilbert999@netscape.net>2017-01-13 11:44:29 -0600
committerDoug Gilbert <dgilbert@us.ibm.com>2017-01-17 14:02:15 -0600
commit394161cb79956f4297fea1638ec4c42afeba77c9 (patch)
tree04598b483570648284bb93fcff2b4ba540f3f529
parent5b161fc30519a965f16e7e73c3410a388140cba1 (diff)
downloadppe42-binutils-394161cb79956f4297fea1638ec4c42afeba77c9.tar.gz
ppe42-binutils-394161cb79956f4297fea1638ec4c42afeba77c9.zip
Code clean up to satisfy gcc version 6
Backport of 29f628db8 and other issues
-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
-rw-r--r--binutils/dwarf.c2
-rw-r--r--gas/config/tc-ppc.c2
-rw-r--r--gas/read.c2
-rw-r--r--gas/write.c2
-rw-r--r--include/opcode/ppc.h2
10 files changed, 42 insertions, 17 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;
}
diff --git a/binutils/dwarf.c b/binutils/dwarf.c
index ae50a65fbd..201181e8a5 100644
--- a/binutils/dwarf.c
+++ b/binutils/dwarf.c
@@ -263,7 +263,7 @@ read_leb128 (unsigned char *data,
*length_return = num_read;
if (sign && (shift < 8 * sizeof (result)) && (byte & 0x40))
- result |= -1L << shift;
+ result |= -1UL << shift;
return result;
}
diff --git a/gas/config/tc-ppc.c b/gas/config/tc-ppc.c
index d5f8f13785..f66c721f7e 100644
--- a/gas/config/tc-ppc.c
+++ b/gas/config/tc-ppc.c
@@ -1482,7 +1482,7 @@ insn_validate (const struct powerpc_opcode *op)
else
{
const struct powerpc_operand *operand = &powerpc_operands[*o];
- if (operand->shift != PPC_OPSHIFT_INV)
+ if (operand->shift != (int) PPC_OPSHIFT_INV)
{
unsigned long mask;
diff --git a/gas/read.c b/gas/read.c
index 082670c445..ac970613ba 100644
--- a/gas/read.c
+++ b/gas/read.c
@@ -5019,7 +5019,7 @@ output_big_sleb128 (char *p, LITTLENUM_TYPE *bignum, int size)
{
/* Sign-extend VAL. */
if (val & (1 << (loaded - 1)))
- val |= ~0 << loaded;
+ val |= -1U << loaded;
if (orig)
*p = val & 0x7f;
p++;
diff --git a/gas/write.c b/gas/write.c
index 745abe66d8..ba776e4d59 100644
--- a/gas/write.c
+++ b/gas/write.c
@@ -2292,7 +2292,7 @@ relax_align (register relax_addressT address, /* Address now. */
relax_addressT mask;
relax_addressT new_address;
- mask = ~((~0) << alignment);
+ mask = ~((-1U) << alignment);
new_address = (address + mask) & (~mask);
#ifdef LINKER_RELAXING_SHRINKS_ONLY
if (linkrelax)
diff --git a/include/opcode/ppc.h b/include/opcode/ppc.h
index 57d20c96dd..d22f7b060a 100644
--- a/include/opcode/ppc.h
+++ b/include/opcode/ppc.h
@@ -281,7 +281,7 @@ extern const unsigned int num_powerpc_operands;
/* Use with the shift field of a struct powerpc_operand to indicate
that BITM and SHIFT cannot be used to determine where the operand
goes in the insn. */
-#define PPC_OPSHIFT_INV (-1 << 31)
+#define PPC_OPSHIFT_INV (-1U << 31)
/* Values defined for the flags field of a struct powerpc_operand. */
OpenPOWER on IntegriCloud