Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add AArch64 support #2016

Open
lgeek opened this issue Aug 7, 2017 · 12 comments
Open

Add AArch64 support #2016

lgeek opened this issue Aug 7, 2017 · 12 comments

Comments

@lgeek
Copy link

lgeek commented Aug 7, 2017

I'm running this on an AArch64 system with Debian Stretch; Linux 4.9.0, gcc 6.3.0, cmake 3.7.2. It looks like the build system thinks it's running on x86-64. On the other hand, cmake prints The system is: Linux - 4.9.0-3-arm64 - aarch64 in CMakeOutput.log. Here's the output from cmake:

$ cmake ..
-- The C compiler identification is GNU 6.3.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- The CXX compiler identification is GNU 6.3.0
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Dr. Memory version number: 1.11.17353
-- Looking for include file asm-i386/stat.h
-- Looking for include file asm-i386/stat.h - not found
-- Performing Test HAVE_FVISIBILITY_INTERNAL
-- Performing Test HAVE_FVISIBILITY_INTERNAL - Success
-- Performing Test HAVE_FVISIBILITY_HIDDEN
-- Performing Test HAVE_FVISIBILITY_HIDDEN - Success
-- Building DynamoRIO from local sources /home/cosmin/drmemory/build/dynamorio/cmake
-- Version number: 6.2.17316
-- The ASM compiler identification is GNU
-- Found assembler: /usr/bin/as
/usr/bin/as missing flag "-mmnemonic.*intel"
/usr/bin/as too old: using /home/cosmin/drmemory/dynamorio/make/as-2.18.50
-- Found Perl: /usr/bin/perl (found version "5.24.1") 
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of uint
-- Check size of uint - done
-- Check size of ushort
-- Check size of ushort - done
-- Check size of bool
-- Check size of bool - failed
-- Check size of byte
-- Check size of byte - failed
-- Check size of sbyte
-- Check size of sbyte - failed
-- Check size of uint32
-- Check size of uint32 - failed
-- Check size of uint64
-- Check size of uint64 - failed
-- Check size of int32
-- Check size of int32 - failed
-- Check size of int64
-- Check size of int64 - failed
-- Check size of _Bool
-- Check size of _Bool - done
-- Performing Test no_stack_protector_avail
-- Performing Test no_stack_protector_avail - Success
-- Performing Test nounused_avail
-- Performing Test nounused_avail - Success
-- Performing Test HAVE_TYPELIMITS_CONTROL
-- Performing Test HAVE_TYPELIMITS_CONTROL - Success
-- Performing Test no_pie_avail
-- Performing Test no_pie_avail - Failed
-- Found ZLIB: /usr/lib/aarch64-linux-gnu/libz.so (found version "1.2.8") 
CMake Error at build/dynamorio/cmake/DynamoRIOConfig.cmake:1073 (message):
  *** /usr/bin/ld failed: ***

  /usr/bin/ld: unrecognised emulation mode: elf_x86_64

  Supported emulations: aarch64linux aarch64elf aarch64elf32 aarch64elf32b
  aarch64elfb armelf armelfb aarch64linuxb aarch64linux32 aarch64linux32b
  armelfb_linux_eabi armelf_linux_eabi

Call Stack (most recent call first):
  dynamorio/clients/drcachesim/CMakeLists.txt:150 (configure_DynamoRIO_client)
  dynamorio/clients/drcachesim/CMakeLists.txt:161 (add_drmemtrace)


-- Configuring incomplete, errors occurred!
See also "/home/cosmin/drmemory/build/CMakeFiles/CMakeOutput.log".
See also "/home/cosmin/drmemory/build/CMakeFiles/CMakeError.log".

CMakeError.log
CMakeOutput.log

@derekbruening
Copy link
Contributor

Dr. Memory does not yet support AArch64. DynamoRIO's AArch64 support is mostly done but some IR gaps are likely to be exposed by a client that looks at everything like Dr. Memory (or any taint tracking tool). We would welcome contributions to port to AArch64.

