fix(romlib): wrap indirectly included functionsThe problem that this resolves is a bit involved; the followingmust be met at the same time for some function <to_be_wrapped>: * to_be_wrapped must
fix(romlib): wrap indirectly included functionsThe problem that this resolves is a bit involved; the followingmust be met at the same time for some function <to_be_wrapped>: * to_be_wrapped must be specified as part of the romlib * to_be_wrapped must _not_ be referenced by any translation unit in TF-A * to_be_wrapped must be referenced by a translation unit in a dependent library, mbedtls for example.Under these circumstances, to_be_wrapped will not be wrapped, andwill instead reference its original definition while simultaneouslyresiding in romlib.This is a side effect of two issues with romlib prior to this patch: 1 to_be_wrapped is expected to wrap by duplicating its definition. This causes any condition that links against both the base and wrapper functions to be a link error (duplicate symbol definition). 2 to_be_wrapped is in its own translation unit This causes the wrappers to be used by TF-A in an as needed.The duplicate function definitions can be worked around using thelinker's `--wrap` flag, which redirects all references to a symbolto resolve to `__wrap_<symbol>` and the original symbol to beavailable as `__real_<symbol>`. Most of the changes handle creatingthis arguments and passing them to the linker.Further, once you use the linker's wrap, you will encounter anotherissue: if TF-A does not use a function, its wrapper is not present.This causes link issues when a library and not TF-A uses the wrapper.Note that this issue would have been resolved previously by ignoringthe wrapper and using the base definition.This further issue is worked around by concatenating the assembly forall of the wrappers into a single translation unit. It's possible towork around this issue in a few other ways, including reordering thelibraries passed to the linker to place libwrapper.a last or groupingthe libraries so that symbols from later libraries may be resolvedwith prior libraries.I chose the translation unit concatenation approach as it revealedthat a jumptable has duplicate symbols within it.Change-Id: Ie57b5ae69bde2fc8705bdc7a93fae3ddb5341ed9Signed-off-by: Jimmy Brisson <jimmy.brisson@arm.com>
show more ...
Romlib makefile refactoring and script rewritingThe features of the previously existing gentbl, genvar and genwrappersscripts were reimplemented in the romlib_generator.py Python script.This resu
Romlib makefile refactoring and script rewritingThe features of the previously existing gentbl, genvar and genwrappersscripts were reimplemented in the romlib_generator.py Python script.This resulted in more readable and maintainable code and the scriptintroduces additional features that help dependency handling inmakefiles. The assembly templates were separated from the script logicand were collected in the 'templates' directory.The targets and their dependencies were reorganized in the makefile andthe dependency handling of included index files is possible now.Incremental build is available in case of modifying the index files.Signed-off-by: Imre Kis <imre.kis@arm.com>Change-Id: I79f65fab9dc5c70d1f6fc8f57b2a3009bf842dc5