WUMS 0.3.1 add hook for calling __ini and __fini

This commit is contained in:
Maschell 2022-01-21 19:12:01 +01:00
parent 5da3dd5a77
commit 32044725ef
6 changed files with 33 additions and 14 deletions

View File

@ -3,7 +3,7 @@ include $(TOPDIR)/share/wums_rules
export WUMS_MAJOR := 0
export WUMS_MINOR := 3
export WUMS_PATCH := 0
export WUMS_PATCH := 1
VERSION := $(WUMS_MAJOR).$(WUMS_MINOR).$(WUMS_PATCH)

View File

@ -2,7 +2,7 @@
* by Alex Chadwick
*
* Copyright (C) 2014, Alex Chadwick
* Modified by Maschell, 2018-2021
* Modified by Maschell, 2018-2022
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal

View File

@ -60,14 +60,14 @@ typedef struct module_information_single_t {
uint32_t entrypoint;
uint32_t startAddress;
uint32_t endAddress;
uint8_t skipEntrypoint;
uint8_t skipInitFini;
uint8_t initBeforeRelocationDoneHook;
module_function_symbol_data_t * function_symbol_entries;
uint32_t number_used_function_symbols;
} module_information_single_t;
#define MAXIMUM_MODULES 32
#define MODULE_INFORMATION_VERSION 0x00000006
#define MODULE_INFORMATION_VERSION 0x00000007
typedef struct module_information_t {
uint32_t version;

View File

@ -2,7 +2,7 @@
* by Alex Chadwick
*
* Copyright (C) 2014, Alex Chadwick
* Modified by Maschell, 2018-2021
* Modified by Maschell, 2018-2022
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal

View File

@ -2,7 +2,7 @@
* by Alex Chadwick
*
* Copyright (C) 2014, Alex Chadwick
* Modified by Maschell, 2018-2021
* Modified by Maschell, 2018-2022
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@ -51,6 +51,9 @@ typedef enum wums_hook_type_t {
WUMS_HOOK_INIT_WUT_SOCKETS,
WUMS_HOOK_FINI_WUT_SOCKETS,
WUMS_HOOK_INIT_WRAPPER, /* Calls __init */
WUMS_HOOK_FINI_WRAPPER, /* Calls __fini */
WUMS_HOOK_INIT,
WUMS_HOOK_APPLICATION_STARTS,
WUMS_HOOK_APPLICATION_ENDS,
@ -156,6 +159,20 @@ typedef struct wums_relocs_done_args_t {
__EXTERN_C_MACRO void __fini_wut_socket(); \
WUMS_HOOK_EX(WUMS_HOOK_FINI_WUT_SOCKETS,__fini_wut_socket)
#define WUMS___INIT_WRAPPER() \
__EXTERN_C_MACRO void __init(); \
void __init_wrapper(){ \
__init(); \
}\
WUMS_HOOK_EX(WUMS_HOOK_INIT_WRAPPER,__init_wrapper);
#define WUMS___FINI_WRAPPER() \
__EXTERN_C_MACRO void __fini(); \
void __fini_wrapper(){ \
__fini(); \
}\
WUMS_HOOK_EX(WUMS_HOOK_FINI_WRAPPER,__fini_wrapper);
#ifdef __cplusplus
}
#endif

View File

@ -2,7 +2,7 @@
* by Alex Chadwick
*
* Copyright (C) 2014, Alex Chadwick
* Modified by Maschell, 2018-2021
* Modified by Maschell, 2018-2022
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@ -32,20 +32,22 @@
extern "C" {
#endif
#define WUMS_MODULE_EXPORT_NAME(x) \
WUMS_META(export_name, x); \
WUMS_META(wum, "0.2"); \
WUMS_USE_WUT_MALLOC(); \
WUMS_USE_WUT_SOCKETS(); \
#define WUMS_MODULE_EXPORT_NAME(x) \
WUMS_META(export_name, x); \
WUMS_META(wum, "0.3.1"); \
WUMS_USE_WUT_MALLOC(); \
WUMS_USE_WUT_SOCKETS(); \
WUMS_USE_WUT_NEWLIB(); \
WUMS_USE_WUT_STDCPP(); \
WUMS_USE_WUT_STDCPP(); \
WUMS___INIT_WRAPPER(); \
WUMS___FINI_WRAPPER(); \
WUMS_META(buildtimestamp, __DATE__ " " __TIME__)
#define WUMS_MODULE_AUTHOR(x) WUMS_META(author, x)
#define WUMS_MODULE_VERSION(x) WUMS_META(version, x)
#define WUMS_MODULE_LICENSE(x) WUMS_META(license, x)
#define WUMS_MODULE_DESCRIPTION(x) WUMS_META(description, x)
#define WUMS_MODULE_SKIP_ENTRYPOINT() WUMS_META(skipEntrypoint, "true")
#define WUMS_MODULE_SKIP_INIT_FINI() WUMS_META(skipInitFini, "true")
#define WUMS_MODULE_INIT_BEFORE_RELOCATION_DONE_HOOK() WUMS_META(initBeforeRelocationDoneHook, "true")
#ifdef __cplusplus