|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Minios-devel] [UNIKRAFT/LIBELF PATCH 4/7] Add `__Unikraft__` configuration
Reviewed-by: Razvan Deaconescu <razvan.deaconescu@xxxxxxxxx>
Simon Kuenzer <simon.kuenzer@xxxxxxxxx> writes:
> Add `__Unikraft__` as a target to the library configuration:
> `_libelf_config.h`
>
> Signed-off-by: Simon Kuenzer <simon.kuenzer@xxxxxxxxx>
> ---
> _elftc.h | 35 +++++++++++++++++++++++++++++++++++
> _libelf_config.h | 45 +++++++++++++++++++++++++++++++++++++++++++++
> 2 files changed, 80 insertions(+)
>
> diff --git a/_elftc.h b/_elftc.h
> index f0fa046..19340cf 100644
> --- a/_elftc.h
> +++ b/_elftc.h
> @@ -378,6 +378,14 @@ struct name {
> \
> #endif /* __GNUC__ */
> #endif
>
> +#if defined(__Unikraft__)
> +#if defined(__GNUC__)
> +#define ELFTC_VCSID(ID) __asm__(".ident\t\"" ID "\"")
> +#else
> +#define ELFTC_VCSID(ID) /**/
> +#endif /* __GNUC__ */
> +#endif
> +
> #endif /* ELFTC_VCSID */
>
> /*
> @@ -418,6 +426,15 @@ extern const char *__progname;
>
> #endif /* __OpenBSD__ */
>
> +
> +#if defined(__Unikraft__)
> +
> +#include <uk/config.h>
> +
> +#define ELFTC_GETPROGNAME() UK_IMAGE_NAME
> +
> +#endif /* __Unikraft__ */
> +
> #endif /* ELFTC_GETPROGNAME */
>
>
> @@ -536,4 +553,22 @@ extern const char *__progname;
>
> #endif /* __OpenBSD__ */
>
> +#if defined(__Unikraft__)
> +
> +#include <uk/essentials.h>
> +
> +#define ELFTC_BYTE_ORDER __BYTE_ORDER
> +#define ELFTC_BYTE_ORDER_LITTLE_ENDIAN __LITTLE_ENDIAN
> +#define ELFTC_BYTE_ORDER_BIG_ENDIAN __BIG_ENDIAN
> +
> +#define ELFTC_HAVE_MMAP 0
> +#define ELFTC_HAVE_STRMODE 0
> +
> +/* Whether we need to supply {be,le}32dec. */
> +#define ELFTC_NEED_BYTEORDER_EXTENSIONS 0
> +
> +#define roundup2 ALIGN_UP
> +
> +#endif /* __Unikraft__ */
> +
> #endif /* _ELFTC_H */
> diff --git a/_libelf_config.h b/_libelf_config.h
> index 1b8f35b..57e6b1d 100644
> --- a/_libelf_config.h
> +++ b/_libelf_config.h
> @@ -181,3 +181,48 @@
> #endif
>
> #endif /* defined(__linux__) || defined(__GNU__) || defined(__GLIBC__) */
> +
> +/*
> + * Definitions for Unikraft.
> + */
> +#if defined (__Unikraft__)
> +
> +#include <uk/config.h>
> +
> +/*
> + * Define LIBELF_{ARCH,BYTEORDER,CLASS} based on the machine architecture.
> + */
> +#if (defined CONFIG_ARCH_X86_32)
> +#define LIBELF_CLASS ELFCLASS32
> +#define LIBELF_ARCH EM_386
> +#define LIBELF_BYTEORDER ELFDATA2LSB
> +
> +#elif (defined CONFIG_ARCH_X86_64)
> +#define LIBELF_CLASS ELFCLASS64
> +#define LIBELF_ARCH EM_X86_64
> +#define LIBELF_BYTEORDER ELFDATA2LSB
> +
> +#elif (defined CONFIG_ARCH_ARM_32)
> +/* Little-Endian Arm */
> +#define LIBELF_CLASS ELFCLASS32
> +#define LIBELF_ARCH EM_ARM
> +#define LIBELF_BYTEORDER ELFDATA2LSB
> +
> +#elif (defined CONFIG_ARCH_ARM_64)
> +#define LIBELF_CLASS ELFCLASS64
> +#define LIBELF_ARCH EM_AARCH64
> +#define LIBELF_BYTEORDER ELFDATA2LSB
> +
> +#else
> +#error Missing elf-format definition for target architecture
> +#endif
> +
> +#if LIBELF_CLASS == ELFCLASS32
> +#define Elf_Note Elf32_Nhdr
> +#elif LIBELF_CLASS == ELFCLASS64
> +#define Elf_Note Elf64_Nhdr
> +#else
> +#error LIBELF_CLASS needs to be one of ELFCLASS32 or ELFCLASS64
> +#endif
> +
> +#endif /* defined(__Unikraft__) */
_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |