public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [RFC] Allow user to filter symbols in the object file produced by --out-implib
@ 2021-12-03 14:52 Torbjorn SVENSSON
  2021-12-10 13:00 ` Torbjorn SVENSSON
  2021-12-15 17:25 ` Nick Clifton
  0 siblings, 2 replies; 4+ messages in thread
From: Torbjorn SVENSSON @ 2021-12-03 14:52 UTC (permalink / raw)
  To: binutils; +Cc: Christophe LYON

Hello,


When working with an ARM Cortex-M33 with TrustZone, the usual way is to have one application for the secure context and another application for the non-secure context.

When linking a secure application for ARM Cortex-M33 with TrustZone, the "--cmse-implib" and "--out-implib" linker flags are used to generate an object file where the locations of the non-secure callable functions are shared.
When linking the non-secure application for the ARM Cortex-M33 with TrustZone, the object file with the non-secure callable functions is used as an ordinary object file.

This works fine and the implib will only contain functions marked with "__attribute((cmse_nonsecure_entry))".

Let's consider the use case where the embedded target contains both an user application and a bootloader. The bootloader may provide some functions that should be accessible by the user application.
One way to solve this is to put the functions at a fixed location in the bootloader linker script and then hard-code that address in the user application to make it callable.
Another way would be to rely on the implib functionality to automatically export the location of the symbol in a way that can be "imported" when linking the user application. In this sense, the implib will be the "interface" between the 2 applications.

If the bootloader would use the "--out-implib" flag, then there would be a lot more symbols exposed than the symbols that were intended to be shared between the bootloader application and the user application.
If the same symbol name exists in both the bootloader codebase and the user application codebase, it's even likely that there will be link error due to multiple definitions.

So, what I think could be beneficial for the general ld is to let the user define a set of symbols to expose in the implib without affecting the main output of the linker step (the ELF file).

I would like to get your opinion on this topic before I start implementing something like this.
Does it make sense to do this or is there some other way to reduce the number of symbols exposed in the implib without affecting the ELF file?


Kind regards,
Torbjörn

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-12-22  9:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-03 14:52 [RFC] Allow user to filter symbols in the object file produced by --out-implib Torbjorn SVENSSON
2021-12-10 13:00 ` Torbjorn SVENSSON
2021-12-15 17:25 ` Nick Clifton
2021-12-22  9:24   ` Torbjorn SVENSSON

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).