| be3bc461 | 21-Jul-2020 |
Jerome Forissier <jerome@forissier.org> |
ta: experimental C++ support
Update the TA makefiles to support C++ (file extension: .cpp).
This allows the use of C++ in TA and libraries, with limitations (see below). I consider this work experi
ta: experimental C++ support
Update the TA makefiles to support C++ (file extension: .cpp).
This allows the use of C++ in TA and libraries, with limitations (see below). I consider this work experimental because it was only tested with simple cases in xtest, introducing the required changes and addressing issues one after another. Therefore, some features may be missing for more complex use cases (additional relocation types or runtime support...).
Tested with the arm-linux-gnueabihf- and aarch64-linux-gnu- toolchains (GCC 8.3).
Limitations:
- Clang is not supported at the moment - Exception handling: shared libraries cannot throw, catch or propagate exceptions. Doing so would require linking the libraries and the main program with the shared libgcc [1] which is not straightforward due to the many dependencies on the GNU libc. Exceptions *can* be used in the main program however, as well as in static libraries directly linked with the main program. - ldelf stack unwinding does not support C++ frames so crash/panic dumps will likely be truncated when they involve C++ code.
Link: [1] https://gcc.gnu.org/onlinedocs/gcc/Link-Options.html see "-shared-libgcc" Tested-by: Jerome Forissier <jerome@forissier.org> (QEMU, QEMUv8, HiKey960) Signed-off-by: Jerome Forissier <jerome@forissier.org> Acked-by: Etienne Carriere <etienne.carriere@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 01b02a16 | 21-Jul-2020 |
Jerome Forissier <jerome@forissier.org> |
ldelf, libutee: rework support of DT_INIT_ARRAY/DT_FINI_ARRAY
Now that we have the standard function dl_iterate_phdr() in libutee, we can use it to process the initialization and finalization arrays
ldelf, libutee: rework support of DT_INIT_ARRAY/DT_FINI_ARRAY
Now that we have the standard function dl_iterate_phdr() in libutee, we can use it to process the initialization and finalization arrays in the ELF files and deprecate the ad-hoc structure __init_fini_info introduced in commit dd655cb9906c ("ldelf, ta: add support for DT_INIT_ARRAY and DT_FINI_ARRAY") [1]. Unfortunately, removing __init_fini_info is not an option if we want to ensure backward compatibility. This concerns only TAs which use ELF initialization and/or finalization functions.
[1] Released in version 3.9.0.
Signed-off-by: Jerome Forissier <jerome@forissier.org> Acked-by: Etienne Carriere <etienne.carriere@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 9d224046 | 21-Jul-2020 |
Jerome Forissier <jerome@forissier.org> |
ldelf, libutee: add minimal Thread Local Storage support
Preparing for C++ support in TAs.
Adds enough runtime Thread Local Storage (TLS) support for the GNU C++ compilers (arm-linux-gnueabihf-g++,
ldelf, libutee: add minimal Thread Local Storage support
Preparing for C++ support in TAs.
Adds enough runtime Thread Local Storage (TLS) support for the GNU C++ compilers (arm-linux-gnueabihf-g++, aarch64-linux-gnu-g++) to work with OP-TEE. That is:
- A Thread Control Block, - The __tls_get_addr() and dl_iterate_phdr() functions.
Note that __tls_get_addr() is an ABI helper so it has no prototype in a user-accessible header file. dl_iterate_phdr() however is defined in <link.h> and may be used in a TA. The file lib/libutee/include/link.h is borrowed from Android's Bionic [1] with minor changes (added the required #include statement and named the function parameters). A similar <link.h> header is provided by other C libraries such as GNU libc, musl and FreeBSD/NetBSD/OpenBSD.
Link: [1] https://android.googlesource.com/platform/bionic/+/master/libc/include/link.h Signed-off-by: Jerome Forissier <jerome@forissier.org> Acked-by: Etienne Carriere <etienne.carriere@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 9784c655 | 21-Jul-2020 |
Jerome Forissier <jerome@forissier.org> |
ta: ta.ld.S: add .eh_frame_hdr and .eh_frame sections
Preparing for C++ support in TAs.
Adds .eh_frame_hdr and .eh_frame sections to the TA linker script. Those may be generated by the C++ compiler
ta: ta.ld.S: add .eh_frame_hdr and .eh_frame sections
Preparing for C++ support in TAs.
Adds .eh_frame_hdr and .eh_frame sections to the TA linker script. Those may be generated by the C++ compiler. The fragment is compied from GCC's internal linker script (shown by -Wl,-verbose).
Signed-off-by: Jerome Forissier <jerome@forissier.org> Acked-by: Etienne Carriere <etienne.carriere@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| be3db617 | 21-Jul-2020 |
Jerome Forissier <jerome@forissier.org> |
ta: ta.ld.S: add .gcc_except_table section
Preparing for C++ support in TAs.
Adds a .gcc_except_table section merging the multiple entries that may be generated by the C++ compiler. The fragment is
ta: ta.ld.S: add .gcc_except_table section
Preparing for C++ support in TAs.
Adds a .gcc_except_table section merging the multiple entries that may be generated by the C++ compiler. The fragment is copied from GCC's internal linker script (shown by -Wl,-verbose).
Signed-off-by: Jerome Forissier <jerome@forissier.org> Acked-by: Etienne Carriere <etienne.carriere@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| b011a82a | 21-Jul-2020 |
Jerome Forissier <jerome@forissier.org> |
ta: ta.ld.S: add .tdata and .tbss sections
Preparing for C++ support in TAs.
TA object file generated by a thread-enabled toolchain (such as g++ built without --disable-threads) may contain .tdata*
ta: ta.ld.S: add .tdata and .tbss sections
Preparing for C++ support in TAs.
TA object file generated by a thread-enabled toolchain (such as g++ built without --disable-threads) may contain .tdata* and .tbss* sections even if the application is single threaded. Those are similar to .data and .bss except that they are templates to be used by the runtime code to set up Thread Local Storage data blocks.
This commit adds those two sections as well as related relocation sections (.rel.tdata, .rel.tbss, .rela.tdata, .rela.tbss). The fragments are copied from GCC's internal linker script (shown by -Wl,-verbose). They are inserted next to .dynamic and .got because they may all be part of a RELRO segment if the linker chooses to create one. In practice there can be only one RELRO segment [1] so sections have to be contiguous. Note that ldelf currently ignores RELRO.
[1] https://reviews.llvm.org/D40029
Signed-off-by: Jerome Forissier <jerome@forissier.org> Acked-by: Etienne Carriere <etienne.carriere@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 4566d1f3 | 21-Jul-2020 |
Jerome Forissier <jerome@forissier.org> |
ta: ta.ld.S: add __exidx_start and __exidx_end
Preparing for C++ support in TAs.
__exidx_start and __exidx_end are referenced by libgcc_eh.a.
Signed-off-by: Jerome Forissier <jerome@forissier.org>
ta: ta.ld.S: add __exidx_start and __exidx_end
Preparing for C++ support in TAs.
__exidx_start and __exidx_end are referenced by libgcc_eh.a.
Signed-off-by: Jerome Forissier <jerome@forissier.org> Acked-by: Etienne Carriere <etienne.carriere@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|