• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
15import("//build_overrides/pigweed.gni")
16
17import("$dir_pw_build/facade.gni")
18import("$dir_pw_build/target_types.gni")
19import("$dir_pw_docgen/docs.gni")
20import("$dir_pw_malloc/backend.gni")
21import("$dir_pw_unit_test/test.gni")
22import("$dir_pw_unit_test/test.gni")
23
24config("default_config") {
25  include_dirs = [ "public" ]
26}
27
28config("pw_malloc_wrapper_config") {
29  # Link options that provides replace dynamic memory operations in standard
30  # library with the pigweed malloc.
31  ldflags = [
32    # memory allocation -- these must be re-entrant and do locking
33    "-Wl,--wrap=malloc",
34    "-Wl,--wrap=free",
35    "-Wl,--wrap=realloc",
36    "-Wl,--wrap=calloc",
37
38    # Wrap these in case internal newlib call them (e.g. strdup will)
39    # directly call _malloc_r)
40    "-Wl,--wrap=_malloc_r",
41    "-Wl,--wrap=_realloc_r",
42    "-Wl,--wrap=_free_r",
43    "-Wl,--wrap=_calloc_r",
44  ]
45}
46
47pw_facade("pw_malloc") {
48  public_configs = [ ":default_config" ]
49  public = [ "public/pw_malloc/malloc.h" ]
50  backend = pw_malloc_BACKEND
51}
52
53pw_doc_group("docs") {
54  sources = [ "docs.rst" ]
55}
56
57pw_test_group("tests") {
58}
59