@lgeek
Copy link
Author

lgeek commented Aug 8, 2017

My bad, I hadn't realized it's not expected to build at this time. I've ran into a related issue building on an AArch32 userspace with an AArch64 kernel, I'll open a new issue.

@varsub01
Copy link

varsub01 commented Jul 9, 2019

Hi,

I am hitting the same issue. Has support for Dr. Memory on Aarch64 been added recently by any chance?

@derekbruening
Copy link
Contributor

No, as the help wanted label indicates, work on this is likely to rely on new contributors.

@derekbruening derekbruening changed the title Building natively on AArch64 fails Add AArch64 support Jul 9, 2019
@varsub01
Copy link

Thanks Derek. I intend to take up this task. Can you provide any specific details on the IR gaps that you allude in a previous comment? Any help to scope out the work would be appreciated.

@derekbruening
Copy link
Contributor

DynamoRIO/dynamorio#2626 covers finishing the AArch64 encoder/decoder/IR. I believe it is pretty much complete: @AssadHashmi would know which opcodes or operand details are still missing.

For Dr. Memory, I would suggest starting with the pattern mode. That is already ported to ARM (32-bit). The full mode's fastpath is complex, low-level, and unfortunately could use some refactoring and cleanup to make it easier to port.

@AssadHashmi
Copy link

DynamoRIO/dynamorio#2626 covers finishing the AArch64 encoder/decoder/IR. I believe it is
pretty much complete: @AssadHashmi would know which opcodes or operand details are still
missing.

The biggest gap is in the NEON instructions. IMO the most efficient approach is first to get AArch64 to build then fix gaps as they arise at runtime starting with simple use-cases. A recent example of NEON IR is DynamoRIO/dynamorio#3710

@frankfkliu
Copy link

Hi, Derek. Is there any update on porting Dr.memory to AArch64?

@derekbruening
Copy link
Contributor

Hi, Derek. Is there any update on porting Dr.memory to AArch64?

@gregcawthorne or @AssadHashmi would know the latest. Are you looking to help with the port, or to use the tool?

@gregcawthorne
Copy link
Contributor

@frankfkliu
Hi! We have a implementation of the slowpath working pretty well and just ironing out some last bugs. We have a decent chunk of the DrMemory test passing and once we have a few more we will make version available on in a PR most likely.

We also have a fair amount of work on the fastpath done, but it is still unstable and we are focusing on getting the slowpath work upstreamed at present.

I am hoping to get something publicly available within the next month or so.

@frankfkliu
Copy link

Thanks! @gregcawthorne @derekbruening I am studying the realization principle of Dr.memory & dynamoRIO, wish to use Dr.memory on AArch64 platform, furthermore, try to make tools base on dynamoRIO for memory related performance analysis if possible.

johnfxgalea pushed a commit that referenced this issue May 28, 2021
Enables shadow memory tracking on AArch64.

This is a subsection of the larger ongoing AArch64 port of DRMemory.

Issue: #2016
derekbruening added a commit that referenced this issue Aug 28, 2022
This patch edits tests/CMakeLists.txt to enable a selection of
existing tests for drmemory aarch64 as supported by the larger
initial aarch64 slowpath patch.

Co-authored-by: Derek Bruening <[email protected]>
Issue: #2016
derekbruening pushed a commit that referenced this issue Aug 28, 2022
Ports drsyscall to AArch64 by adding the syscall numbers to the syscall tables.

Issue: #2016
@derekbruening
Copy link
Contributor

https://github.com/DynamoRIO/drmemory/tree/slowpath-aarch64-port is still outstanding from @gregcawthorne but it has many failures and so needs a bunch of work to be fixed up and integrated. That gets the slowpath going. For the fastpath given all the complexities in trying to refactor the x86 fastpath to use drreg (#1795) I'm thinking it's best to just start from scratch for aarch64 with drreg and optimize (possibly adding new drreg features) later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants