summaryrefslogtreecommitdiff
path: root/tools/cpp-define-generator/Android.bp
diff options
context:
space:
mode:
author David Srbecky <dsrbecky@google.com> 2018-10-01 18:17:45 +0100
committer David Srbecky <dsrbecky@google.com> 2018-10-12 03:22:29 +0100
commit0adf4d80ca1c673e5f7c5249faabadccdc1ddbbd (patch)
tree0c4f88f1fa6ab56fd1b24426c75f17836a6bd81d /tools/cpp-define-generator/Android.bp
parent78940f2254354373c6b311c759c43f51d3ad77f1 (diff)
Rewrite cpp-define-generator
The new method works by generating temporary per-architecture human-readable object file with the constants embedded in it. Python script extracts those values and generates the header. This means the values can now implicitly depend on pointer size, compile time flags, or ABI specific object layout with no hacks. Test: test-art-host-gtest-arch_test Change-Id: Id6e8c77c01f9d6c49cd6d40e3487b56fa4777349
Diffstat (limited to 'tools/cpp-define-generator/Android.bp')
-rw-r--r--tools/cpp-define-generator/Android.bp51
1 files changed, 31 insertions, 20 deletions
diff --git a/tools/cpp-define-generator/Android.bp b/tools/cpp-define-generator/Android.bp
index a94f4044b8..0d3943e141 100644
--- a/tools/cpp-define-generator/Android.bp
+++ b/tools/cpp-define-generator/Android.bp
@@ -14,16 +14,11 @@
// limitations under the License.
//
-// Build a "data" binary which will hold all the symbol values that will be parsed by the other scripts.
-//
-// Builds are for host only, target-specific define generation is possibly but is trickier and would need extra tooling.
-//
-// In the future we may wish to parameterize this on (32,64)x(read_barrier,no_read_barrier).
-
-cc_binary { // Do not use art_cc_binary because HOST_PREFER_32_BIT is incompatible with genrule.
- name: "cpp-define-generator-data",
+// This produces human-readable asm_defines.s with the embedded compile-time constants.
+cc_object {
+ name: "asm_defines.s",
host_supported: true,
- device_supported: false,
+ device_supported: true,
defaults: [
"art_debug_defaults",
"art_defaults",
@@ -33,20 +28,36 @@ cc_binary { // Do not use art_cc_binary because HOST_PREFER_32_BIT is incompatib
"art/libdexfile",
"art/libartbase",
"art/runtime",
+ "system/core/base/include",
],
- srcs: ["main.cc"],
- shared_libs: [
- "libbase",
- ],
+ // Produce text file rather than binary.
+ cflags: ["-S"],
+ srcs: ["asm_defines.cc"],
}
-// Note: See $OUT_DIR/soong/build.ninja
-// For the exact filename that this generates to run make command on just
-// this rule later.
-genrule {
+// This extracts the compile-time constants from asm_defines.s and creates the header.
+cc_genrule {
name: "cpp-define-generator-asm-support",
+ host_supported: true,
+ device_supported: true,
+ srcs: [":asm_defines.s"],
out: ["asm_support_gen.h"],
- tools: ["cpp-define-generator-data"],
- tool_files: ["*.def"],
- cmd: "$(location cpp-define-generator-data) > \"$(out)\"",
+ tool_files: ["make_header.py"],
+ cmd: "$(location make_header.py) \"$(in)\" > \"$(out)\"",
+}
+
+cc_library_headers {
+ name: "cpp-define-generator-definitions",
+ host_supported: true,
+ export_include_dirs: ["."],
+}
+
+python_binary_host {
+ name: "cpp-define-generator-test",
+ main: "make_header_test.py",
+ srcs: [
+ "make_header.py",
+ "make_header_test.py",
+ ],
+ test_suites: ["general-tests"],
}