[compiler-rt] [AArch64][compiler-rt] Avoid use of libc header in sme-libc-routines (PR #79454)
Peter Waller via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 25 06:43:03 PST 2024
https://github.com/peterwaller-arm created https://github.com/llvm/llvm-project/pull/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 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 is provided by the compiler's resource headers and so should always be available.
>From 18fbfe3d757372fc904146a9156e8af466c9f013 Mon Sep 17 00:00:00 2001
From: Peter Waller <peter.waller at arm.com>
Date: Thu, 25 Jan 2024 14:29:45 +0000
Subject: [PATCH] [AArch64][compiler-rt] Avoid use of libc header in
sme-libc-routines
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 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 is provided by the compiler's resource
headers and so should always be available.
---
compiler-rt/lib/builtins/aarch64/sme-libc-routines.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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