]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
objtool: Const string cleanup
authorJosh Poimboeuf <jpoimboe@kernel.org>
Wed, 17 Sep 2025 16:03:32 +0000 (09:03 -0700)
committerJosh Poimboeuf <jpoimboe@kernel.org>
Tue, 14 Oct 2025 21:45:24 +0000 (14:45 -0700)
Use 'const char *' where applicable.

Acked-by: Petr Mladek <pmladek@suse.com>
Tested-by: Joe Lawrence <joe.lawrence@redhat.com>
Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
tools/objtool/arch/loongarch/decode.c
tools/objtool/arch/powerpc/decode.c
tools/objtool/arch/x86/decode.c
tools/objtool/elf.c
tools/objtool/include/objtool/arch.h
tools/objtool/include/objtool/elf.h

index 77942b927a7ac0801f16349b8f5bd171d6bcfe59..0115b97c526b83d24300c43dd8bcf062569cc040 100644 (file)
@@ -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");
 }
index 9b17885e6cba66b0ff6bcbf5324ee5e8a13b023a..d4cb02120a6bd3cd56b9130f6e49196a5c8b72ab 100644 (file)
@@ -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");
 }
index b10200cc50c99935315ba5a87e15e547401d085d..6bb46d9981533dad6ae17aa3143a70d4a4a5cf6b 100644 (file)
@@ -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__");
 }
index d7fb3d0b05cf12f76e11c8e4a0967b782cdba042..2ea6d591c3c298130540c85127b32fc5388813c5 100644 (file)
@@ -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 @@ err:
        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;
 
index 68664625a467138d524ce7a6ef7446e43d4ce782..a4502947307a4ced6da9653ff20f568b06c1aa88 100644 (file)
@@ -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);
 
index df8434d3b74400bd913d47f71ba5e2d29578130b..74ce454790f4d2dd9629c98cac12f74437877983 100644 (file)
@@ -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;
@@ -88,7 +88,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;