libroot: explicitly check ABI version
As Axel suggested use simple, explicit checks for legacy ABI version instead of obscure "compatibility mode".
This commit is contained in:
@@ -18,7 +18,7 @@ struct real_time_data;
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern int __gCompatibilityMode;
|
extern int __gABIVersion;
|
||||||
|
|
||||||
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 */
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ char *__progname = NULL;
|
|||||||
int __libc_argc;
|
int __libc_argc;
|
||||||
char **__libc_argv;
|
char **__libc_argv;
|
||||||
|
|
||||||
int __gCompatibilityMode;
|
int __gABIVersion;
|
||||||
|
|
||||||
char _single_threaded = true;
|
char _single_threaded = true;
|
||||||
// determines if I/O locking needed; needed for BeOS compatibility
|
// 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];
|
char *programPath = __gRuntimeLoader->program_args->args[0];
|
||||||
__gCommPageAddress = __gRuntimeLoader->commpage_address;
|
__gCommPageAddress = __gRuntimeLoader->commpage_address;
|
||||||
__gCompatibilityMode
|
__gABIVersion = __gRuntimeLoader->abi_version;
|
||||||
= __gRuntimeLoader->abi_version < B_HAIKU_ABI_GCC_2_HAIKU;
|
|
||||||
|
|
||||||
if (programPath) {
|
if (programPath) {
|
||||||
if ((__progname = strrchr(programPath, '/')) == NULL)
|
if ((__progname = strrchr(programPath, '/')) == NULL)
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ area_id
|
|||||||
create_area(const char *name, void **address, uint32 addressSpec, size_t size,
|
create_area(const char *name, void **address, uint32 addressSpec, size_t size,
|
||||||
uint32 lock, uint32 protection)
|
uint32 lock, uint32 protection)
|
||||||
{
|
{
|
||||||
if (__gCompatibilityMode == 1)
|
if (__gABIVersion < B_HAIKU_ABI_GCC_2_HAIKU)
|
||||||
protection |= B_EXECUTE_AREA;
|
protection |= B_EXECUTE_AREA;
|
||||||
return _kern_create_area(name, address, addressSpec, size, lock, protection);
|
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,
|
clone_area(const char *name, void **address, uint32 addressSpec,
|
||||||
uint32 protection, area_id sourceArea)
|
uint32 protection, area_id sourceArea)
|
||||||
{
|
{
|
||||||
if (__gCompatibilityMode == 1)
|
if (__gABIVersion < B_HAIKU_ABI_GCC_2_HAIKU)
|
||||||
protection |= B_EXECUTE_AREA;
|
protection |= B_EXECUTE_AREA;
|
||||||
return _kern_clone_area(name, address, addressSpec, protection, sourceArea);
|
return _kern_clone_area(name, address, addressSpec, protection, sourceArea);
|
||||||
}
|
}
|
||||||
@@ -62,7 +62,7 @@ resize_area(area_id id, size_t newSize)
|
|||||||
status_t
|
status_t
|
||||||
set_area_protection(area_id id, uint32 protection)
|
set_area_protection(area_id id, uint32 protection)
|
||||||
{
|
{
|
||||||
if (__gCompatibilityMode == 1)
|
if (__gABIVersion < B_HAIKU_ABI_GCC_2_HAIKU)
|
||||||
protection |= B_EXECUTE_AREA;
|
protection |= B_EXECUTE_AREA;
|
||||||
return _kern_set_area_protection(id, protection);
|
return _kern_set_area_protection(id, protection);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ _thread_do_exit_work(void)
|
|||||||
void
|
void
|
||||||
__set_stack_protection(void)
|
__set_stack_protection(void)
|
||||||
{
|
{
|
||||||
if (__gCompatibilityMode == 1) {
|
if (__gABIVersion < B_HAIKU_ABI_GCC_2_HAIKU) {
|
||||||
area_info info;
|
area_info info;
|
||||||
ssize_t cookie = 0;
|
ssize_t cookie = 0;
|
||||||
|
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ __init_heap(void)
|
|||||||
sHeapBase = NULL;
|
sHeapBase = NULL;
|
||||||
|
|
||||||
uint32 protection = B_READ_AREA | B_WRITE_AREA;
|
uint32 protection = B_READ_AREA | B_WRITE_AREA;
|
||||||
if (__gCompatibilityMode == 1)
|
if (__gABIVersion < B_HAIKU_ABI_GCC_2_HAIKU)
|
||||||
protection |= B_EXECUTE_AREA;
|
protection |= B_EXECUTE_AREA;
|
||||||
sHeapArea = create_area("heap", (void **)&sHeapBase,
|
sHeapArea = create_area("heap", (void **)&sHeapBase,
|
||||||
status == B_OK ? B_EXACT_ADDRESS : B_RANDOMIZED_BASE_ADDRESS,
|
status == B_OK ? B_EXACT_ADDRESS : B_RANDOMIZED_BASE_ADDRESS,
|
||||||
@@ -171,7 +171,7 @@ hoardSbrk(long size)
|
|||||||
|
|
||||||
// choose correct protection flags
|
// choose correct protection flags
|
||||||
uint32 protection = B_READ_AREA | B_WRITE_AREA;
|
uint32 protection = B_READ_AREA | B_WRITE_AREA;
|
||||||
if (__gCompatibilityMode == 1)
|
if (__gABIVersion < B_HAIKU_ABI_GCC_2_HAIKU)
|
||||||
protection |= B_EXECUTE_AREA;
|
protection |= B_EXECUTE_AREA;
|
||||||
|
|
||||||
hoardLock(sHeapLock);
|
hoardLock(sHeapLock);
|
||||||
|
|||||||
@@ -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
|
void
|
||||||
set_abi_version(int abi_version)
|
set_abi_version(int abi_version)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user