forked from OSchip/llvm-project
Revert "[Sanitizers] Get link map on FreeBSD via documented API"
This reverts commit 92e267a94d
, as it
appears Android is missing dlinfo(3).
This commit is contained in:
parent
b8ebc11f03
commit
480eea4e45
|
@ -66,10 +66,6 @@ uptr internal_getpid() {
|
|||
return pid;
|
||||
}
|
||||
|
||||
int internal_dlinfo(void *handle, int request, void *p) {
|
||||
UNIMPLEMENTED();
|
||||
}
|
||||
|
||||
uptr GetThreadSelf() { return reinterpret_cast<uptr>(thrd_current()); }
|
||||
|
||||
tid_t GetTid() { return GetThreadSelf(); }
|
||||
|
|
|
@ -72,8 +72,6 @@ unsigned int internal_sleep(unsigned int seconds);
|
|||
uptr internal_getpid();
|
||||
uptr internal_getppid();
|
||||
|
||||
int internal_dlinfo(void *handle, int request, void *p);
|
||||
|
||||
// Threading
|
||||
uptr internal_sched_yield();
|
||||
|
||||
|
|
|
@ -735,10 +735,6 @@ uptr internal_getppid() {
|
|||
return internal_syscall(SYSCALL(getppid));
|
||||
}
|
||||
|
||||
int internal_dlinfo(void *handle, int request, void *p) {
|
||||
return dlinfo(handle, request, p);
|
||||
}
|
||||
|
||||
uptr internal_getdents(fd_t fd, struct linux_dirent *dirp, unsigned int count) {
|
||||
#if SANITIZER_FREEBSD
|
||||
return internal_syscall(SYSCALL(getdirentries), fd, (uptr)dirp, count, NULL);
|
||||
|
|
|
@ -208,10 +208,6 @@ uptr internal_getpid() {
|
|||
return getpid();
|
||||
}
|
||||
|
||||
int internal_dlinfo(void *handle, int request, void *p) {
|
||||
UNIMPLEMENTED();
|
||||
}
|
||||
|
||||
int internal_sigaction(int signum, const void *act, void *oldact) {
|
||||
return sigaction(signum,
|
||||
(const struct sigaction *)act, (struct sigaction *)oldact);
|
||||
|
|
|
@ -265,11 +265,6 @@ uptr internal_getppid() {
|
|||
return _REAL(getppid);
|
||||
}
|
||||
|
||||
int internal_dlinfo(void *handle, int request, void *p) {
|
||||
DEFINE__REAL(int, dlinfo, void *a, int b, void *c);
|
||||
return _REAL(dlinfo, handle, request, p);
|
||||
}
|
||||
|
||||
uptr internal_getdents(fd_t fd, void *dirp, unsigned int count) {
|
||||
DEFINE__REAL(int, __getdents30, int a, void *b, size_t c);
|
||||
return _REAL(__getdents30, fd, dirp, count);
|
||||
|
|
|
@ -52,7 +52,6 @@
|
|||
#include <netinet/ip_mroute.h>
|
||||
//
|
||||
#include <dirent.h>
|
||||
#include <dlfcn.h>
|
||||
#include <fstab.h>
|
||||
#include <fts.h>
|
||||
#include <glob.h>
|
||||
|
@ -87,15 +86,9 @@
|
|||
|
||||
// Include these after system headers to avoid name clashes and ambiguities.
|
||||
#include "sanitizer_internal_defs.h"
|
||||
#include "sanitizer_libc.h"
|
||||
#include "sanitizer_platform_limits_freebsd.h"
|
||||
|
||||
namespace __sanitizer {
|
||||
void *__sanitizer_get_link_map_by_dlopen_handle(void *handle) {
|
||||
void *p = nullptr;
|
||||
return internal_dlinfo(handle, RTLD_DI_LINKMAP, &p) == 0 ? p : nullptr;
|
||||
}
|
||||
|
||||
unsigned struct_cap_rights_sz = sizeof(cap_rights_t);
|
||||
unsigned struct_utsname_sz = sizeof(struct utsname);
|
||||
unsigned struct_stat_sz = sizeof(struct stat);
|
||||
|
|
|
@ -20,15 +20,15 @@
|
|||
#include "sanitizer_platform.h"
|
||||
#include "sanitizer_platform_limits_posix.h"
|
||||
|
||||
// FreeBSD's dlopen() returns a pointer to an Obj_Entry structure that
|
||||
// incorporates the map structure.
|
||||
#define GET_LINK_MAP_BY_DLOPEN_HANDLE(handle) \
|
||||
((link_map *)((handle) == nullptr ? nullptr : ((char *)(handle) + 560)))
|
||||
// Get sys/_types.h, because that tells us whether 64-bit inodes are
|
||||
// used in struct dirent below.
|
||||
#include <sys/_types.h>
|
||||
|
||||
namespace __sanitizer {
|
||||
void *__sanitizer_get_link_map_by_dlopen_handle(void *handle);
|
||||
#define GET_LINK_MAP_BY_DLOPEN_HANDLE(handle) \
|
||||
(link_map *)__sanitizer_get_link_map_by_dlopen_handle(handle)
|
||||
|
||||
extern unsigned struct_utsname_sz;
|
||||
extern unsigned struct_stat_sz;
|
||||
#if defined(__powerpc64__)
|
||||
|
|
|
@ -213,7 +213,6 @@ struct urio_command {
|
|||
#include <dev/wscons/wsdisplay_usl_io.h>
|
||||
#include <fs/autofs/autofs_ioctl.h>
|
||||
#include <dirent.h>
|
||||
#include <dlfcn.h>
|
||||
#include <glob.h>
|
||||
#include <grp.h>
|
||||
#include <ifaddrs.h>
|
||||
|
@ -259,15 +258,9 @@ struct urio_command {
|
|||
|
||||
// Include these after system headers to avoid name clashes and ambiguities.
|
||||
#include "sanitizer_internal_defs.h"
|
||||
#include "sanitizer_libc.h"
|
||||
#include "sanitizer_platform_limits_netbsd.h"
|
||||
|
||||
namespace __sanitizer {
|
||||
void *__sanitizer_get_link_map_by_dlopen_handle(void* handle) {
|
||||
void *p = nullptr;
|
||||
return internal_dlinfo(handle, RTLD_DI_LINKMAP, &p) == 0 ? p : nullptr;
|
||||
}
|
||||
|
||||
unsigned struct_utsname_sz = sizeof(struct utsname);
|
||||
unsigned struct_stat_sz = sizeof(struct stat);
|
||||
unsigned struct_rusage_sz = sizeof(struct rusage);
|
||||
|
|
|
@ -19,11 +19,18 @@
|
|||
#include "sanitizer_internal_defs.h"
|
||||
#include "sanitizer_platform.h"
|
||||
|
||||
namespace __sanitizer {
|
||||
void *__sanitizer_get_link_map_by_dlopen_handle(void *handle);
|
||||
# define GET_LINK_MAP_BY_DLOPEN_HANDLE(handle) \
|
||||
(link_map *)__sanitizer_get_link_map_by_dlopen_handle(handle)
|
||||
#define _GET_LINK_MAP_BY_DLOPEN_HANDLE(handle, shift) \
|
||||
((link_map *)((handle) == nullptr ? nullptr : ((char *)(handle) + (shift))))
|
||||
|
||||
#if defined(__x86_64__)
|
||||
#define GET_LINK_MAP_BY_DLOPEN_HANDLE(handle) \
|
||||
_GET_LINK_MAP_BY_DLOPEN_HANDLE(handle, 264)
|
||||
#elif defined(__i386__)
|
||||
#define GET_LINK_MAP_BY_DLOPEN_HANDLE(handle) \
|
||||
_GET_LINK_MAP_BY_DLOPEN_HANDLE(handle, 136)
|
||||
#endif
|
||||
|
||||
namespace __sanitizer {
|
||||
extern unsigned struct_utsname_sz;
|
||||
extern unsigned struct_stat_sz;
|
||||
extern unsigned struct_rusage_sz;
|
||||
|
|
|
@ -49,10 +49,6 @@ uptr internal_getpid() {
|
|||
return getpid();
|
||||
}
|
||||
|
||||
int internal_dlinfo(void *handle, int request, void *p) {
|
||||
UNIMPLEMENTED();
|
||||
}
|
||||
|
||||
bool FileExists(const char *filename) {
|
||||
struct stat st;
|
||||
if (stat(filename, &st))
|
||||
|
|
|
@ -94,10 +94,6 @@ uptr internal_getpid() {
|
|||
return GetProcessId(GetCurrentProcess());
|
||||
}
|
||||
|
||||
int internal_dlinfo(void *handle, int request, void *p) {
|
||||
UNIMPLEMENTED();
|
||||
}
|
||||
|
||||
// In contrast to POSIX, on Windows GetCurrentThreadId()
|
||||
// returns a system-unique identifier.
|
||||
tid_t GetTid() {
|
||||
|
|
Loading…
Reference in New Issue