projects
/
deliverable
/
binutils-gdb.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
ubsan: xgate: left shift of negative value
[deliverable/binutils-gdb.git]
/
bfd
/
coff-mips.c
diff --git
a/bfd/coff-mips.c
b/bfd/coff-mips.c
index c9c7fc66ba229261f92c663da0562ebd0072aa7c..7c0a99194a48c2f82158ee0546651ea354bac645 100644
(file)
--- a/
bfd/coff-mips.c
+++ b/
bfd/coff-mips.c
@@
-1,5
+1,5
@@
/* BFD back-end for MIPS Extended-Coff files.
/* BFD back-end for MIPS Extended-Coff files.
- Copyright (C) 1990-20
19
Free Software Foundation, Inc.
+ Copyright (C) 1990-20
20
Free Software Foundation, Inc.
Original version by Per Bothner.
Full support added by Ian Lance Taylor, ian@cygnus.com.
Original version by Per Bothner.
Full support added by Ian Lance Taylor, ian@cygnus.com.
@@
-31,6
+31,9
@@
#include "coff/mips.h"
#include "libcoff.h"
#include "libecoff.h"
#include "coff/mips.h"
#include "libcoff.h"
#include "libecoff.h"
+
+/* All users of this file have bfd_octets_per_byte (abfd, sec) == 1. */
+#define OCTETS_PER_BYTE(ABFD, SEC) 1
\f
/* Prototypes for static functions. */
static bfd_reloc_status_type
\f
/* Prototypes for static functions. */
static bfd_reloc_status_type
@@
-484,13
+487,13
@@
mips_refhi_reloc (bfd *abfd ATTRIBUTE_UNUSED,
relocation described above. */
static bfd_reloc_status_type
relocation described above. */
static bfd_reloc_status_type
-mips_reflo_reloc (bfd *abfd
ATTRIBUTE_UNUSED
,
+mips_reflo_reloc (bfd *abfd,
arelent *reloc_entry,
asymbol *symbol,
void * data,
asection *input_section,
bfd *output_bfd,
arelent *reloc_entry,
asymbol *symbol,
void * data,
asection *input_section,
bfd *output_bfd,
- char **error_message
ATTRIBUTE_UNUSED
)
+ char **error_message)
{
if (mips_refhi_list != NULL)
{
{
if (mips_refhi_list != NULL)
{
@@
-503,11
+506,12
@@
mips_reflo_reloc (bfd *abfd ATTRIBUTE_UNUSED,
unsigned long val;
unsigned long vallo;
struct mips_hi *next;
unsigned long val;
unsigned long vallo;
struct mips_hi *next;
+ bfd_size_type octets = (reloc_entry->address
+ * OCTETS_PER_BYTE (abfd, input_section));
+ bfd_byte *loc = (bfd_byte *) data + octets;
- if (! bfd_reloc_offset_in_range (reloc_entry->howto, abfd,
- input_section,
- reloc_entry->address
- * bfd_octets_per_byte (abfd, NULL)))
+ if (!bfd_reloc_offset_in_range (reloc_entry->howto, abfd,
+ input_section, octets))
return bfd_reloc_outofrange;
/* Do the REFHI relocation. Note that we actually don't
return bfd_reloc_outofrange;
/* Do the REFHI relocation. Note that we actually don't
@@
-515,8
+519,7
@@
mips_reflo_reloc (bfd *abfd ATTRIBUTE_UNUSED,
where to find the low 16 bits of the addend needed by the
REFHI. */
insn = bfd_get_32 (abfd, l->addr);
where to find the low 16 bits of the addend needed by the
REFHI. */
insn = bfd_get_32 (abfd, l->addr);
- vallo = (bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address)
- & 0xffff);
+ vallo = bfd_get_32 (abfd, loc) & 0xffff;
val = ((insn & 0xffff) << 16) + vallo;
val += l->addend;
val = ((insn & 0xffff) << 16) + vallo;
val += l->addend;
@@
-544,7
+547,7
@@
mips_reflo_reloc (bfd *abfd ATTRIBUTE_UNUSED,
/* Now do the REFLO reloc in the usual way. */
return mips_generic_reloc (abfd, reloc_entry, symbol, data,
/* Now do the REFLO reloc in the usual way. */
return mips_generic_reloc (abfd, reloc_entry, symbol, data,
-
input_section, output_bfd, error_message);
+ input_section, output_bfd, error_message);
}
/* Do a GPREL relocation. This is a 16 bit value which must become
}
/* Do a GPREL relocation. This is a 16 bit value which must become
This page took
0.024407 seconds
and
4
git commands to generate.