diff options
author | Jerome Forissier <jerome@forissier.org> | 2020-08-03 09:58:33 +0200 |
---|---|---|
committer | Jérôme Forissier <jerome@forissier.org> | 2020-08-03 14:10:15 +0200 |
commit | bb8cd6f08ea47e3f0d58169846fee0bbae18caae (patch) | |
tree | 5592eb9eff7aa53480c4b0092d417829387cc344 | |
parent | 5500d70387c7d8097417cf391ea66f82fce605c0 (diff) |
ldelf: __resolve_sym(): support STT_NOTYPE
Symbols defined in a linker script are assigned type STT_NOTYPE, but
the __resolve_sym() function in ldelf only supports STT_OBJECT and
STT_FUNCTION. As a result, it is impossible to resolve STT_NOTYPE
symbols at runtime. This causes an error in shared libraries when
ftrace is enabled:
# Platform: QEMU
$ make CFG_FTRACE_SUPPORT=y CFLAGS_ta_arm32=-pg run
$ xtest 1019
D/LD: ldelf:134 Loading TA 5b9e0e40-2636-11e1-ad9e-0002a5d5c51b
E/LD: __resolve_sym:61 Symbol type not supported
E/TC:? 0 init_with_ldelf:232 ldelf failed with res: 0xffff000a
* regression_1019 Test dynamically linked TA
regression_1000.c:1502: [...] TEEC_ERROR_NOT_SUPPORTED
This commit adds STT_NOTYPE to the supported types, handled the same way
as STT_OBJECT and STT_FUNCTION.
Fixes: 97c5ac19427b ("ldelf: check ranges in __resolve_sym()")
Signed-off-by: Jerome Forissier <jerome@forissier.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
-rw-r--r-- | ldelf/ta_elf_rel.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/ldelf/ta_elf_rel.c b/ldelf/ta_elf_rel.c index ad9274c2..782d1682 100644 --- a/ldelf/ta_elf_rel.c +++ b/ldelf/ta_elf_rel.c @@ -53,6 +53,7 @@ static bool __resolve_sym(struct ta_elf *elf, unsigned int st_bind, err(TEE_ERROR_BAD_FORMAT, "Symbol location out of range"); switch (st_type) { + case STT_NOTYPE: case STT_OBJECT: case STT_FUNC: *val = st_value + elf->load_addr; |