Cause B programs to fail on startup if they detect alignment issues.

This commit is contained in:
David Given 2019-06-17 22:27:13 +02:00
parent 94867d24b7
commit c9d14f6c9e
2 changed files with 4 additions and 0 deletions

View file

@ -14,6 +14,8 @@
#error Unsupported EM_PSIZE #error Unsupported EM_PSIZE
#endif #endif
#define MASK ((1<<SHIFT)-1)
extern FILE* input_unit; extern FILE* input_unit;
extern FILE* output_unit; extern FILE* output_unit;

View file

@ -173,6 +173,8 @@ void patch_addresses(uintptr_t** p)
while (*p) while (*p)
{ {
uintptr_t* q = *p++; uintptr_t* q = *p++;
if (*q & MASK)
abort();
*q >>= SHIFT; *q >>= SHIFT;
} }
} }