[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <de1151fa7a5461f7a0cce722b21318541a97dd17.1746821544.git.jpoimboe@kernel.org>
Date: Fri, 9 May 2025 13:16:46 -0700
From: Josh Poimboeuf <jpoimboe@...nel.org>
To: x86@...nel.org
Cc: linux-kernel@...r.kernel.org,
Petr Mladek <pmladek@...e.com>,
Miroslav Benes <mbenes@...e.cz>,
Joe Lawrence <joe.lawrence@...hat.com>,
live-patching@...r.kernel.org,
Song Liu <song@...nel.org>,
laokz <laokz@...mail.com>,
Jiri Kosina <jikos@...nel.org>,
Marcos Paulo de Souza <mpdesouza@...e.com>,
Weinan Liu <wnliu@...gle.com>,
Fazla Mehrab <a.mehrab@...edance.com>,
Chen Zhongjin <chenzhongjin@...wei.com>,
Puranjay Mohan <puranjay@...nel.org>
Subject: [PATCH v2 22/62] objtool: Const string cleanup
Use 'const char *' where applicable.
Signed-off-by: Josh Poimboeuf <jpoimboe@...nel.org>
---
tools/objtool/arch/loongarch/decode.c | 2 +-
tools/objtool/arch/powerpc/decode.c | 2 +-
tools/objtool/arch/x86/decode.c | 2 +-
tools/objtool/elf.c | 6 +++---
tools/objtool/include/objtool/arch.h | 2 +-
tools/objtool/include/objtool/elf.h | 6 +++---
6 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/tools/objtool/arch/loongarch/decode.c b/tools/objtool/arch/loongarch/decode.c
index 330671d88c59..7b38718d782a 100644
--- a/tools/objtool/arch/loongarch/decode.c
+++ b/tools/objtool/arch/loongarch/decode.c
@@ -7,7 +7,7 @@
#include <linux/objtool_types.h>
#include <arch/elf.h>
-int arch_ftrace_match(char *name)
+int arch_ftrace_match(const char *name)
{
return !strcmp(name, "_mcount");
}
diff --git a/tools/objtool/arch/powerpc/decode.c b/tools/objtool/arch/powerpc/decode.c
index 9b17885e6cba..d4cb02120a6b 100644
--- a/tools/objtool/arch/powerpc/decode.c
+++ b/tools/objtool/arch/powerpc/decode.c
@@ -9,7 +9,7 @@
#include <objtool/builtin.h>
#include <objtool/endianness.h>
-int arch_ftrace_match(char *name)
+int arch_ftrace_match(const char *name)
{
return !strcmp(name, "_mcount");
}
diff --git a/tools/objtool/arch/x86/decode.c b/tools/objtool/arch/x86/decode.c
index 7bb8bad22b8a..cdf385e54c69 100644
--- a/tools/objtool/arch/x86/decode.c
+++ b/tools/objtool/arch/x86/decode.c
@@ -23,7 +23,7 @@
#include <objtool/builtin.h>
#include <arch/elf.h>
-int arch_ftrace_match(char *name)
+int arch_ftrace_match(const char *name)
{
return !strcmp(name, "__fentry__");
}
diff --git a/tools/objtool/elf.c b/tools/objtool/elf.c
index d7fb3d0b05cf..2ea6d591c3c2 100644
--- a/tools/objtool/elf.c
+++ b/tools/objtool/elf.c
@@ -853,7 +853,7 @@ elf_create_section_symbol(struct elf *elf, struct section *sec)
return sym;
}
-static int elf_add_string(struct elf *elf, struct section *strtab, char *str);
+static int elf_add_string(struct elf *elf, struct section *strtab, const char *str);
struct symbol *
elf_create_prefix_symbol(struct elf *elf, struct symbol *orig, long size)
@@ -1086,7 +1086,7 @@ struct elf *elf_open_read(const char *name, int flags)
return NULL;
}
-static int elf_add_string(struct elf *elf, struct section *strtab, char *str)
+static int elf_add_string(struct elf *elf, struct section *strtab, const char *str)
{
Elf_Data *data;
Elf_Scn *s;
@@ -1111,7 +1111,7 @@ static int elf_add_string(struct elf *elf, struct section *strtab, char *str)
return -1;
}
- data->d_buf = str;
+ data->d_buf = strdup(str);
data->d_size = strlen(str) + 1;
data->d_align = 1;
diff --git a/tools/objtool/include/objtool/arch.h b/tools/objtool/include/objtool/arch.h
index cd1776c35b13..07729a240159 100644
--- a/tools/objtool/include/objtool/arch.h
+++ b/tools/objtool/include/objtool/arch.h
@@ -71,7 +71,7 @@ struct stack_op {
struct instruction;
-int arch_ftrace_match(char *name);
+int arch_ftrace_match(const char *name);
void arch_initial_func_cfi_state(struct cfi_init_state *state);
diff --git a/tools/objtool/include/objtool/elf.h b/tools/objtool/include/objtool/elf.h
index 0a2fa3ac0079..0f9adfe8e852 100644
--- a/tools/objtool/include/objtool/elf.h
+++ b/tools/objtool/include/objtool/elf.h
@@ -40,7 +40,7 @@ struct section {
struct section *base, *rsec;
struct symbol *sym;
Elf_Data *data;
- char *name;
+ const char *name;
int idx;
bool _changed, text, rodata, noinstr, init, truncate;
struct reloc *relocs;
@@ -53,7 +53,7 @@ struct symbol {
struct elf_hash_node name_hash;
GElf_Sym sym;
struct section *sec;
- char *name;
+ const char *name;
unsigned int idx, len;
unsigned long offset;
unsigned long __subtree_last;
@@ -87,7 +87,7 @@ struct elf {
GElf_Ehdr ehdr;
int fd;
bool changed;
- char *name;
+ const char *name;
unsigned int num_files;
struct list_head sections;
unsigned long num_relocs;
--
2.49.0
Powered by blists - more mailing lists