diff options
author | Szabolcs Nagy <szabolcs.nagy@arm.com> | 2022-09-06 09:08:25 +0100 |
---|---|---|
committer | Szabolcs Nagy <szabolcs.nagy@arm.com> | 2022-11-22 14:31:25 +0000 |
commit | d0cc3969d4982626a4e465ff10d3ae2803662a35 (patch) | |
tree | 16ca7f3dd253fc16a7caa917964ba7b4a05ba5a2 | |
parent | 681ddc91e1f9cb33cf3b1370bd36ab9296f9be38 (diff) | |
download | glibc-d0cc3969d4982626a4e465ff10d3ae2803662a35.tar.gz glibc-d0cc3969d4982626a4e465ff10d3ae2803662a35.tar.xz glibc-d0cc3969d4982626a4e465ff10d3ae2803662a35.zip |
cheri: elf: fix SYMBOL_ADDRESS to return RX derived pointer
All symbol addresses can be derived from the RX capability of the module (l_map_start). For RW object symbols pointer will have to be rederived from l_rw_start.
-rw-r--r-- | sysdeps/generic/ldsodefs.h | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/sysdeps/generic/ldsodefs.h b/sysdeps/generic/ldsodefs.h index 563b440aab..81b6356460 100644 --- a/sysdeps/generic/ldsodefs.h +++ b/sysdeps/generic/ldsodefs.h @@ -122,13 +122,16 @@ dl_rw_ptr (const struct link_map *l, ElfW(Addr) vaddr) typedef struct link_map *lookup_t; #define LOOKUP_VALUE(map) map #define LOOKUP_VALUE_ADDRESS(map, set) ((set) || (map) ? (map)->l_addr : 0) +#define LOOKUP_VALUE_START(map, set) ((set) || (map) ? (map)->l_map_start : 0) /* Calculate the address of symbol REF using the base address from map MAP, if non-NULL. Don't check for NULL map if MAP_SET is TRUE. */ #define SYMBOL_ADDRESS(map, ref, map_set) \ ((ref) == NULL ? 0 \ - : (__glibc_unlikely ((ref)->st_shndx == SHN_ABS) ? 0 \ - : LOOKUP_VALUE_ADDRESS (map, map_set)) + (ref)->st_value) + : (__glibc_unlikely ((ref)->st_shndx == SHN_ABS) ? (ref)->st_value \ + : dl_get_ptr (LOOKUP_VALUE_START (map, map_set), \ + LOOKUP_VALUE_ADDRESS (map, map_set), \ + (ref)->st_value))) /* Type of a constructor function, in DT_INIT, DT_INIT_ARRAY, DT_PREINIT_ARRAY. */ |