Cross Compiler Causes memory functions to break.

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
maxtyson123
Posts: 19
Joined: Wed Apr 19, 2023 1:40 am
Freenode IRC: maxtyson123

Cross Compiler Causes memory functions to break.

Post by maxtyson123 »

My OS: https://github.com/maxtyson123/max-os/

When I am trying to override the new() functions etc I am getting an error saying the size parameter should be a 64 bit number even though the custom compiler targets 32bit:

Code: Select all

in file included from kernel/src/memory/memorymanagement.cpp:5:

kernel/include/memory/memorymanagement.h:78:7: error: 'operator new' takes type 'size_t' ('long unsigned int') as first parameter [-fpermissive]

78 | void* operator new(unsigned size);
I am wondering why this happens as when I try to compile it with my dist's gcc it works fine (after passing in the relevant 32bit parms)
Octocontrabass
Member
Member
Posts: 5218
Joined: Mon Mar 25, 2013 7:01 pm

Re: Cross Compiler Causes memory functions to break.

Post by Octocontrabass »

maxtyson123 wrote:I am getting an error saying the size parameter should be a 64 bit number
No, you are getting an error saying the size parameter should be size_t. In your chosen ABI, size_t is equivalent to long unsigned int, which means in your chosen ABI, long unsigned int is 32 bits.

Your cross-compiler includes freestanding headers like stddef.h that include the correct definitions for standard types like size_t. Use those headers.
Post Reply