]> xenbits.xensource.com Git - unikraft/unikraft.git/commit
lib/uklibid: Supporting pre-built libraries
authorSimon Kuenzer <simon@unikraft.io>
Tue, 8 Aug 2023 13:27:40 +0000 (15:27 +0200)
committerUnikraft <monkey@unikraft.io>
Wed, 9 Aug 2023 10:27:40 +0000 (10:27 +0000)
commit7815d0b6d6427965fc6ecd8730273d5cea77d288
tree589ff048bcf9ba78019ea2689ab68728163d7ae7
parent2a39823791e739dd3d9c723d8a876e31ba83a68c
lib/uklibid: Supporting pre-built libraries

This commit introduces a clearer separation between runtime and
compile-time resolution of library identifiers with the API. This is done
so that libraries can potentially be built off-tree and shipped in binary
form. Each library's own identifier (`uk_libid_self()`) is stored in a
constant variable that is resolved during link-time. The owner of this
variable is `uklibid`, so the identifier is external to a binary library.

A binary delivery of a library can be created with Unikraft (for example:
`make libbinary`) and the resulting library object (likely under
`build/libbinary.o`) can be delivered with a `Config.uk` like:
```KConfig
config LIBBINARY
bool "Binary example library"
default n
```

and a `Makefile.uk` like:
```Makefile
UK_OLIBS-$(CONFIG_LIBBINARY) += $(IMPORT_BASE)/libbinary.o
UK_LIBID_EXTRA-$(CONFIG_LIBBINARY) += libbinary
```

Please note that the library must be registered directly in `UK_OLIBS-y`;
`addlib` or `addlib_s` cannot be used in such cases.
Please also note that such a library should restrict dependencies on other
libraries and their configuration options. In particular, the use of macros
and inline functions must be handled with care.

Signed-off-by: Simon Kuenzer <simon@unikraft.io>
Reviewed-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Robert Kuban <robert.kuban@opensynergy.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #938
lib/uklibid/Makefile.uk
lib/uklibid/exportsyms.awk [new file with mode: 0644]
lib/uklibid/exportsyms.uk [deleted file]
lib/uklibid/include/uk/libid.h
lib/uklibid/libname.c [deleted file]
lib/uklibid/rtmap.c [new file with mode: 0644]
lib/uklibid/selfids.awk [new file with mode: 0644]