Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • D dynamorio
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 1,467
    • Issues 1,467
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 44
    • Merge requests 44
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • DynamoRIO
  • dynamorio
  • Merge requests
  • !4325

i#1684 xarch-IR: Support separate host and target arch

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Derek Bruening requested to merge i1684-host-vs-default-target-arch into master Jun 18, 2020
  • Overview 50
  • Commits 16
  • Pipelines 0
  • Changes 30

Adds support for building with different host and target architectures. The goal is to support running drdisas, drdecode, drraw2trace, and drcachesim trace analyzers on one host machine while targeting recorded bytes or traces from a different type of machine: e.g., processing aarch64 traces on an x86_64 machine. The goal is not to turn DR into a cross-ISA binary translator: we only support standalone mode here, not full DR managed mode. Long-term it would be nicer to split out the DR standalone mode interfaces into separate libraries but that is beyond the scope of the current work.

Adds a top-level CMake option variable "TARGET_ARCH" which defaults to CMAKE_SYSTEM_PROCESSOR but can be set to a different value. The regular arch variables/defines X86, AARCH64, and ARM are set from TARGET_ARCH, while new values DR_HOST_{X86,AARCH64,ARM} are set for the host.

The bulk of the code is built targeting the TARGET_ARCH, with only assembly code and other limited code using the DR_HOST_* arch. This limits the scope of the code changes as compared to the opposite approach. A new define DR_HOST_NOT_TARGET is used to simply disable cases where the host and target and intertwined and difficult to easily separate, such as TLS handling.

The key code changed to use DR_HOST_* includes:

  • *.asm files
  • arch_exports.h inline asm for atomics and other key utilities
  • system call defines (we don't want to have our raw syscall wrappers running incorrect syscall numbers: we'll end up with fork bombs or other madness)

Code using built-in * arch defines is changed to use our defines:

  • sigcontext.h, which is also augmented for some missing AArch64 types
  • x86_code_test.c

Code reading ELF headers is relaxed to allow any arch, since we need the host for standalone init code but the target for raw2trace module mapping.

Nearly all tests are disabled not just from running but also from building for simplicity, to reduce code changes here.

TODO: Add new runsuite build TODO: Add new drcachesim xarch tests TODO: A couple of NOCHECK's in the diff

Issue: #1684, #4318

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: i1684-host-vs-default-target-arch