Debian Codegraph @

build/unix/elfhack/inject/moz.build

raw
1 # -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
2 # vim: set filetype=python:
3 # This Source Code Form is subject to the terms of the Mozilla Public
4 # License, v. 2.0. If a copy of the MPL was not distributed with this
5 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
6
7 # dummy library name to avoid skipping building the source here, which
8 # we only need the object for.
9 Library("elfhack_inject")
10
11 DIST_INSTALL = False
12
13 stem = CONFIG["TARGET_CPU"]
14 if CONFIG["RELRHACK"] and CONFIG["OS_TARGET"] == "Android":
15 stem += "-android"
16
17 gen_src = "%s.c" % stem
18 GeneratedFile(
19 gen_src, script="copy_source.py", entry_point="copy", inputs=["../inject.c"]
20 )
21
22 SOURCES += [
23 "!%s" % gen_src,
24 ]
25
26 if CONFIG["RELRHACK"]:
27 DEFINES["RELRHACK"] = True
28 LOCAL_INCLUDES += [".."]
29
30 NO_PGO = True
31
32 for v in ("OS_CPPFLAGS", "OS_CFLAGS", "DEBUG", "CLANG_PLUGIN", "OPTIMIZE", "FRAMEPTR"):
33 flags = []
34 idx = 0
35 for flag in COMPILE_FLAGS[v]:
36 if flag == "-isystem":
37 flags.append("".join(COMPILE_FLAGS[v][idx : idx + 2]))
38 elif (
39 flag.startswith(("-g", "-m", "-I", "-isystem", "--sysroot="))
40 or flag == "-fPIC"
41 ):
42 flags.append(flag)
43 idx += 1
44 COMPILE_FLAGS[v] = flags
45
46 COMPILE_FLAGS["OS_CFLAGS"] += [
47 "-O2",
48 "-fno-stack-protector",
49 "-fno-lto",
50 # The injected code runs early enough that it supporting unwinding is useless.
51 # Moreover, elfhack doesn't inject the eh_frame section anyways.
52 "-fno-asynchronous-unwind-tables",
53 ]
54
55 AllowCompilerWarnings()
56 NoVisibilityFlags()