diff --git a/headers/private/libroot/libroot_private.h b/headers/private/libroot/libroot_private.h index a419872ef1..85bc14d11f 100644 --- a/headers/private/libroot/libroot_private.h +++ b/headers/private/libroot/libroot_private.h @@ -18,7 +18,7 @@ struct real_time_data; extern "C" { #endif -extern int __gCompatibilityMode; +extern int __gABIVersion; extern char _single_threaded; /* This determines if a process runs single threaded or not */ diff --git a/src/system/libroot/libroot_init.c b/src/system/libroot/libroot_init.c index 0915842a2d..867cbd25a6 100644 --- a/src/system/libroot/libroot_init.c +++ b/src/system/libroot/libroot_init.c @@ -31,7 +31,7 @@ char *__progname = NULL; int __libc_argc; char **__libc_argv; -int __gCompatibilityMode; +int __gABIVersion; char _single_threaded = true; // determines if I/O locking needed; needed for BeOS compatibility @@ -50,8 +50,7 @@ initialize_before(image_id imageID) { char *programPath = __gRuntimeLoader->program_args->args[0]; __gCommPageAddress = __gRuntimeLoader->commpage_address; - __gCompatibilityMode - = __gRuntimeLoader->abi_version < B_HAIKU_ABI_GCC_2_HAIKU; + __gABIVersion = __gRuntimeLoader->abi_version; if (programPath) { if ((__progname = strrchr(programPath, '/')) == NULL) diff --git a/src/system/libroot/os/area.c b/src/system/libroot/os/area.c index 6af67ec235..f620d23bd0 100644 --- a/src/system/libroot/os/area.c +++ b/src/system/libroot/os/area.c @@ -15,7 +15,7 @@ area_id create_area(const char *name, void **address, uint32 addressSpec, size_t size, uint32 lock, uint32 protection) { - if (__gCompatibilityMode == 1) + if (__gABIVersion < B_HAIKU_ABI_GCC_2_HAIKU) protection |= B_EXECUTE_AREA; return _kern_create_area(name, address, addressSpec, size, lock, protection); } @@ -25,7 +25,7 @@ area_id clone_area(const char *name, void **address, uint32 addressSpec, uint32 protection, area_id sourceArea) { - if (__gCompatibilityMode == 1) + if (__gABIVersion < B_HAIKU_ABI_GCC_2_HAIKU) protection |= B_EXECUTE_AREA; return _kern_clone_area(name, address, addressSpec, protection, sourceArea); } @@ -62,7 +62,7 @@ resize_area(area_id id, size_t newSize) status_t set_area_protection(area_id id, uint32 protection) { - if (__gCompatibilityMode == 1) + if (__gABIVersion < B_HAIKU_ABI_GCC_2_HAIKU) protection |= B_EXECUTE_AREA; return _kern_set_area_protection(id, protection); } diff --git a/src/system/libroot/os/thread.c b/src/system/libroot/os/thread.c index 39e7dc2ef7..41721453d3 100644 --- a/src/system/libroot/os/thread.c +++ b/src/system/libroot/os/thread.c @@ -77,7 +77,7 @@ _thread_do_exit_work(void) void __set_stack_protection(void) { - if (__gCompatibilityMode == 1) { + if (__gABIVersion < B_HAIKU_ABI_GCC_2_HAIKU) { area_info info; ssize_t cookie = 0; diff --git a/src/system/libroot/posix/malloc/arch-specific.cpp b/src/system/libroot/posix/malloc/arch-specific.cpp index 25c17ec71d..0f16100831 100644 --- a/src/system/libroot/posix/malloc/arch-specific.cpp +++ b/src/system/libroot/posix/malloc/arch-specific.cpp @@ -106,7 +106,7 @@ __init_heap(void) sHeapBase = NULL; uint32 protection = B_READ_AREA | B_WRITE_AREA; - if (__gCompatibilityMode == 1) + if (__gABIVersion < B_HAIKU_ABI_GCC_2_HAIKU) protection |= B_EXECUTE_AREA; sHeapArea = create_area("heap", (void **)&sHeapBase, status == B_OK ? B_EXACT_ADDRESS : B_RANDOMIZED_BASE_ADDRESS, @@ -171,7 +171,7 @@ hoardSbrk(long size) // choose correct protection flags uint32 protection = B_READ_AREA | B_WRITE_AREA; - if (__gCompatibilityMode == 1) + if (__gABIVersion < B_HAIKU_ABI_GCC_2_HAIKU) protection |= B_EXECUTE_AREA; hoardLock(sHeapLock); diff --git a/src/system/runtime_loader/export.cpp b/src/system/runtime_loader/export.cpp index 8adeec6ed3..f8c0b068c1 100644 --- a/src/system/runtime_loader/export.cpp +++ b/src/system/runtime_loader/export.cpp @@ -74,6 +74,9 @@ rldexport_init(void) } +/*! Is called for all images, and sets the minimum ABI version found to the + gRuntimeLoader.abi_version field. +*/ void set_abi_version(int abi_version) {