[binutils-gdb] arc constify
Alan Modra
amodra@sourceware.org
Wed Dec 16 04:48:18 GMT 2020
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=14aa7c52a3caac7de7931a7a537fe1706ce180d1
commit 14aa7c52a3caac7de7931a7a537fe1706ce180d1
Author: Alan Modra <amodra@gmail.com>
Date: Tue Dec 15 22:08:20 2020 +1030
arc constify
Move a read-only array to .rodata.
* arc-plt.h (plt_versions): Constify.
* elf32-arc.c (arc_get_plt_version): Constify return pointer,
adjust uses throughout.
Diff:
---
bfd/ChangeLog | 6 ++++++
bfd/arc-plt.h | 2 +-
bfd/elf32-arc.c | 8 ++++----
3 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 88a0ebba4fe..7eefc92598b 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,9 @@
+2020-12-16 Alan Modra <amodra@gmail.com>
+
+ * arc-plt.h (plt_versions): Constify.
+ * elf32-arc.c (arc_get_plt_version): Constify return pointer,
+ adjust uses throughout.
+
2020-12-16 Alan Modra <amodra@gmail.com>
* coffcode.h (pelength, peheader): Delete static variables.
diff --git a/bfd/arc-plt.h b/bfd/arc-plt.h
index f668fee8ca6..61bd9a6ddca 100644
--- a/bfd/arc-plt.h
+++ b/bfd/arc-plt.h
@@ -178,7 +178,7 @@ struct plt_version_t
#define PLT_ELEM(...)
#define ENTRY_RELOC(...)
#define ELEM_RELOC(...)
-struct plt_version_t plt_versions[PLT_MAX] = {
+const struct plt_version_t plt_versions[PLT_MAX] = {
#include "arc-plt.def"
diff --git a/bfd/elf32-arc.c b/bfd/elf32-arc.c
index a05f697b657..f184ac95c30 100644
--- a/bfd/elf32-arc.c
+++ b/bfd/elf32-arc.c
@@ -2112,7 +2112,7 @@ elf_arc_check_relocs (bfd * abfd,
#define ELF_DYNAMIC_INTERPRETER "/sbin/ld-uClibc.so"
-static struct plt_version_t *
+static const struct plt_version_t *
arc_get_plt_version (struct bfd_link_info *info)
{
int i;
@@ -2146,7 +2146,7 @@ add_symbol_to_plt (struct bfd_link_info *info)
struct elf_link_hash_table *htab = elf_hash_table (info);
bfd_vma ret;
- struct plt_version_t *plt_data = arc_get_plt_version (info);
+ const struct plt_version_t *plt_data = arc_get_plt_version (info);
/* If this is the first .plt entry, make room for the special first
entry. */
@@ -2226,7 +2226,7 @@ relocate_plt_for_symbol (bfd *output_bfd,
struct bfd_link_info *info,
struct elf_link_hash_entry *h)
{
- struct plt_version_t *plt_data = arc_get_plt_version (info);
+ const struct plt_version_t *plt_data = arc_get_plt_version (info);
struct elf_link_hash_table *htab = elf_hash_table (info);
bfd_vma plt_index = (h->plt.offset - plt_data->entry_size)
@@ -2292,7 +2292,7 @@ static void
relocate_plt_for_entry (bfd *abfd,
struct bfd_link_info *info)
{
- struct plt_version_t *plt_data = arc_get_plt_version (info);
+ const struct plt_version_t *plt_data = arc_get_plt_version (info);
struct elf_link_hash_table *htab = elf_hash_table (info);
{
More information about the Binutils-cvs
mailing list