diff options
| author | Matthias Maennich <maennich@google.com> | 2020-08-28 19:47:55 +0000 |
|---|---|---|
| committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2020-08-28 19:47:55 +0000 |
| commit | 5df519746d3c6640c6a29dbfd5349bca1940dc6e (patch) | |
| tree | df2b5520a531308ceef412593119139eee7f883c | |
| parent | c5b4e5383b536e7b25ac60079bcceef9ff3fc6e7 (diff) | |
| parent | ee729f7e739861149d90426f7495b322e7902478 (diff) | |
| download | platform_external_elfutils-5df519746d3c6640c6a29dbfd5349bca1940dc6e.tar.gz platform_external_elfutils-5df519746d3c6640c6a29dbfd5349bca1940dc6e.tar.bz2 platform_external_elfutils-5df519746d3c6640c6a29dbfd5349bca1940dc6e.zip | |
Merge "Add build description for libdw" am: ee729f7e73
Original change: https://android-review.googlesource.com/c/platform/external/elfutils/+/1346247
Change-Id: Ied84473132346382df6d510bc7dc916834c9377e
| -rw-r--r-- | Android.bp | 54 | ||||
| -rw-r--r-- | lib/Android.bp | 7 | ||||
| -rw-r--r-- | libcpu/Android.bp | 75 | ||||
| -rwxr-xr-x | libcpu/mnemonic_preprocess.sh | 10 |
4 files changed, 146 insertions, 0 deletions
@@ -17,6 +17,8 @@ cc_defaults { cflags: [ "-DHAVE_CONFIG_H", "-D_GNU_SOURCE", + // upper bound for the number of lines of the resulting mnemonic files + "-DNMNES=1000", "-std=gnu99", "-Werror", // to suppress the "pointer of type ‘void *’ used in arithmetic" warning @@ -27,6 +29,11 @@ cc_defaults { "elfutils_headers", ], export_header_lib_headers: ["elfutils_headers"], + + visibility: [ + "//external/dwarves:__subpackages__", + "//external/elfutils:__subpackages__", + ], } cc_library { @@ -80,3 +87,50 @@ cc_library_headers { visibility: [":__subpackages__"], } +cc_library_host_static { + name: "libdw", + defaults: ["elfutils_defaults"], + srcs: [ + "backends/*.c", + "libcpu/*_disasm.c", + "libdw/*.c", + "libdwelf/*.c", + "libdwfl/*.c", + "libebl/*.c", + ], + generated_headers: [ + "i386_dis", + "i386_mnemonics", + "x86_64_dis", + "x86_64_mnemonics", + ], + exclude_srcs: [ + // Do not enabled compression support + "libdwfl/bzip2.c", + "libdwfl/lzma.c", + // Those headers are incompatible with clang due to nested function + // definitions. + "libdwfl/dwfl_segment_report_module.c", + "libdwfl/elf-from-memory.c", + "libdwfl/link_map.c", + // Those are common source files actually used as headers and not + // compiled standalone. + "backends/common-reloc.c", + "backends/linux-core-note.c", + "backends/x86_corenote.c", + ], + local_include_dirs: [ + "libcpu", + "libasm", + "libdwelf", + "libdwfl", + "libebl", + ], + export_include_dirs: [ + "libdw", + ], + static_libs: [ + "libelf" + ], +} + diff --git a/lib/Android.bp b/lib/Android.bp new file mode 100644 index 00000000..31647ee5 --- /dev/null +++ b/lib/Android.bp @@ -0,0 +1,7 @@ +cc_library_host_static { + name: "libeu", + defaults: ["elfutils_defaults"], + srcs: ["*.c"], + exclude_srcs: ["dynamicsizehash*.c"], +} + diff --git a/libcpu/Android.bp b/libcpu/Android.bp new file mode 100644 index 00000000..5ffe48ae --- /dev/null +++ b/libcpu/Android.bp @@ -0,0 +1,75 @@ +genrule { + name: "i386_mnemonics", + srcs: [ + "defs/i386", + ], + out: ["i386.mnemonics"], + cmd: "M4=$(location m4) $(location mnemonic_preprocess.sh) i386 $(in) $(out)", + tool_files: [ + "mnemonic_preprocess.sh", + ], + tools : [ + "m4", + ] +} + +genrule { + name: "x86_64_mnemonics", + srcs : [ + "defs/i386", + ], + out : ["x86_64.mnemonics"], + cmd : "M4=$(location m4) $(location mnemonic_preprocess.sh) x86_64 $(in) $(out)", + tool_files : [ + "mnemonic_preprocess.sh", + ], + tools : [ + "m4", + ] +} + +cc_binary_host { + name: "i386_gendis", + defaults: ["elfutils_defaults"], + srcs: [ + "i386_parse.y", + "i386_lex.l", + "i386_gendis.c", + ], + yacc: { + flags: ["-pi386_",] + }, + lex: { + flags: ["-Pi386_",] + }, + static_libs: [ + "libeu", + ], +} + +genrule { + name: "i386_dis", + srcs: [ + "defs/i386", + ], + out: ["i386_dis.h"], + cmd: "$(location m4) -Di386 -DDISASSEMBLER $(in) > i386_defs && $(location i386_gendis) i386_defs > $(out)", + tools: [ + "i386_gendis", + "m4", + ], +} + +genrule { + name: "x86_64_dis", + srcs: [ + "defs/i386", + ], + out: ["x86_64_dis.h"], + cmd: "$(location m4) -Dx86_64 -DDISASSEMBLER $(in) > x86_64_defs && $(location i386_gendis) x86_64_defs > $(out)", + tools: [ + "i386_gendis", + "m4", + ], +} + diff --git a/libcpu/mnemonic_preprocess.sh b/libcpu/mnemonic_preprocess.sh new file mode 100755 index 00000000..2b052495 --- /dev/null +++ b/libcpu/mnemonic_preprocess.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +arch="$1" +defs="$2" +out="$3" + +$M4 "-D${arch}" -DDISASSEMBLER "$defs" \ + | sed "1,/^%%/d;/^#/d;/^[[:space:]]*$/d;s/[^:]*:\([^[:space:]]*\).*/MNE(\\1)/;s/{[^}]*}//g;/INVALID/d" \ + | sort -u \ +> "$out" |
