Closed etienne-lms closed 4 years ago
FYI I worked around this issue by adding weak attribute to the function in libutils.
Sounds like a reasonable fix but I must admit I have not totally understood what's happening :-/ Here is what I know:
CFG_UNWIND=y
(the default) adds -funwind-tables
to the C flags (for both Core and TA). Due to this flag, the linker adds dependencies to "personality routines" which are supposed to be used by the unwinder, as per the Arm Exception Handling ABI. (https://static.docs.arm.com/ihi0038/a/IHI0038A_ehabi.pdf section 9.2).ldelf
) do not use the personality routines, we need to have them defined somewhere. Which is the reason why commit https://github.com/OP-TEE/optee_os/commit/923c1f34 has added them to libutils
. Note they are added unconditionally (even when CFG_UNWIND
is disabled).Like you, I don't understand why CFG_UNWIND=n
causes the issue, or rather I don't get why the C++ test links with no error when =y
(the symbols are present in both libutils and libgcc_eh.a so why no link error?).
Perhaps the best way forward is to remove the problematic functions from libutils when CFG_UNWIND != y
. Seems like the simplest option. Can you create a PR?
Thanks @jforissier for your feedback. P-R https://github.com/OP-TEE/optee_os/pull/4040 created.
Found a build issue introduced by 1a205ae33440 ("Add regression 1031 (C++ support in TAs)") when OP-TEE built with
CFG_UNWIND=n
:Issue found on both qemu_v7 and stm32mp1 OP-TEE setup.
Seems
__aeabi_unwind_cpp_pr0()
is already defined in the toolchain (arm-linux-gnueabihf/8.3.0/libgcc_eh.a) and conflicts with the one exported by optee_os libutils. I don't understand why this pops out only whenCFG_UNWIND=n
.FYI I worked around this issue by adding weak attribute to the function in libutils. (another workaround is to revert 1a205ae33440 ):
Note: maybe this issue should be created in optee_os.