https://bugs.llvm.org/show_bug.cgi?id=47280

            Bug ID: 47280
           Summary: [feature request] -fbuiltin-*
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected], [email protected],
                    [email protected], [email protected],
                    [email protected], [email protected],
                    [email protected]

>From this thread on LKML:
https://lore.kernel.org/lkml/[email protected]/

It was noted that for hosted environments that don't quite have a full libc
implementation, that they can lean on -fno-builtin-* flags in Clang to avoid
libcall optimizations where LLVM would emit calls to * which the environment
did not provide definitions of (though this differs from GCC's behavior, see
these three posts from Arvind that are a really fantastic analysis:
1. https://lore.kernel.org/lkml/[email protected]/
2. https://lore.kernel.org/lkml/[email protected]/
3. https://lore.kernel.org/lkml/[email protected]/
).

Kernel developer H. Peter Anvin points out it would be helpful for embedded
environments that would use -ffreestanding to opt out of all such libcall
optimizations, to be able to opt back in (rather than opting out via
-fno-builtin-*) to certain libcall optimizations when the otherwise
freestanding implementation provided such symbols with matching semantics (ie.
the Linux kernel).

It was suggested that listing supported functions in the environment via
#pragma's (maybe in a header for codebase-wide inclusion) might be helpful.  In
particular, I think it would slot in nicely in Clang to provide -fbuiltin-*
support (there's rules in tablegen to generate support for -f-* and -fno-* from
one rule).  So `-ffreestanding -fbuiltin-strcpy` would be "disable all libcall
optimizations except related to transforming other libcalls into strcpy,
denoting the target supported no other builtins than strcpy (and the always
required mem* family).

It's not an immediate need, more so a curiosity that it's easy to opt out of
libcall optimizations, but not necessarily opt in.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to