summaryrefslogtreecommitdiffstats
path: root/src/amd/common/ac_rtld.h
diff options
context:
space:
mode:
authorNicolai Hähnle <[email protected]>2019-05-03 21:18:51 +0200
committerMarek Olšák <[email protected]>2019-06-12 20:28:23 -0400
commitf8315ae04b304bbdb47680654238edd107c5a129 (patch)
treef6b0c284ea97df378392b5b48811397ce32c88d6 /src/amd/common/ac_rtld.h
parentdc99a8cd9bf743746926c062a7c921f272e1648f (diff)
amd/rtld: layout and relocate LDS symbols
Upcoming changes to LLVM will emit LDS objects as symbols in the ELF symbol table, with relocations that will be resolved with this change. Callers will also be able to define LDS symbols that are shared between shader parts. This will be used by radeonsi for the ESGS ring in gfx9+ merged shaders. Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/amd/common/ac_rtld.h')
-rw-r--r--src/amd/common/ac_rtld.h39
1 files changed, 36 insertions, 3 deletions
diff --git a/src/amd/common/ac_rtld.h b/src/amd/common/ac_rtld.h
index 0d93488fbbb..01c29b50817 100644
--- a/src/amd/common/ac_rtld.h
+++ b/src/amd/common/ac_rtld.h
@@ -28,8 +28,19 @@
#include <stdint.h>
#include <stddef.h>
+#include "util/u_dynarray.h"
+
struct ac_rtld_part;
struct ac_shader_config;
+struct radeon_info;
+
+struct ac_rtld_symbol {
+ const char *name;
+ uint32_t size;
+ uint32_t align;
+ uint64_t offset; /* filled in by ac_rtld_open */
+ unsigned part_idx; /* shader part in which this symbol appears */
+};
/* Lightweight wrapper around underlying ELF objects. */
struct ac_rtld_binary {
@@ -40,6 +51,9 @@ struct ac_rtld_binary {
unsigned num_parts;
struct ac_rtld_part *parts;
+
+ struct util_dynarray lds_symbols;
+ uint32_t lds_size;
};
/**
@@ -54,9 +68,28 @@ struct ac_rtld_binary {
typedef bool (*ac_rtld_get_external_symbol_cb)(
void *cb_data, const char *symbol, uint64_t *value);
-bool ac_rtld_open(struct ac_rtld_binary *binary, unsigned num_parts,
- const char * const *elf_ptrs,
- const size_t *elf_sizes);
+/**
+ * Lifetimes of \ref info, in-memory ELF objects, and the names of
+ * \ref shared_lds_symbols must extend until \ref ac_rtld_close is called on
+ * the opened binary.
+ */
+struct ac_rtld_open_info {
+ const struct radeon_info *info;
+
+ unsigned num_parts;
+ const char * const *elf_ptrs; /* in-memory ELF objects of each part */
+ const size_t *elf_sizes; /* sizes of corresponding in-memory ELF objects in bytes */
+
+ /* Shared LDS symbols are layouted such that they are accessible from
+ * all shader parts. Non-shared (private) LDS symbols of one part may
+ * overlap private LDS symbols of another shader part.
+ */
+ unsigned num_shared_lds_symbols;
+ const struct ac_rtld_symbol *shared_lds_symbols;
+};
+
+bool ac_rtld_open(struct ac_rtld_binary *binary,
+ struct ac_rtld_open_info i);
void ac_rtld_close(struct ac_rtld_binary *binary);