Opened 5 years ago
Closed 3 years ago
#15827 closed bug (fixed)
memset is causing infinite recursion with clang build
Reported by: | X512 | Owned by: | nobody |
---|---|---|---|
Priority: | normal | Milestone: | R1/beta4 |
Component: | System/libroot.so | Version: | R1/Development |
Keywords: | Cc: | ||
Blocked By: | Blocking: | ||
Platform: | x86-64 |
Description
This is hrev54001 x86_64 clang/lld build.
Clang produce memset call inside memset_small that is used by memset implementation causing infinite recursion (https://git.haiku-os.org/haiku/tree/src/system/libroot/posix/string/arch/x86_64/arch_string.cpp#n213).
This problem is causing crash in runtime_loader of init process and boot fail.
Change History (7)
comment:1 by , 5 years ago
comment:2 by , 5 years ago
Actually, just putting it in string/Jamfile may be the right place. That way the rest of libroot can still take advantage of those optimizations.
comment:3 by , 5 years ago
Eh, on second thought, it seems kind of dangerous to do those optimizations in the kernel or userland libraries at all; it's probably much better if we just add that flag across the board when compiling with Clang.
comment:4 by , 5 years ago
Can't we just call __builtin_memset
instead of having all this code, and let gcc/clang do the right thing?
comment:5 by , 5 years ago
I tested builtin_memset and it generate code that call regular memset.
comment:6 by , 5 years ago
Uh, GCC/Clang __builtin_memset()
only gets "inlined" for small copies (i.e. I think something like 64 bytes is the maximum), it is very primitive and not at all optimized for large (i.e. KBs/MBs) sets. We have to provide a memset one way or another.
comment:7 by , 3 years ago
Milestone: | Unscheduled → R1/beta4 |
---|---|
Resolution: | → fixed |
Status: | new → closed |
Fixed in hrev55661.
Probably we need to compile arch_string with
-disable-simplify-libcalls
, or maybe even all of libroot with it.