/* NDS32-specific support for 32-bit ELF.
- Copyright (C) 2012-2019 Free Software Foundation, Inc.
+ Copyright (C) 2012-2020 Free Software Foundation, Inc.
Contributed by Andes Technology Corporation.
This file is part of BFD, the Binary File Descriptor library.
#include "opcode/cgen.h"
#include "../opcodes/nds32-opc.h"
+/* All users of this file have bfd_octets_per_byte (abfd, sec) == 1. */
+#define OCTETS_PER_BYTE(ABFD, SEC) 1
+
/* Relocation HOWTO functions. */
static bfd_reloc_status_type nds32_elf_ignore_reloc
(bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
{
char *ptr = (char *) base;
int i, j;
- char *tmp = xmalloc (size);
+ char tmp[sizeof (Elf_Internal_Rela)];
+
+ BFD_ASSERT (size <= sizeof (tmp));
/* If i is less than j, i is inserted before j.
memmove (ptr + (j + 1) * size, ptr + j * size, (i - j) * size);
memcpy (ptr + j * size, tmp, size);
}
- free (tmp);
}
/* Sort relocation by r_offset.
= HOWTO (0, 0, 0, 0, FALSE, 0, complain_overflow_dont, NULL,
"unused", FALSE, 0, 0, FALSE);
- off = (*parent)->address * bfd_octets_per_byte (input_bfd);
+ off = (*parent)->address * OCTETS_PER_BYTE (input_bfd,
+ input_section);
_bfd_clear_contents ((*parent)->howto, input_bfd,
input_section, data, off);
(*parent)->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr;