bad or irreducible absolute expression

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
User avatar
Bughunter
Member
Member
Posts: 94
Joined: Mon Dec 18, 2006 5:49 am
Location: Netherlands
Contact:

bad or irreducible absolute expression

Post 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
Attachments
multiboot_header.zip
(2.73 KiB) Downloaded 102 times
nick8325
Member
Member
Posts: 200
Joined: Wed Oct 18, 2006 5:49 am

Post 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".
User avatar
Bughunter
Member
Member
Posts: 94
Joined: Mon Dec 18, 2006 5:49 am
Location: Netherlands
Contact:

Post 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)
Post Reply