From 09c78487342254de6a4498f8b3aa1f3f1d508898 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Wed, 11 Dec 2019 21:06:17 +1030 Subject: [PATCH] Make bfd_get_8 return a bfd_vma like other bfd_get_* functions And similarly for bfd_get_signed_8. bfd/ * libbfd.c (bfd_get_8): Return a bfd_vma. (bfd_get_signed_8): Return a bfd_signed_vma. * bfd-in2.h: Regenerate. binutils/ * od-xcoff.c (dump_dumpx_core): Adjust for bfd_h_get_8 change. --- bfd/ChangeLog | 6 ++++++ bfd/bfd-in2.h | 4 ++-- bfd/libbfd.c | 4 ++-- binutils/ChangeLog | 4 ++++ binutils/od-xcoff.c | 6 ++++-- 5 files changed, 18 insertions(+), 6 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 65b8167a1c8..bdf33b67838 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,9 @@ +2019-12-11 Alan Modra + + * libbfd.c (bfd_get_8): Return a bfd_vma. + (bfd_get_signed_8): Return a bfd_signed_vma. + * bfd-in2.h: Regenerate. + 2019-12-11 Alan Modra * xtensa-modules.c (Field_* functions): Don't mask using shifts. diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h index 44902fc8d05..6f3e41da376 100644 --- a/bfd/bfd-in2.h +++ b/bfd/bfd-in2.h @@ -654,9 +654,9 @@ void bfd_set_filename (bfd *abfd, char *filename); #define bfd_put_signed_8 \ bfd_put_8 #define bfd_get_8(abfd, ptr) \ - (*(const unsigned char *) (ptr) & 0xff) + ((bfd_vma) *(const unsigned char *) (ptr) & 0xff) #define bfd_get_signed_8(abfd, ptr) \ - (((*(const unsigned char *) (ptr) & 0xff) ^ 0x80) - 0x80) + ((((bfd_signed_vma) *(const unsigned char *) (ptr) & 0xff) ^ 0x80) - 0x80) #define bfd_put_16(abfd, val, ptr) \ BFD_SEND (abfd, bfd_putx16, ((val),(ptr))) diff --git a/bfd/libbfd.c b/bfd/libbfd.c index 6ff7172a0f2..3a3e523bccd 100644 --- a/bfd/libbfd.c +++ b/bfd/libbfd.c @@ -449,9 +449,9 @@ DESCRIPTION .#define bfd_put_signed_8 \ . bfd_put_8 .#define bfd_get_8(abfd, ptr) \ -. (*(const unsigned char *) (ptr) & 0xff) +. ((bfd_vma) *(const unsigned char *) (ptr) & 0xff) .#define bfd_get_signed_8(abfd, ptr) \ -. (((*(const unsigned char *) (ptr) & 0xff) ^ 0x80) - 0x80) +. ((((bfd_signed_vma) *(const unsigned char *) (ptr) & 0xff) ^ 0x80) - 0x80) . .#define bfd_put_16(abfd, val, ptr) \ . BFD_SEND (abfd, bfd_putx16, ((val),(ptr))) diff --git a/binutils/ChangeLog b/binutils/ChangeLog index a1948053520..80c7fc32ddb 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,7 @@ +2019-12-11 Alan Modra + + * od-xcoff.c (dump_dumpx_core): Adjust for bfd_h_get_8 change. + 2019-12-10 Alan Modra PR 24960 diff --git a/binutils/od-xcoff.c b/binutils/od-xcoff.c index e5566bc9a73..7eb0c297c5c 100644 --- a/binutils/od-xcoff.c +++ b/binutils/od-xcoff.c @@ -1680,8 +1680,10 @@ dump_dumpx_core (bfd *abfd, struct external_core_dumpx *hdr) { if (options[OPT_FILE_HEADER].selected) { - printf (" signal: %u\n", bfd_h_get_8 (abfd, hdr->c_signo)); - printf (" flags: 0x%02x\n", bfd_h_get_8 (abfd, hdr->c_flag)); + printf (" signal: %u\n", + (unsigned) bfd_h_get_8 (abfd, hdr->c_signo)); + printf (" flags: 0x%02x\n", + (unsigned) bfd_h_get_8 (abfd, hdr->c_flag)); printf (" entries: %u\n", (unsigned) bfd_h_get_16 (abfd, hdr->c_entries)); #ifdef BFD64 -- 2.30.2