From b69fbad9d866685fe1b5d709f8a5bb9fe0b47cf3 Mon Sep 17 00:00:00 2001 From: Andy Polyakov Date: Mon, 1 May 2017 22:38:43 +0200 Subject: [PATCH] util/incore: harmonize with __thumb__ clause in FIPS_ref_point() In ELF Thumb functions are "decorated" with 1 in least significant bit, while fips_canister.c operates on real "undecorated" pointers to code. References to non-Thumb functions can't have two least significant bits set, hence masking one is effectively a no-op in non-Thumb cases. --- util/incore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/util/incore b/util/incore index bb765b1966bd0..565e91613228f 100755 --- a/util/incore +++ b/util/incore @@ -131,6 +131,9 @@ && @sections[$st_secn]->{sh_type} # not SHN_UNDEF && ($name=(split(chr(0),substr($strings,$elf_sym{st_name},128)))[0]) ) { + if ($st_type==2 && $self->{e_machine} == 40) { + $elf_sym{st_value} &= ~1; # compensate for Thumb STT_FUNCs + } # synthesize st_offset, ... $elf_sym{st_offset} = $elf_sym{st_value} - @sections[$st_secn]->{sh_addr}