Bill Wendling
2018-Jun-06 09:23 UTC
[klibc] [PATCH] kbuild: add -ffreestanding to required flags
New clang versions need the '-ffreestanding' flag because new changes convert system calls to their unlocked versions, which don't exist in the kernel library. Signed-off-by: Bill Wendling <morbo at google.com> diff --git a/scripts/Kbuild.klibc b/scripts/Kbuild.klibc index f500d535..9cf4b2d9 100644 --- a/scripts/Kbuild.klibc +++ b/scripts/Kbuild.klibc @@ -67,7 +67,8 @@ include $(srctree)/scripts/Kbuild.include # --------------------------------------------------------------------------- KLIBCREQFLAGS := $(call cc-option, -fno-stack-protector, ) \ - $(call cc-option, -fwrapv, ) + $(call cc-option, -fwrapv, ) \ + $(call cc-option, -ffreestanding, ) KLIBCARCHREQFLAGS : KLIBCOPTFLAGS : KLIBCWARNFLAGS := -W -Wall -Wno-sign-compare -Wno-unused-parameter -- Bill Wendling | SWE | wcw <morbo at google.com>@google.com <morbo at google.com> | 408-921-0157 -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://www.zytor.com/pipermail/klibc/attachments/20180606/cad606b3/attachment.html>
Thorsten Glaser
2018-Jun-06 11:27 UTC
[klibc] [PATCH] kbuild: add -ffreestanding to required flags
Bill Wendling dixit:>New clang versions need the '-ffreestanding' flag because new changes >convert system calls to their unlocked versions, which don't exist in >the kernel library.This is probably wrong, a libc is not, in contrast to a bootloader or kernel, a freestanding environment. For the case of GCC, -ffreestanding is definitely wrong. Please look for another solution, e.g. teach clang that klibc does not have those unlocked calls. (AIUI klibc only supports GCC officially anyway?) bye, //mirabilos -- ?It is inappropriate to require that a time represented as seconds since the Epoch precisely represent the number of seconds between the referenced time and the Epoch.? -- IEEE Std 1003.1b-1993 (POSIX) Section B.2.2.2
Bill Wendling
2018-Jun-06 18:50 UTC
[klibc] [PATCH] kbuild: add -ffreestanding to required flags
They way to indicate to clang that those calls shouldn't be lowered to their unlocked versions is to mark it as freestanding. Freestanding simply means that the standard C library can't be assumed to be available, which in this case it's not because you're creating the C library. So I'm not sure what other solution you wish to see here (apart from implementing the unlocked versions in klibc, which I don't think you want). Could you explain why this is wrong for GCC? -bw On Wed, Jun 6, 2018 at 4:35 AM Thorsten Glaser <tg at mirbsd.de> wrote:> Bill Wendling dixit: > > >New clang versions need the '-ffreestanding' flag because new changes > >convert system calls to their unlocked versions, which don't exist in > >the kernel library. > > This is probably wrong, a libc is not, in contrast to a bootloader > or kernel, a freestanding environment. > > For the case of GCC, -ffreestanding is definitely wrong. > > Please look for another solution, e.g. teach clang that klibc > does not have those unlocked calls. (AIUI klibc only supports > GCC officially anyway?) > > bye, > //mirabilos > -- > ?It is inappropriate to require that a time represented as > seconds since the Epoch precisely represent the number of > seconds between the referenced time and the Epoch.? > -- IEEE Std 1003.1b-1993 (POSIX) Section B.2.2.2 >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://www.zytor.com/pipermail/klibc/attachments/20180606/c6771461/attachment.html>
Maybe Matching Threads
- [PATCH] kbuild: add -ffreestanding to required flags
- [LLVMdev] [llvm-commits] [llvm] r166875 - in /llvm/trunk: lib/Transforms/Scalar/LoopIdiomRecognize.cpp test/Transforms/LoopIdiom/basic.ll
- RFC: module flag for hosted mode
- RFC: module flag for hosted mode
- RFC: module flag for hosted mode