Apply duane's patch for align power-of-two checking in inline asm. Fixes #159

This commit is contained in:
Christian Kamm
2009-01-04 15:39:34 +01:00
parent 12a21b1397
commit 955df981f8
2 changed files with 8 additions and 6 deletions

View File

@@ -1140,7 +1140,7 @@ typedef enum {
// mov eax, 4
// mov eax, fs:4
// -- have to assume we know wheter or not to use '$'
// -- have to assume we know whether or not to use '$'
static Token eof_tok;
static Expression * Handled;
@@ -2517,8 +2517,9 @@ struct AsmProcessor
Expression * e = parseAsmExp()->optimize(WANTvalue | WANTinterpret);
integer_t align = e->toInteger();
if (align >= 0) {
// %% is this printf portable?
if (align & align - 1 == 0) {
//FIXME: This printf is not portable. The use of `align` varies from system to system;
// on i386 using a.out, .align `n` will align on a 2^`n` boundary instead of an `n` boundary
#ifdef HAVE_GAS_BALIGN_AND_P2ALIGN
insnTemplate->printf(".balign\t%u", (unsigned) align);
#else

View File

@@ -1260,7 +1260,7 @@ typedef enum {
// mov eax, 4
// mov eax, fs:4
// -- have to assume we know wheter or not to use '$'
// -- have to assume we know whether or not to use '$'
static Token eof_tok;
static Expression * Handled;
@@ -2638,8 +2638,9 @@ struct AsmProcessor
Expression * e = parseAsmExp()->optimize(WANTvalue | WANTinterpret);
integer_t align = e->toInteger();
if (align >= 0) {
// %% is this printf portable?
if (align & align - 1 == 0) {
//FIXME: This printf is not portable. The use of `align` varies from system to system;
// on i386 using a.out, .align `n` will align on a 2^`n` boundary instead of an `n` boundary
#ifdef HAVE_GAS_BALIGN_AND_P2ALIGN
insnTemplate->printf(".balign\t%u", (unsigned) align);
#else