From 60862fe491646168c8e766c681b9858375c47ab7 Mon Sep 17 00:00:00 2001 From: James Rhodes Date: Tue, 13 Nov 2012 02:24:31 +1100 Subject: [PATCH] Added error message for issue #191 and reverted previous fix. --- libdcpu-ld/ldbin.c | 5 ++++- libdcpu/err.d | 3 ++- tool-errgen/lexer.l | 4 ++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/libdcpu-ld/ldbin.c b/libdcpu-ld/ldbin.c index 2667173..acc24cb 100644 --- a/libdcpu-ld/ldbin.c +++ b/libdcpu-ld/ldbin.c @@ -514,7 +514,8 @@ void bin_info_remove(list_t* all, struct ldbin* bin, list_t* list, bool isAdjust { // Adjust the address stored in the entry down // by the amount of words that were removed. - entry->address -= count; + // FIXME: This causes silent corruption (see issue #191). + //entry->address -= count; } } @@ -537,6 +538,8 @@ void bin_info_remove(list_t* all, struct ldbin* bin, list_t* list, bool isAdjust // Get the existing value of the adjustment. word = (uint16_t*)list_get_at(&abin->words, entry->address); + if (word == NULL) + dhalt(ERR_BUG_191_WORKAROUND, NULL); assert(word != NULL); // Check to see if this adjustment entry is pointing into diff --git a/libdcpu/err.d b/libdcpu/err.d index ce1ad32..c5ffa09 100644 --- a/libdcpu/err.d +++ b/libdcpu/err.d @@ -54,7 +54,8 @@ ERR_CALL_CONVENTION_UNKNOWN call-convention-unknown ERR_CALL_MISSING_INTERRUPT_PARAMETERS call-missing-interrupt-parameters "the interrupt calling convention specified in the kernel is missing either interrupt-call() or interrupt-size() for '%s' and thus the required code can not be determined." ERR_JUMPLIST_WITHOUT_KERNEL jumplist-without-kernel "you must be linking in kernel mode (-l kernel) in order to use the --jumplist parameter." ERR_POLICY_WITH_KERNEL policy-with-kernel "you can not use the policy (-p) option when linking in kernel mode as it has no use." - +ERR_BUG_191_WORKAROUND bug-191-workaround "avoided silent corruption during link stage (see GitHub issue #191)." + WARN_SKIPPING_SHORT_LITERALS_TYPE short-literals-skipped-type "skipped short literal compression due to target type." WARN_SKIPPING_SHORT_LITERALS_REQUEST short-literals-skipped-request "skipped short literal compression on request." WARN_KERNEL_NOT_PROVIDING_JUMP_LIST jump-list-missing "kernel did not specify a position to output a jump list with .JUMP." diff --git a/tool-errgen/lexer.l b/tool-errgen/lexer.l index b39b5a5..42bebd3 100644 --- a/tool-errgen/lexer.l +++ b/tool-errgen/lexer.l @@ -30,8 +30,8 @@ %% -ERR_[A-Z_]+ yylval.word = strdup(yytext); return ERROR_DEF; -WARN_[A-Z_]+ yylval.word = strdup(yytext); return WARNING_DEF; +ERR_[A-Z0-9_]+ yylval.word = strdup(yytext); return ERROR_DEF; +WARN_[A-Z0-9_]+ yylval.word = strdup(yytext); return WARNING_DEF; [a-z0-9-]+ yylval.word = strdup(yytext); return NAME; \" BEGIN(STRING); [^\"]* yylval.word = strdup(yytext); return MESSAGE;