]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
bfd/ELF: make three local arrays static
authorJan Beulich <jbeulich@suse.com>
Fri, 8 Aug 2025 09:44:12 +0000 (11:44 +0200)
committerJan Beulich <jbeulich@suse.com>
Fri, 8 Aug 2025 09:44:12 +0000 (11:44 +0200)
... and const. There's no reason to have the compiler copy anonymous
objects onto the stack. And there's also no reason to allow the arrays
to be modifiable.

bfd/elf-bfd.h
bfd/elf.c
bfd/elflink.c

index b7916239737f07a15c033cfe79fd59f4868664e0..f24342cb029a8ae243ef506a7b0ee83051892be9 100644 (file)
@@ -2632,7 +2632,7 @@ extern bool _bfd_elf_link_output_relocs
    struct elf_link_hash_entry **);
 
 extern void _bfd_elf_link_add_glibc_version_dependency
-  (struct elf_find_verdep_info *, const char *[]);
+  (struct elf_find_verdep_info *, const char *const []);
 
 extern void _bfd_elf_link_add_dt_relr_dependency
   (struct elf_find_verdep_info *);
index dfa04c9268d7353354ad0f572cef264063ea0461..1b2e331eaa8fa3ba4d45417f1b49578a6f798256 100644 (file)
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -10948,7 +10948,7 @@ elfcore_grok_win32pstatus (bfd *abfd, Elf_Internal_Note *note)
 
   type = bfd_get_32 (abfd, note->descdata);
 
-  struct
+  static const struct
   {
     const char *type_name;
     unsigned long min_size;
@@ -13345,7 +13345,7 @@ elf_parse_notes (bfd *abfd, char *buf, size_t size, file_ptr offset,
        case bfd_core:
          {
 #define GROKER_ELEMENT(S,F) {S, sizeof (S) - 1, F}
-           struct
+           static const struct
            {
              const char * string;
              size_t len;
index cdd58b25fc820b8b0bf0943eb9d6ec7a2a9f66e4..7b0375406ac5d9105df630b4e346f2d6ee738264 100644 (file)
@@ -2380,7 +2380,7 @@ elf_link_add_glibc_verneed (struct elf_find_verdep_info *rinfo,
 void
 _bfd_elf_link_add_glibc_version_dependency
   (struct elf_find_verdep_info *rinfo,
-   const char *version_dep[])
+   const char *const version_dep[])
 {
   Elf_Internal_Verneed *t = NULL;
   int glibc_minor_base = INT_MAX;
@@ -2405,7 +2405,7 @@ _bfd_elf_link_add_dt_relr_dependency (struct elf_find_verdep_info *rinfo)
 {
   if (rinfo->info->enable_dt_relr)
     {
-      const char *version[] =
+      static const char *const version[] =
        {
          "GLIBC_ABI_DT_RELR",
          NULL