mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-11-26 07:01:05 +00:00
Add functionality to the platforms to figure out the proper name for a dynamic library on the system given a basename
This will do things like, given mylibrary, return libmylibrary.dylib on OSX mylibrary.dll on Windows and so on for other platforms It is currently implemented for Windows, Darwin, and Linux. Other platforms should fill in accordingly llvm-svn: 246131
This commit is contained in:
parent
c0499c9848
commit
6e25aeea96
@ -268,6 +268,9 @@ class ModuleCache;
|
||||
|
||||
virtual const char *
|
||||
GetHostname ();
|
||||
|
||||
virtual ConstString
|
||||
GetFullNameForDylib (ConstString basename);
|
||||
|
||||
virtual const char *
|
||||
GetDescription () = 0;
|
||||
|
@ -854,3 +854,14 @@ PlatformLinux::ConvertMmapFlagsToPlatform(const ArchSpec &arch, unsigned flags)
|
||||
flags_platform |= map_anon;
|
||||
return flags_platform;
|
||||
}
|
||||
|
||||
ConstString
|
||||
PlatformLinux::GetFullNameForDylib (ConstString basename)
|
||||
{
|
||||
if (basename.IsEmpty())
|
||||
return basename;
|
||||
|
||||
StreamString stream;
|
||||
stream.Printf("lib%s.so", basename.GetCString());
|
||||
return ConstString(stream.GetData());
|
||||
}
|
||||
|
@ -111,6 +111,9 @@ namespace platform_linux {
|
||||
uint64_t
|
||||
ConvertMmapFlagsToPlatform(const ArchSpec &arch, unsigned flags) override;
|
||||
|
||||
ConstString
|
||||
GetFullNameForDylib (ConstString basename) override;
|
||||
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN (PlatformLinux);
|
||||
};
|
||||
|
@ -1531,3 +1531,15 @@ PlatformDarwin::AddClangModuleCompilationOptionsForSDKType (Target *target, std:
|
||||
options.push_back(sysroot_spec.GetPath());
|
||||
}
|
||||
}
|
||||
|
||||
ConstString
|
||||
PlatformDarwin::GetFullNameForDylib (ConstString basename)
|
||||
{
|
||||
if (basename.IsEmpty())
|
||||
return basename;
|
||||
|
||||
StreamString stream;
|
||||
stream.Printf("lib%s.dylib", basename.GetCString());
|
||||
return ConstString(stream.GetData());
|
||||
}
|
||||
|
||||
|
@ -84,6 +84,9 @@ public:
|
||||
|
||||
bool
|
||||
SupportsModules () override { return true; }
|
||||
|
||||
lldb_private::ConstString
|
||||
GetFullNameForDylib (lldb_private::ConstString basename) override;
|
||||
|
||||
protected:
|
||||
|
||||
|
@ -743,3 +743,14 @@ PlatformWindows::GetEnvironment(StringList &env)
|
||||
|
||||
return Host::GetEnvironment(env);
|
||||
}
|
||||
|
||||
ConstString
|
||||
PlatformWindows::GetFullNameForDylib (ConstString basename)
|
||||
{
|
||||
if (basename.IsEmpty())
|
||||
return basename;
|
||||
|
||||
StreamString stream;
|
||||
stream.Printf("%s.dll", basename.GetCString());
|
||||
return ConstString(stream.GetData());
|
||||
}
|
||||
|
@ -156,6 +156,9 @@ public:
|
||||
CalculateTrapHandlerSymbolNames () override
|
||||
{
|
||||
}
|
||||
|
||||
ConstString
|
||||
GetFullNameForDylib (ConstString basename) override;
|
||||
|
||||
protected:
|
||||
lldb::PlatformSP m_remote_platform_sp;
|
||||
|
@ -947,6 +947,12 @@ Platform::GetHostname ()
|
||||
return m_name.c_str();
|
||||
}
|
||||
|
||||
ConstString
|
||||
Platform::GetFullNameForDylib (ConstString basename)
|
||||
{
|
||||
return basename;
|
||||
}
|
||||
|
||||
bool
|
||||
Platform::SetRemoteWorkingDirectory(const FileSpec &working_dir)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user