RFR: 8320533: Adjust capstone integration for v6 changes [v4]
Galder Zamarreño
duke at openjdk.org
Mon Nov 27 06:15:26 UTC 2023
> FYI @theRealAph
>
> It includes a couple of commits to integrate with Capstone v6 while still working with Capstone v5 and before:
> * `CAPSTONE_ARCH` for aarch64 is now `CS_ARCH_AARCH64` instead of `CS_ARCH_ARM64`. See [this document](https://github.com/Rot127/capstone/blob/v6-release-guide/docs/cs_v6_release_guide.md) to understand motivation for this Capstone change.
> * The `-Daarch64` macro was getting in the way and was causing invalid C to be produced. Undefined it before including `capstone.h`. Thx @rwestrel for suggesting the fix!
> * Enhanced autoconf to select the right aarch64 arch name depending on the capstone library in use.
>
> Here's some output to demonstrate autoconf:
>
> 1. If using capstone v6, you will see:
>
> checking capstone aarch64 arch name... AARCH64
>
>
> 2. If using capstone v5, or earlier, you will see:
>
> checking capstone aarch64 arch name... ARM64
>
>
> With v5 or earlier, the compilation error in the config log file is the expected one:
>
>
> configure:142906: checking capstone aarch64 arch name
> configure:142919: /usr/bin/clang -c -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk -iframework /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk -iframework /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks conftest.c >&5
> conftest.c:27:16: error: use of undeclared identifier 'CS_ARCH_AARCH64'; did you mean 'CS_ARCH_ARM64'?
> cs_arch test = CS_ARCH_AARCH64
> ^~~~~~~~~~~~~~~
> CS_ARCH_ARM64
> /Users/galder/opt/capstone-5/include/capstone/capstone.h:76:2: note: 'CS_ARCH_ARM64' declared here
> CS_ARCH_ARM64, ///< ARM-64, also called AArch64
> ^
> 1 error generated.
> configure:142919: $? = 1
> configure: failed program was:
> | /* confdefs.h */
> | #define PACKAGE_NAME "OpenJDK"
> | #define PACKAGE_TARNAME "openjdk"
> | #define PACKAGE_VERSION "openjdk"
> | #define PACKAGE_STRING "OpenJDK openjdk"
> | #define PACKAGE_BUGREPORT "build-dev at openjdk.org"
> | #define PACKAGE_URL "https://openjdk.org"
> | #define HAVE_STDIO_H 1
> | #define HAVE_STDLIB_H 1
> | #define HAVE_STRING_H 1
> | #define HAVE_INTTYPES_H 1
> | #define HAVE_STDINT_H 1
> | #define HAVE_STRINGS_H 1
> | #define HAVE_SYS_STAT_H 1
> | #define HAVE_SYS_TYPES_H 1
> | #defi...
Galder Zamarreño has refreshed the contents of this pull request, and previous commits have been removed. The incremental views will show differences compared to the previous content of the PR. The pull request contains three new commits since the last revision:
- 8320533: Comment undef call
- 8320533: Use autoconf to select the right capstone arch name
- 8320533: Capstone v6 hsdis aarch64 integration not working
* `CAPSTONE_ARCH` for aarch64 in v6 is `CS_ARCH_AARCH64` instead
of `CS_ARCH_ARM64`.
* The `-Daarch64` macro is getting in the way with this new version,
and it's causing invalid C to be produced.
Undefined it before including `capstone.h`.
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/16788/files
- new: https://git.openjdk.org/jdk/pull/16788/files/953f26aa..aae3846a
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=16788&range=03
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=16788&range=02-03
Stats: 0 lines in 0 files changed: 0 ins; 0 del; 0 mod
Patch: https://git.openjdk.org/jdk/pull/16788.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/16788/head:pull/16788
PR: https://git.openjdk.org/jdk/pull/16788
More information about the build-dev
mailing list