Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
emscripten-core
GitHub Repository: emscripten-core/emscripten
Path: blob/main/system/lib/llvm-libc/hdr/stdlib_overlay.h
6168 views
1
//===-- Including stdlib.h in overlay mode --------------------------------===//
2
//
3
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
// See https://llvm.org/LICENSE.txt for license information.
5
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
//
7
//===----------------------------------------------------------------------===//
8
9
#ifndef LLVM_LIBC_HDR_STDLIB_OVERLAY_H
10
#define LLVM_LIBC_HDR_STDLIB_OVERLAY_H
11
12
#ifdef LIBC_FULL_BUILD
13
#error "This header should only be included in overlay mode"
14
#endif
15
16
// Overlay mode
17
18
// glibc <stdlib.h> header might provide extern inline definitions for few
19
// functions, causing external alias errors. They are guarded by
20
// `__USE_FORTIFY_LEVEL`, which will be temporarily disabled.
21
22
#ifdef _FORTIFY_SOURCE
23
#define LIBC_OLD_FORTIFY_SOURCE _FORTIFY_SOURCE
24
#undef _FORTIFY_SOURCE
25
#endif
26
27
#ifdef __USE_FORTIFY_LEVEL
28
#define LIBC_OLD_USE_FORTIFY_LEVEL __USE_FORTIFY_LEVEL
29
#undef __USE_FORTIFY_LEVEL
30
#define __USE_FORTIFY_LEVEL 0
31
#endif
32
33
#include <stdlib.h>
34
35
#ifdef LIBC_OLD_FORTIFY_SOURCE
36
#define _FORTIFY_SOURCE LIBC_OLD_FORTIFY_SOURCE
37
#undef LIBC_OLD_FORTIFY_SOURCE
38
#endif
39
40
#ifdef LIBC_OLD_USE_FORTIFY_LEVEL
41
#undef __USE_FORTIFY_LEVEL
42
#define __USE_FORTIFY_LEVEL LIBC_OLD_USE_FORTIFY_LEVEL
43
#undef LIBC_OLD_USE_FORTIFY_LEVEL
44
#endif
45
46
#endif
47
48