+2017-10-09 Pekka Jääskeläinen <pekka.jaaskelainen@parmance.com>
+
+ * brigfrontend/brig-to-generic.cc: Support BRIG_KIND_NONE
+ directives. These directives are legal everywhere. They
+ can be used to patch away BRIG entries at the binary level.
+ Also add extra error detection for zeroed regions: make sure
+ the byteCount field is never zero.
+ * brig/brigfrontend/phsa.h: Added a new error prefix for
+ errors which are due to corrupted BRIG modules.
+
+2017-10-09 Henry Linjamäki <henry.linjamaki@parmance.com>
+
+ * brigfrontend/brig-branch-inst-handler.cc: The call code
+ still failed a few test cases. Now all PRM cases pass again.
+
2017-10-03 Henry Linjamäki <henry.linjamaki@parmance.com>
* brigfrontend/brig-branch-inst-handler.cc: Fix (more) crash with
const BrigOperandOffset32_t *operand_ptr
= (const BrigOperandOffset32_t *) data->bytes;
- vec<tree, va_gc> *&args = i == 0 ? out_args : in_args;
+ bool out_args_p = i == 0;
while (bytes > 0)
{
if (brig_var->type & BRIG_TYPE_ARRAY)
{
/* Array return values are passed as the first argument. */
- args = in_args;
+ out_args_p = false;
/* Pass pointer to the element zero and use its element zero
as the base address. */
tree etype = TREE_TYPE (TREE_TYPE (var));
}
gcc_assert (var != NULL_TREE);
- vec_safe_reserve (args, 1);
- vec_safe_push (args, var);
+ vec_safe_push (out_args_p ? out_args : in_args, var);
++operand_ptr;
bytes -= 4;
}
if (handlers[i].kind == entry->kind)
handler = handlers[i].handler;
}
- b += (*handler) (entry);
+
+ int bytes_processed = (*handler) (entry);
+ if (bytes_processed == 0)
+ fatal_error (UNKNOWN_LOCATION, PHSA_ERROR_PREFIX_CORRUPTED_MODULE
+ "Element with 0 bytes.");
+ b += bytes_processed;
}
if (m_cf != NULL)
/* There are no supported pragmas at this moment. */
{BRIG_KIND_DIRECTIVE_PRAGMA, &skipped_handler},
{BRIG_KIND_DIRECTIVE_CONTROL, &control_handler},
- {BRIG_KIND_DIRECTIVE_EXTENSION, &skipped_handler}};
+ {BRIG_KIND_DIRECTIVE_EXTENSION, &skipped_handler},
+ /* BRIG_KIND_NONE entries are valid anywhere. They can be used
+ for patching BRIGs before finalization. */
+ {BRIG_KIND_NONE, &skipped_handler}};
const BrigSectionHeader *csection_header = (const BrigSectionHeader *) m_code;
#define PHSA_DESC_SECTION_PREFIX "phsa.desc."
#define PHSA_HOST_DEF_PTR_PREFIX "__phsa.host_def."
-/* The frontend error messages are parsed by the host runtime, known
+/* The frontend error messages are parsed by the host runtime. Known
prefix strings are used to separate the different runtime error
codes. */
-#define PHSA_ERROR_PREFIX_INCOMPATIBLE_MODULE "Incompatible module:"
+#define PHSA_ERROR_PREFIX_INCOMPATIBLE_MODULE "Incompatible module: "
+#define PHSA_ERROR_PREFIX_CORRUPTED_MODULE "Corrupted module: "
#endif