aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@suse.com>2025-08-08 11:44:12 +0200
committerJan Beulich <jbeulich@suse.com>2025-08-08 11:44:12 +0200
commit1e118fe363d5538651ea6a0af6d5e05c105f01dc (patch)
treef459dc8a8b4ee5ad81477e364b650f0cbd7bb8f1
parentd582b4eb1be1199b1a41d922355bc62f763b19ef (diff)
downloadbinutils-1e118fe363d5538651ea6a0af6d5e05c105f01dc.zip
binutils-1e118fe363d5538651ea6a0af6d5e05c105f01dc.tar.gz
binutils-1e118fe363d5538651ea6a0af6d5e05c105f01dc.tar.bz2
bfd/ELF: make three local arrays static
... 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.
-rw-r--r--bfd/elf-bfd.h2
-rw-r--r--bfd/elf.c4
-rw-r--r--bfd/elflink.c4
3 files changed, 5 insertions, 5 deletions
diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h
index b791623..f24342c 100644
--- a/bfd/elf-bfd.h
+++ b/bfd/elf-bfd.h
@@ -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 *);
diff --git a/bfd/elf.c b/bfd/elf.c
index dfa04c9..1b2e331 100644
--- 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;
diff --git a/bfd/elflink.c b/bfd/elflink.c
index cdd58b2..7b03754 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -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