[PATCH 14/17] bfd/ELF: make three local arrays static
Jan Beulich
jbeulich@suse.com
Mon Aug 4 09:24:42 GMT 2025
... 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.
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -10966,7 +10966,7 @@ elfcore_grok_win32pstatus (bfd *abfd, El
type = bfd_get_32 (abfd, note->descdata);
- struct
+ static const struct
{
const char *type_name;
unsigned long min_size;
@@ -13363,7 +13363,7 @@ elf_parse_notes (bfd *abfd, char *buf, s
case bfd_core:
{
#define GROKER_ELEMENT(S,F) {S, sizeof (S) - 1, F}
- struct
+ static const struct
{
const char * string;
size_t len;
--- 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 *);
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -2381,7 +2381,7 @@ elf_link_add_glibc_verneed (struct elf_f
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;
@@ -2406,7 +2406,7 @@ _bfd_elf_link_add_dt_relr_dependency (st
{
if (rinfo->info->enable_dt_relr)
{
- const char *version[] =
+ static const char *const version[] =
{
"GLIBC_ABI_DT_RELR",
NULL
More information about the Binutils
mailing list