[Mesa-dev] [PATCH 6/7] ac/rtld: report better error messages for LDS overallocation
Marek Olšák
maraeo at gmail.com
Thu Jun 13 00:40:40 UTC 2019
From: Nicolai Hähnle <nicolai.haehnle at amd.com>
---
src/amd/common/ac_rtld.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/src/amd/common/ac_rtld.c b/src/amd/common/ac_rtld.c
index 18f198f8af2..57d6b0151b4 100644
--- a/src/amd/common/ac_rtld.c
+++ b/src/amd/common/ac_rtld.c
@@ -283,21 +283,26 @@ bool ac_rtld_open(struct ac_rtld_binary *binary,
unsigned max_lds_size = 64 * 1024;
if (i.info->chip_class == GFX6 ||
(i.shader_type != MESA_SHADER_COMPUTE &&
i.shader_type != MESA_SHADER_FRAGMENT))
max_lds_size = 32 * 1024;
uint64_t shared_lds_size = 0;
if (!layout_symbols(binary->lds_symbols.data, i.num_shared_lds_symbols, &shared_lds_size))
goto fail;
- report_if(shared_lds_size > max_lds_size);
+
+ if (shared_lds_size > max_lds_size) {
+ fprintf(stderr, "ac_rtld error(1): too much LDS (used = %u, max = %u)\n",
+ (unsigned)shared_lds_size, max_lds_size);
+ goto fail;
+ }
binary->lds_size = shared_lds_size;
/* First pass over all parts: open ELFs, pre-determine the placement of
* sections in the memory image, and collect and layout private LDS symbols. */
uint32_t lds_end_align = 0;
if (binary->options.halt_at_entry)
pasted_text_size += 4;
for (unsigned part_idx = 0; part_idx < i.num_parts; ++part_idx) {
@@ -384,21 +389,25 @@ bool ac_rtld_open(struct ac_rtld_binary *binary,
struct ac_rtld_symbol *lds_end =
util_dynarray_grow(&binary->lds_symbols, struct ac_rtld_symbol, 1);
lds_end->name = "__lds_end";
lds_end->size = 0;
lds_end->align = lds_end_align;
lds_end->offset = binary->lds_size;
lds_end->part_idx = ~0u;
}
- report_elf_if(binary->lds_size > max_lds_size);
+ if (binary->lds_size > max_lds_size) {
+ fprintf(stderr, "ac_rtld error(2): too much LDS (used = %u, max = %u)\n",
+ (unsigned)binary->lds_size, max_lds_size);
+ goto fail;
+ }
/* Second pass: Adjust offsets of non-pasted text sections. */
binary->rx_size = pasted_text_size;
binary->rx_size = align(binary->rx_size, rx_align);
for (unsigned part_idx = 0; part_idx < i.num_parts; ++part_idx) {
struct ac_rtld_part *part = &binary->parts[part_idx];
size_t num_shdrs;
elf_getshdrnum(part->elf, &num_shdrs);
--
2.17.1
More information about the mesa-dev
mailing list