OSDev.org

The Place to Start for Operating System Developers
It is currently Sat Apr 27, 2024 10:50 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Cross Compiler Causes memory functions to break.
PostPosted: Sun Dec 03, 2023 10:04 pm 
Offline

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


Top
 Profile  
 
 Post subject: Re: Cross Compiler Causes memory functions to break.
PostPosted: Sun Dec 03, 2023 10:56 pm 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 5146
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.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: SemrushBot [Bot] and 20 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group