xref: /aosp_15_r20/external/llvm-libc/hdr/stdlib_overlay.h (revision 71db0c75aadcf003ffe3238005f61d7618a3fead)
1*71db0c75SAndroid Build Coastguard Worker //===-- Including stdlib.h in overlay mode --------------------------------===//
2*71db0c75SAndroid Build Coastguard Worker //
3*71db0c75SAndroid Build Coastguard Worker // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4*71db0c75SAndroid Build Coastguard Worker // See https://llvm.org/LICENSE.txt for license information.
5*71db0c75SAndroid Build Coastguard Worker // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6*71db0c75SAndroid Build Coastguard Worker //
7*71db0c75SAndroid Build Coastguard Worker //===----------------------------------------------------------------------===//
8*71db0c75SAndroid Build Coastguard Worker 
9*71db0c75SAndroid Build Coastguard Worker #ifndef LLVM_LIBC_HDR_STDLIB_OVERLAY_H
10*71db0c75SAndroid Build Coastguard Worker #define LLVM_LIBC_HDR_STDLIB_OVERLAY_H
11*71db0c75SAndroid Build Coastguard Worker 
12*71db0c75SAndroid Build Coastguard Worker #ifdef LIBC_FULL_BUILD
13*71db0c75SAndroid Build Coastguard Worker #error "This header should only be included in overlay mode"
14*71db0c75SAndroid Build Coastguard Worker #endif
15*71db0c75SAndroid Build Coastguard Worker 
16*71db0c75SAndroid Build Coastguard Worker // Overlay mode
17*71db0c75SAndroid Build Coastguard Worker 
18*71db0c75SAndroid Build Coastguard Worker // glibc <stdlib.h> header might provide extern inline definitions for few
19*71db0c75SAndroid Build Coastguard Worker // functions, causing external alias errors.  They are guarded by
20*71db0c75SAndroid Build Coastguard Worker // `__USE_FORTIFY_LEVEL`, which will be temporarily disabled.
21*71db0c75SAndroid Build Coastguard Worker 
22*71db0c75SAndroid Build Coastguard Worker #ifdef __USE_FORTIFY_LEVEL
23*71db0c75SAndroid Build Coastguard Worker #define LIBC_OLD_USE_FORTIFY_LEVEL __USE_FORTIFY_LEVEL
24*71db0c75SAndroid Build Coastguard Worker #undef __USE_FORTIFY_LEVEL
25*71db0c75SAndroid Build Coastguard Worker #define __USE_FORTIFY_LEVEL 0
26*71db0c75SAndroid Build Coastguard Worker #endif
27*71db0c75SAndroid Build Coastguard Worker 
28*71db0c75SAndroid Build Coastguard Worker #include <stdlib.h>
29*71db0c75SAndroid Build Coastguard Worker 
30*71db0c75SAndroid Build Coastguard Worker #ifdef LIBC_OLD_USE_FORTIFY_LEVEL
31*71db0c75SAndroid Build Coastguard Worker #undef __USE_FORTIFY_LEVEL
32*71db0c75SAndroid Build Coastguard Worker #define __USE_FORTIFY_LEVEL LIBC_OLD_USE_FORTIFY_LEVEL
33*71db0c75SAndroid Build Coastguard Worker #undef LIBC_OLD_USE_FORTIFY_LEVEL
34*71db0c75SAndroid Build Coastguard Worker #endif
35*71db0c75SAndroid Build Coastguard Worker 
36*71db0c75SAndroid Build Coastguard Worker #endif
37