runtime_loader: Set sSearchPathSubDir on first image, not on app image.
Under normal conditions this will behave identically. But when using LD_PRELOAD or the like, some shared objects (and dependencies) are loaded before the app image is, and on the secondary arch on hybrid builds, will fail to load any of their dependencies due to sSearchPathSubDir not being set. Fixes #12214, which had plagued users of libroot_debug for a long time now.
This commit is contained in:
@@ -570,9 +570,10 @@ load_image(char const* name, image_type type, const char* rpath,
|
||||
analyze_image_haiku_version_and_abi(fd, image, eheader, sheaderSize,
|
||||
pheaderBuffer, sizeof(pheaderBuffer));
|
||||
|
||||
// If this is the executable image, we init the search path
|
||||
// subdir, if the compiler version doesn't match ours.
|
||||
if (type == B_APP_IMAGE) {
|
||||
// If sSearchPathSubDir is unset (meaning, this is the first image we're
|
||||
// loading) we init the search path subdir if the compiler version doesn't
|
||||
// match ours.
|
||||
if (sSearchPathSubDir == NULL) {
|
||||
#if __GNUC__ == 2
|
||||
if ((image->abi & B_HAIKU_ABI_MAJOR) == B_HAIKU_ABI_GCC_4)
|
||||
sSearchPathSubDir = "x86";
|
||||
|
||||
Reference in New Issue
Block a user