Upgrade capstone to fee83fcc1ad096c22d4f2066ccb58ad1a76a9886
Test: Treehugger
Change-Id: I0b7c9cb9f0e95cca5048582b6abf529206999241
diff --git a/Android.bp b/Android.bp
new file mode 100644
index 0000000..3ef1ae7
--- /dev/null
+++ b/Android.bp
@@ -0,0 +1,116 @@
+package {
+ default_applicable_licenses: ["external_capstone_license"],
+}
+
+// Added automatically by a large-scale-change that took the approach of
+// 'apply every license found to every target'. While this makes sure we respect
+// every license restriction, it may not be entirely correct.
+//
+// e.g. GPL in an MIT project might only apply to the contrib/ directory.
+//
+// Please consider splitting the single license below into multiple licenses,
+// taking care not to lose any license_kind information, and overriding the
+// default license using the 'licenses: [...]' property on targets as needed.
+//
+// For unused files, consider creating a 'fileGroup' with "//visibility:private"
+// to attach the license to, and including a comment whether the files may be
+// used in the current project.
+//
+// large-scale-change included anything that looked like it might be a license
+// text as a license_text. e.g. LICENSE, NOTICE, COPYING etc.
+//
+// Please consider removing redundant or irrelevant files from 'license_text:'.
+// See: http://go/android-license-faq
+license {
+ name: "external_capstone_license",
+ visibility: [":__subpackages__"],
+ license_kinds: [
+ "SPDX-license-identifier-APSL-2.0",
+ "SPDX-license-identifier-BSD",
+ "SPDX-license-identifier-MIT",
+ "SPDX-license-identifier-NCSA",
+ ],
+ license_text: [
+ "LICENSE",
+ "LICENSE.TXT",
+ "LICENSE_LLVM.TXT",
+ ],
+}
+
+arm_flags = ["-DCAPSTONE_HAS_ARM"]
+arm_srcs = [
+ "arch/ARM/ARMDisassembler.c",
+ "arch/ARM/ARMInstPrinter.c",
+ "arch/ARM/ARMMapping.c",
+ "arch/ARM/ARMModule.c",
+]
+
+arm64_flags = ["-DCAPSTONE_HAS_ARM64"]
+arm64_srcs = [
+ "arch/AArch64/AArch64BaseInfo.c",
+ "arch/AArch64/AArch64Disassembler.c",
+ "arch/AArch64/AArch64InstPrinter.c",
+ "arch/AArch64/AArch64Mapping.c",
+ "arch/AArch64/AArch64Module.c",
+]
+
+x86_flags = ["-DCAPSTONE_HAS_X86"]
+x86_srcs = [
+ "arch/X86/X86DisassemblerDecoder.c",
+ "arch/X86/X86Disassembler.c",
+ "arch/X86/X86IntelInstPrinter.c",
+ "arch/X86/X86ATTInstPrinter.c",
+ "arch/X86/X86Mapping.c",
+ "arch/X86/X86Module.c",
+]
+
+cc_defaults {
+ name: "capstone-defaults",
+ srcs: [
+ "cs.c",
+ "utils.c",
+ "SStream.c",
+ "MCInstrDesc.c",
+ "MCRegisterInfo.c",
+ "MCInst.c",
+ ],
+ cflags: [
+ "-Wall",
+ "-Werror",
+ "-Wno-unused-parameter",
+ "-Wno-missing-field-initializers",
+ "-DCAPSTONE_USE_SYS_DYN_MEM",
+ ],
+ export_include_dirs: [
+ ".",
+ "include",
+ ],
+
+ arch: {
+ arm: {
+ cflags: arm_flags,
+ srcs: arm_srcs,
+ },
+ x86: {
+ cflags: arm_flags + arm64_flags + x86_flags,
+ srcs: arm_srcs + arm64_srcs + x86_srcs,
+ },
+ x86_64: {
+ cflags: arm_flags + arm64_flags + x86_flags,
+ srcs: arm_srcs + arm64_srcs + x86_srcs,
+ },
+ arm64: {
+ cflags: arm_flags + arm64_flags,
+ srcs: arm_srcs + arm64_srcs,
+ },
+ },
+}
+
+// For the host and device platform
+// =====================================================
+
+cc_library {
+ name: "libcapstone",
+ host_supported: true,
+ defaults: ["capstone-defaults"],
+}
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..0dabdc7
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,31 @@
+This is the software license for Capstone disassembly framework.
+Capstone has been designed & implemented by Nguyen Anh Quynh <aquynh@gmail.com>
+
+See http://www.capstone-engine.org for further information.
+
+Copyright (c) 2013, COSEINC.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+* Neither the name of the developer(s) nor the names of its
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
diff --git a/METADATA b/METADATA
new file mode 100644
index 0000000..fbc91bf
--- /dev/null
+++ b/METADATA
@@ -0,0 +1,23 @@
+name: "capstone"
+description: "Capstone is a disassembly framework with the target of becoming the ultimate disasm engine for binary analysis and reversing in the security community. "
+third_party {
+ url {
+ type: HOMEPAGE
+ value: "https://github.com/aquynh/capstone"
+ }
+ url {
+ type: GIT
+ value: "https://github.com/aquynh/capstone"
+ }
+ version: "fee83fcc1ad096c22d4f2066ccb58ad1a76a9886"
+ license_type: RECIPROCAL
+ license_note: "would be NOTICE save for arch/X86/qsort.h"
+ security {
+ tag: "NVD-CPE2.3:cpe:/a:capstone-engine:capstone"
+ }
+ last_upgrade_date {
+ year: 2022
+ month: 10
+ day: 6
+ }
+}
diff --git a/OWNERS b/OWNERS
new file mode 100644
index 0000000..b794da1
--- /dev/null
+++ b/OWNERS
@@ -0,0 +1,2 @@
+include platform/system/core:/janitors/OWNERS
+tweek@google.com
diff --git a/cstool/Makefile b/cstool/Makefile
index 5410fa3..1ff77ca 100644
--- a/cstool/Makefile
+++ b/cstool/Makefile
@@ -6,7 +6,7 @@
LIBNAME = capstone
-CFLAGS += -I../include -I.
+CFLAGS += -I../include
LDFLAGS += -O3 -Wall -L.. -l$(LIBNAME)
TARGET = cstool