Fix for x86_64 build fail
[platform/upstream/connectedhomeip.git] / third_party / pigweed / repo / pw_malloc / BUILD.gn
1 # Copyright 2020 The Pigweed Authors
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License"); you may not
4 # use this file except in compliance with the License. You may obtain a copy of
5 # the License at
6 #
7 #     https://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12 # License for the specific language governing permissions and limitations under
13 # the License.
14
15 import("//build_overrides/pigweed.gni")
16
17 import("$dir_pw_build/facade.gni")
18 import("$dir_pw_build/target_types.gni")
19 import("$dir_pw_docgen/docs.gni")
20 import("$dir_pw_malloc/backend.gni")
21 import("$dir_pw_unit_test/test.gni")
22
23 config("default_config") {
24   include_dirs = [ "public" ]
25 }
26
27 config("pw_malloc_wrapper_config") {
28   # Link options that provides replace dynamic memory operations in standard
29   # library with the pigweed malloc.
30   ldflags = [
31     # memory allocation -- these must be re-entrant and do locking
32     "-Wl,--wrap=malloc",
33     "-Wl,--wrap=free",
34     "-Wl,--wrap=realloc",
35     "-Wl,--wrap=calloc",
36
37     # Wrap these in case internal newlib call them (e.g. strdup will)
38     # directly call _malloc_r)
39     "-Wl,--wrap=_malloc_r",
40     "-Wl,--wrap=_realloc_r",
41     "-Wl,--wrap=_free_r",
42     "-Wl,--wrap=_calloc_r",
43   ]
44 }
45
46 pw_facade("pw_malloc") {
47   public_configs = [ ":default_config" ]
48   public = [ "public/pw_malloc/malloc.h" ]
49   backend = pw_malloc_BACKEND
50 }
51
52 pw_doc_group("docs") {
53   sources = [ "docs.rst" ]
54 }