OSDev.org
https://forum.osdev.org/

Cross Compiler Causes memory functions to break.
https://forum.osdev.org/viewtopic.php?f=1&t=57041
Page 1 of 1

Author:  maxtyson123 [ Sun Dec 03, 2023 10:04 pm ]
Post subject:  Cross Compiler Causes memory functions to break.

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)

Author:  Octocontrabass [ Sun Dec 03, 2023 10:56 pm ]
Post subject:  Re: Cross Compiler Causes memory functions to break.

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.

Page 1 of 1 All times are UTC - 6 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/