delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2010/01/14/15:30:28

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-2.6 required=5.0 tests=BAYES_00
X-Spam-Check-By: sourceware.org
Message-ID: <4B4F7ED9.3040807@x-ray.at>
Date: Thu, 14 Jan 2010 21:30:17 +0100
From: Reini Urban <rurban AT x-ray DOT at>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.9.1.7) Gecko/20100104 SeaMonkey/2.0.2
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: dladdr and Dl_info
References: <3ab31ceedb33b3519257e07931dbdaf5 AT mail DOT smartmobili DOT com> <4B4F7C90 DOT 4030509 AT x-ray DOT at>
In-Reply-To: <4B4F7C90.4030509@x-ray.at>
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

--------------070308020408080000080701
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit

Reini Urban schrieb:
> cygwin has only dlsym() not the SGI DL_info + dladdr() yet.
> clang just needs it to get the path for the CIndex dll.
> This should be possible with the code in the LLVM_ON_WIN32 section,
> and convert then the path from win to posix with cygwin_conv_path().

Attached is the untested patch.
-- 
Reini Urban
http://phpwiki.org/  http://murbreak.at/

--------------070308020408080000080701
Content-Type: text/x-patch;
 name="cygwin-path.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="cygwin-path.patch"

Index: tools/CIndex/CIndexer.cpp
===================================================================
--- tools/CIndex/CIndexer.cpp	(revision 93449)
+++ tools/CIndex/CIndexer.cpp	(working copy)
@@ -31,7 +31,7 @@
 #include <vector>
 #include <sstream>
 
-#ifdef LLVM_ON_WIN32
+#if defined(LLVM_ON_WIN32) || defined(__CYGWIN__)
 #include <windows.h>
 #else
 #include <dlfcn.h>
@@ -46,14 +46,19 @@
     return ClangPath;
 
   // Find the location where this library lives (libCIndex.dylib).
-#ifdef LLVM_ON_WIN32
+#if defined(LLVM_ON_WIN32) || defined(__CYGWIN__)
   MEMORY_BASIC_INFORMATION mbi;
   char path[MAX_PATH];
   VirtualQuery((void *)(uintptr_t)clang_createTranslationUnit, &mbi,
                sizeof(mbi));
   GetModuleFileNameA((HINSTANCE)mbi.AllocationBase, path, MAX_PATH);
-
+#ifdef __CYGWIN__
+  char posix_path[MAX_PATH];
+  cygwin_conv_path(CCP_WIN_A_TO_POSIX | CCP_RELATIVE, path, posix_path, MAX_PATH);
+  llvm::sys::Path CIndexPath(posix_path);
+#else
   llvm::sys::Path CIndexPath(path);
+#endif
 
   CIndexPath.eraseComponent();
   CIndexPath.appendComponent("clang");


--------------070308020408080000080701
Content-Type: text/plain; charset=us-ascii

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
--------------070308020408080000080701--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019