From 0cf3d62115e3f1cce1d0165e603cab3b84e18f2f Mon Sep 17 00:00:00 2001 From: Michael Lotz Date: Sat, 11 Apr 2015 09:19:18 +0200 Subject: [PATCH] Make guarded heap accessible through its own libroot_guarded.so. This adds libroot_guarded.so to the HaikuDevel package. It is the same as libroot_debug with the debug heap swapped out for the guarded heap. The guarded heap has some useful features that make it desirable to use while having the disadvantage of a large memory and address space overhead which make it unusable in some situations. Therefore the guarded heap cannot simply replace the debug heap but should still be made available. As the heap init needs to happen even before having environment variables, the heap to use can not be chosen dynamically. Exposing them through their own libraries is the next best thing. --- build/jam/packages/HaikuDevel | 6 ++++- src/system/libroot/Jamfile | 25 +++++++++++++++++++ src/system/libroot/posix/malloc_debug/Jamfile | 5 +++- 3 files changed, 34 insertions(+), 2 deletions(-) diff --git a/build/jam/packages/HaikuDevel b/build/jam/packages/HaikuDevel index b0889aaf84..c15e872601 100644 --- a/build/jam/packages/HaikuDevel +++ b/build/jam/packages/HaikuDevel @@ -19,7 +19,11 @@ AddFilesToPackage develop lib : AddFilesToPackage develop lib : kernel.so : _KERNEL_ ; # additional libraries -local developmentLibs = libroot_debug.so ; +local developmentLibs = + libroot_debug.so + libroot_guarded.so + ; + AddFilesToPackage lib : $(developmentLibs) ; # library symlinks diff --git a/src/system/libroot/Jamfile b/src/system/libroot/Jamfile index f3e7d52961..5d95fc562b 100644 --- a/src/system/libroot/Jamfile +++ b/src/system/libroot/Jamfile @@ -62,6 +62,11 @@ for architectureObject in [ MultiArchSubDirSetup ] { ; librootDebugObjects = $(librootDebugObjects:G=$(architecture)) ; + local librootGuardedObjects = + posix_malloc_guarded.o + ; + librootGuardedObjects = $(librootGuardedObjects:G=$(architecture)) ; + local librootNoDebugObjects = posix_malloc.o ; @@ -69,12 +74,15 @@ for architectureObject in [ MultiArchSubDirSetup ] { local libroot = [ MultiArchDefaultGristFiles libroot.so ] ; local librootDebug = $(libroot:B=libroot_debug) ; + local librootGuarded = $(libroot:B=libroot_guarded) ; DONT_LINK_AGAINST_LIBROOT on $(libroot) = true ; DONT_LINK_AGAINST_LIBROOT on $(librootDebug) = true ; + DONT_LINK_AGAINST_LIBROOT on $(librootGuarded) = true ; SetVersionScript $(libroot) : libroot_versions ; SetVersionScript $(librootDebug) : libroot_versions ; + SetVersionScript $(librootGuarded) : libroot_versions ; SharedLibrary $(libroot) : @@ -100,6 +108,17 @@ for architectureObject in [ MultiArchSubDirSetup ] { [ TargetLibgcc ] ; + HAIKU_SONAME on $(librootGuarded) = libroot.so ; + + SharedLibrary $(librootGuarded) + : + libroot_init.c + : + $(librootObjects) + $(librootGuardedObjects) + [ TargetStaticLibsupc++ ] + [ TargetLibgcc ] + ; # Copy libroot.so and update the copy's revision section. We link # everything against the original, but the copy will end up on the disk @@ -112,12 +131,18 @@ for architectureObject in [ MultiArchSubDirSetup ] { libroot.so : revisioned ] ; local revisionedLibrootDebug = $(librootDebug:G=$(revisionedLibroot:G)) ; + local revisionedLibrootGuarded + = $(librootGuarded:G=$(revisionedLibroot:G)) ; MakeLocate $(revisionedLibroot) : $(targetDir) ; CopySetHaikuRevision $(revisionedLibroot) : $(libroot) ; MakeLocate $(revisionedLibrootDebug) : $(targetDir) ; CopySetHaikuRevision $(revisionedLibrootDebug) : $(librootDebug) ; + + MakeLocate $(revisionedLibrootGuarded) : $(targetDir) ; + CopySetHaikuRevision $(revisionedLibrootGuarded) + : $(librootGuarded) ; } } } diff --git a/src/system/libroot/posix/malloc_debug/Jamfile b/src/system/libroot/posix/malloc_debug/Jamfile index 903167d934..ef1d3f3ac6 100644 --- a/src/system/libroot/posix/malloc_debug/Jamfile +++ b/src/system/libroot/posix/malloc_debug/Jamfile @@ -14,8 +14,11 @@ for architectureObject in [ MultiArchSubDirSetup ] { UsePrivateSystemHeaders ; MergeObject <$(architecture)>posix_malloc_debug.o : - #guarded_heap.cpp heap.cpp ; + + MergeObject <$(architecture)>posix_malloc_guarded.o : + guarded_heap.cpp + ; } }