libroot: make API version available.

Change-Id: I370d5c8e9b4f076e7f115ca6c87bc7f943d36c17
Reviewed-on: https://review.haiku-os.org/c/haiku/+/1850
Reviewed-by: Rene Gollent <[email protected]>
This commit is contained in:
Jérôme Duval
2019-09-13 13:38:08 +00:00
committed by waddlesplash
parent b05def659e
commit be06cb25e9
6 changed files with 13 additions and 4 deletions
@@ -19,6 +19,7 @@ extern "C" {
#endif #endif
extern int __gABIVersion; extern int __gABIVersion;
extern int __gAPIVersion;
extern char _single_threaded; extern char _single_threaded;
/* This determines if a process runs single threaded or not */ /* This determines if a process runs single threaded or not */
@@ -57,6 +57,7 @@ struct rld_export {
const struct user_space_program_args *program_args; const struct user_space_program_args *program_args;
const void* commpage_address; const void* commpage_address;
int abi_version; int abi_version;
int api_version;
}; };
extern struct rld_export *__gRuntimeLoader; extern struct rld_export *__gRuntimeLoader;
+2
View File
@@ -30,6 +30,7 @@ int __libc_argc;
char **__libc_argv; char **__libc_argv;
int __gABIVersion; int __gABIVersion;
int __gAPIVersion;
int32 __gCPUCount; int32 __gCPUCount;
char _single_threaded = true; char _single_threaded = true;
@@ -51,6 +52,7 @@ initialize_before(image_id imageID)
char *programPath = __gRuntimeLoader->program_args->args[0]; char *programPath = __gRuntimeLoader->program_args->args[0];
__gCommPageAddress = __gRuntimeLoader->commpage_address; __gCommPageAddress = __gRuntimeLoader->commpage_address;
__gABIVersion = __gRuntimeLoader->abi_version; __gABIVersion = __gRuntimeLoader->abi_version;
__gAPIVersion = __gRuntimeLoader->api_version;
if (programPath) { if (programPath) {
if ((__progname = strrchr(programPath, '/')) == NULL) if ((__progname = strrchr(programPath, '/')) == NULL)
+1 -1
View File
@@ -641,7 +641,7 @@ load_image(char const* name, image_type type, const char* rpath,
#endif #endif
} }
set_abi_version(image->abi); set_abi_api_version(image->abi, image->api_version);
// init gcc version dependent image flags // init gcc version dependent image flags
// symbol resolution strategy // symbol resolution strategy
+7 -2
View File
@@ -93,13 +93,18 @@ rldexport_init(void)
/*! Is called for all images, and sets the minimum ABI version found to the /*! Is called for all images, and sets the minimum ABI version found to the
gRuntimeLoader.abi_version field. gRuntimeLoader.abi_version field and the minimum API version found to the
gRuntimeLoader.api_version field.
*/ */
void void
set_abi_version(int abi_version) set_abi_api_version(int abi_version, int api_version)
{ {
if (gRuntimeLoader.abi_version == 0 if (gRuntimeLoader.abi_version == 0
|| gRuntimeLoader.abi_version > abi_version) { || gRuntimeLoader.abi_version > abi_version) {
gRuntimeLoader.abi_version = abi_version; gRuntimeLoader.abi_version = abi_version;
} }
if (gRuntimeLoader.api_version == 0
|| gRuntimeLoader.api_version > api_version) {
gRuntimeLoader.api_version = api_version;
}
} }
@@ -99,7 +99,7 @@ status_t elf64_verify_header(void *header, size_t length);
#endif // _COMPAT_MODE #endif // _COMPAT_MODE
void rldelf_init(void); void rldelf_init(void);
void rldexport_init(void); void rldexport_init(void);
void set_abi_version(int abi_version); void set_abi_api_version(int abi_version, int api_version);
status_t elf_reinit_after_fork(); status_t elf_reinit_after_fork();
status_t heap_init(); status_t heap_init();