[DynInst_API:] [dyninst/dyninst] 31b490: Fix offset calculations in EmitterAARCH64


Date: Wed, 01 Oct 2025 19:51:30 -0700
From: Tim Haines <noreply@xxxxxxxxxx>
Subject: [DynInst_API:] [dyninst/dyninst] 31b490: Fix offset calculations in EmitterAARCH64
  Branch: refs/heads/thaines/aarch64_emitLoadShared_offset_sign
  Home:   https://github.com/dyninst/dyninst
  Commit: 31b490ec698a5eb898ee067b7651e6356fe99e05
      https://github.com/dyninst/dyninst/commit/31b490ec698a5eb898ee067b7651e6356fe99e05
  Author: Tim Haines <thaines.astro@xxxxxxxxx>
  Date:   2025-10-01 (Wed, 01 Oct 2025)

  Changed paths:
    M dyninstAPI/src/Relocation/Widgets/PCWidget-aarch64.C
    M dyninstAPI/src/inst-aarch64.C

  Log Message:
  -----------
  Fix offset calculations in EmitterAARCH64

'varOffset' is defined as

Address varOffset = addr - gen.currAddr() + 4;

When 'addr' is less than 'gen.currAddr()', this calculation underflows.
Since 'labs' takes a 'long int', the underflowed 'unsigned long' (that
is what 'Address' really is) gets converted to a signed value. Removing
this conversion and the subsequent absolute value caused 'varOffset' to
be treated as a large, positive number.

This was broken by 9b6dd2aa6b.



To unsubscribe from these emails, change your notification settings at https://github.com/dyninst/dyninst/settings/notifications
[← Prev in Thread] Current Thread [Next in Thread→]
  • [DynInst_API:] [dyninst/dyninst] 31b490: Fix offset calculations in EmitterAARCH64, Tim Haines <=