summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2016-02-11 23:20:38 +0100
committerMarek Olšák <[email protected]>2016-02-21 21:08:58 +0100
commit50ac2612d08f2425972dde42e32a71fdce70cebd (patch)
tree4b84ce4ebdeea30a75b4a2faf3070ee92510b5e7
parent1fe73d55e3f92b1dfbd619d46fd892fd169ae796 (diff)
radeonsi: make radeon_shader_reloc name string fixed-sized
This will simplify implementations of binary shaders. Reviewed-by: Nicolai Hähnle <[email protected]>
-rw-r--r--src/gallium/drivers/radeon/r600_pipe_common.h2
-rw-r--r--src/gallium/drivers/radeon/radeon_elf_util.c7
2 files changed, 3 insertions, 6 deletions
diff --git a/src/gallium/drivers/radeon/r600_pipe_common.h b/src/gallium/drivers/radeon/r600_pipe_common.h
index ee173d35880..7df617737a7 100644
--- a/src/gallium/drivers/radeon/r600_pipe_common.h
+++ b/src/gallium/drivers/radeon/r600_pipe_common.h
@@ -97,7 +97,7 @@ struct r600_common_context;
struct r600_perfcounters;
struct radeon_shader_reloc {
- char *name;
+ char name[32];
uint64_t offset;
};
diff --git a/src/gallium/drivers/radeon/radeon_elf_util.c b/src/gallium/drivers/radeon/radeon_elf_util.c
index 2e45d439e7a..70a2c4dc098 100644
--- a/src/gallium/drivers/radeon/radeon_elf_util.c
+++ b/src/gallium/drivers/radeon/radeon_elf_util.c
@@ -98,7 +98,8 @@ static void parse_relocs(Elf *elf, Elf_Data *relocs, Elf_Data *symbols,
symbol_name = elf_strptr(elf, symbol_sh_link, symbol.st_name);
reloc->offset = rel.r_offset;
- reloc->name = strdup(symbol_name);
+ strncpy(reloc->name, symbol_name, sizeof(reloc->name)-1);
+ reloc->name[sizeof(reloc->name)-1] = 0;
}
}
@@ -198,10 +199,6 @@ const unsigned char *radeon_shader_binary_config_start(
void radeon_shader_binary_free_relocs(struct radeon_shader_reloc *relocs,
unsigned reloc_count)
{
- unsigned i;
- for (i = 0; i < reloc_count; i++) {
- FREE(relocs[i].name);
- }
FREE(relocs);
}