[compiler-rt] 2e2b6b5 - [AArch64][compiler-rt] Avoid use of libc header in sme-libc-routines (#79454)

via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 29 03:07:07 PST 2024


Author: Peter Waller
Date: 2024-01-29T11:07:02Z
New Revision: 2e2b6b53f5f63179b52168ee156df7c76b90bc71

URL: https://github.com/llvm/llvm-project/commit/2e2b6b53f5f63179b52168ee156df7c76b90bc71
DIFF: https://github.com/llvm/llvm-project/commit/2e2b6b53f5f63179b52168ee156df7c76b90bc71.diff

LOG: [AArch64][compiler-rt] Avoid use of libc header in sme-libc-routines (#79454)

The use of `#include <stdlib.h>` introduces a libc dependency. In many
build environments such a file can be found under e.g. /usr/include, but
this does not necessarily correspond to the libc in use, which may not
be available until after the builtins have been built.

So far as I understand, it's not valid to have a dependency on libc from
builtins; there are a handful of such includes in builtins, but they are
protected by ifdefs.

Instead, use <stddef.h>, which provides `size_t` and is provided by the
compiler's resource headers and so should always be available.

Added: 
    

Modified: 
    compiler-rt/lib/builtins/aarch64/sme-libc-routines.c

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/builtins/aarch64/sme-libc-routines.c b/compiler-rt/lib/builtins/aarch64/sme-libc-routines.c
index cd73025a19cc1ac..89b52b0d1a8805c 100644
--- a/compiler-rt/lib/builtins/aarch64/sme-libc-routines.c
+++ b/compiler-rt/lib/builtins/aarch64/sme-libc-routines.c
@@ -1,4 +1,4 @@
-#include <stdlib.h>
+#include <stddef.h>
 
 // WARNING: When building the scalar versions of these functions you need to
 // use the compiler flag "-mllvm -disable-loop-idiom-all" to prevent clang


        


More information about the llvm-commits mailing list