Latest gcc optimizes ptr = malloc(size); memset(ptr, 0, size); to a calloc call. Guess how I implement calloc?
-
-
Replying to @sortiecat
@SortieCat Does -ffreestanding help? You need that for implementing libc functions.1 reply 0 retweets 0 likes -
Replying to @RichFelker
@RichFelker Yeah. -ffreestanding implies -fno-builtin which implies -fno-builtin-malloc which suppresses that optimization.1 reply 0 retweets 0 likes -
Replying to @sortiecat
@RichFelker Is -ffreestanding actually required, will -fno-builtin not suffice? I only -ffreestanding kernel code atm.2 replies 0 retweets 0 likes -
Replying to @sortiecat
.
@RichFelker But the right thing is for GCC to never do that optimization inside calloc. Trying to fix that now.2 replies 0 retweets 0 likes -
Replying to @sortiecat
@SortieCat@RichFelker -ffreestanding is the flag for "libc doesn't exist". It's therefore needed for implementing libc, not just the kernel1 reply 0 retweets 1 like -
Replying to @pikhq
.
@pikhq@RichFelker Yes. But libc does exist, it's right here. I just patched gcc to not do this inside calloc.1 reply 0 retweets 0 likes
@SortieCat No, @pikhq is right. libc does not exist prior to you implementing it. Assuming it does is circular.
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.