On Sat, 2020-03-28 at 15:32 +0100, Kamil Rytarowski wrote: > On 28.03.2020 14:52, Michał Górny wrote: > > Add a hack to help lldb locate lldb-server. The upstream code for this > > relies on liblldb being built as a shared library, as it uses dlinfo > > to determine the path to the library and find executables relative > > to that. We cannot build liblldb.so at the moment since it would > > require building whole LLVM and Clang with -fPIC. > > > > The patch hardcodes a path equivalent to the expected value. This way > > we can avoid having to change more than one statement, as the relative > > path logic remains correct. > > --- > > .../llvm/dist/lldb/source/Host/common/HostInfoBase.cpp | 8 +------- > > 1 file changed, 1 insertion(+), 7 deletions(-) > > > > diff --git a/external/apache2/llvm/dist/lldb/source/Host/common/HostInfoBase.cpp b/external/apache2/llvm/dist/lldb/source/Host/common/HostInfoBase.cpp > > index 3765f36fc79a..ac36bdbbdc27 100644 > > --- a/external/apache2/llvm/dist/lldb/source/Host/common/HostInfoBase.cpp > > +++ b/external/apache2/llvm/dist/lldb/source/Host/common/HostInfoBase.cpp > > @@ -248,13 +248,7 @@ bool HostInfoBase::ComputeSharedLibraryDirectory(FileSpec &file_spec) { > > // contains this function. On MacOSX this will be "LLDB.framework/.../LLDB". > > // On other posix systems, we will get .../lib(64|32)?/liblldb.so. > > > > - FileSpec lldb_file_spec(Host::GetModuleFileSpecForHostAddress( > > - reinterpret_cast<void *>(reinterpret_cast<intptr_t>( > > - HostInfoBase::ComputeSharedLibraryDirectory)))); > > - > > - // This is necessary because when running the testsuite the shlib might be a > > - // symbolic link inside the Python resource dir. > > - FileSystem::Instance().ResolveSymbolicLink(lldb_file_spec, lldb_file_spec); > > + FileSpec lldb_file_spec("/usr/lib/liblldb.so"); > > > > // Remove the filename so that this FileSpec only represents the directory. > > file_spec.GetDirectory() = lldb_file_spec.GetDirectory(); > > > > I would go here for > > #if 1 // workaround missing liblldb.so > FileSpec lldb_file_spec("/usr/lib/liblldb.so"); > #else > FileSpec lldb_file_spec(Host::GetModuleFileSpecForHostAddress( > reinterpret_cast<void *>(reinterpret_cast<intptr_t>( > HostInfoBase::ComputeSharedLibraryDirectory)))); > > // This is necessary because when running the testsuite the shlib > might be a > // symbolic link inside the Python resource dir. > FileSystem::Instance().ResolveSymbolicLink(lldb_file_spec, > lldb_file_spec); > #endif Thanks. I've decided to do it the other way around, i.e. '#if 0' first, so that the active code is all in one place. This IMHO is more readable. -- Best regards, Michał Górny
Attachment:
signature.asc
Description: This is a digitally signed message part