For b/18243822, fix dlopen_with_offset to not reuse the same link_map
entry when called on the same file with different offsets.
(ppluzhnikov, google-local)
+
+dlfcn/dlopen.c
+elf/dl-load.c
+ To fix AARCH64 build, make code added to dl-load.c in previous CL
+ conditional on SHARED. Disable dlopen_with_offet in fully-static links.
+ (ppluzhnikov, google-local)
static_link_warning (dlopen)
#endif
-void *
-dlopen_with_offset (const char *file, off_t offset, int mode)
-{
- return __dlopen_with_offset (file, offset, mode, RETURN_ADDRESS (0));
-}
-static_link_warning (dlopen_with_offset)
-
#else
struct dlopen_args
# endif
}
+# ifdef SHARED
void *
__dlopen_with_offset (const char *file, off_t offset, int mode DL_CALLER_DECL)
{
-# ifdef SHARED
if (__builtin_expect (_dlfcn_hook != NULL, 0))
return _dlfcn_hook->dlopen_with_offset (file, offset, mode, DL_CALLER);
-# endif
-
- struct dlopen_args args;
- args.file = file;
- args.offset = offset;
- args.mode = mode;
- args.caller = DL_CALLER;
-
- return __dlopen_common (&args);
}
-# ifdef SHARED
strong_alias (__dlopen_with_offset, __google_dlopen_with_offset)
# endif
else
assert (r->r_state == RT_ADD);
+#ifdef SHARED
+ // This code could be linked into 'sln', which does not have _itoa.
+ // We only care about this when this is linked into ld-linux.
if (offset != 0)
{
/* Google-specific: to help GDB, and for b/18243822, turn realname
tmp[19] = '\0';
strcat(realname, _itoa(offset, &tmp[18], 16, 0));
}
+#endif
/* Enter the new object in the list of loaded objects. */
l = _dl_new_object (realname, offset ? realname : name, l_type,