Page 1 of 1

bad or irreducible absolute expression

Posted: Sat Jun 02, 2007 11:52 am
by Bughunter
When compiling my Multiboot header stub, I get this error:

Code: Select all

Error: bad or irreducible absolute expression
It complains about this line:

Code: Select all

.comm stack, STACK_SIZE, 32               # reserve 16K stack on a quadword boundary
I defined STACK_SIZE (in an external header file, but it doesn't matter if I define it in the same file) with:

Code: Select all

#define STACK_SIZE 0x4000
Can anyone tell me what could be wrong? I have included my Multiboot stub source codes if anyone wants to have a look.

Thanks

Posted: Sat Jun 02, 2007 5:21 pm
by nick8325
It works here...do you run multiboot_header.S through the preprocessor first? The assembler doesn't know about #defines. gcc will preprocess the file itself, if you run "gcc" instead of "as".

Posted: Sun Jun 03, 2007 3:36 am
by Bughunter
Hmm that could be it, so I should just call GCC instead of AS?

EDIT: Omg of course... It now works! Thank you!

Oh btw if anyone uses the code I posted above, make sure you correct the Multiboot header checksum (it's invalid) to:

Code: Select all

.long -(MULTIBOOT_HEADER_MAGIC + MULTIBOOT_HEADER_FLAGS)