Re: [cfe-dev] cygwin updates (was: dladdr and Dl_info)

2010-01-15 Thread Vincent R.

 On 14/01/2010 14:20, Reini Urban wrote:

 I have a working cygwin llvm and llvm-gcc,
 but had no time to produce a proper package yet.
 Attached are my cygport files and my local config.
 No patches were needed.

 But I haven't bothered to build clang yet,
 just the Clang llvmc plugin and llvm-gcc,
 which I thought is harder to build and gives us more gcc
compatibility.

 Here's what I have so far for llvm/clang 2.6; the .cygport may be
 missing something, it's been a few weeks since I've looked at it.

 On the cygwin mailinglist we came to some required clang patches.
 http://cygwin.com/ml/cygwin/2010-01/msg00587.html
 Sorry, untested, as I got unrelated linker errors.
 
 The change to tools/CIndex/CIndexer.cpp looks fine if it works.  The
 change to tools/driver/driver.cpp isn't really right; the code really
 needs to be refactored.  The changes to the non-C++ include paths in
 lib/Frontend/InitHeaderSearch.cpp look a bit suspicious, but it's okay
 anyway.  The change to lib/Headers/stddef.h is completely wrong; what
 is it supposed to fix?

Still don't understand why cygwin doesn't implement dladdr, it would avoid
some
ugly ifdef...


--
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



Re: [cfe-dev] cygwin updates (was: dladdr and Dl_info)

2010-01-15 Thread Corinna Vinschen
On Jan 15 11:07, Vincent R. wrote:
 
  On 14/01/2010 14:20, Reini Urban wrote:
 
  I have a working cygwin llvm and llvm-gcc,
  but had no time to produce a proper package yet.
  Attached are my cygport files and my local config.
  No patches were needed.
 
  But I haven't bothered to build clang yet,
  just the Clang llvmc plugin and llvm-gcc,
  which I thought is harder to build and gives us more gcc
 compatibility.
 
  Here's what I have so far for llvm/clang 2.6; the .cygport may be
  missing something, it's been a few weeks since I've looked at it.
 
  On the cygwin mailinglist we came to some required clang patches.
  http://cygwin.com/ml/cygwin/2010-01/msg00587.html
  Sorry, untested, as I got unrelated linker errors.
  
  The change to tools/CIndex/CIndexer.cpp looks fine if it works.  The
  change to tools/driver/driver.cpp isn't really right; the code really
  needs to be refactored.  The changes to the non-C++ include paths in
  lib/Frontend/InitHeaderSearch.cpp look a bit suspicious, but it's okay
  anyway.  The change to lib/Headers/stddef.h is completely wrong; what
  is it supposed to fix?
 
 Still don't understand why cygwin doesn't implement dladdr, it would avoid
 some
 ugly ifdef...

http://cygwin.com/acronyms/#SHTDI
http://cygwin.com/acronyms/#PTC


Corinna

-- 
Corinna Vinschen  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader  cygwin AT cygwin DOT com
Red Hat

--
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



Re: [cfe-dev] cygwin updates (was: dladdr and Dl_info)

2010-01-15 Thread Vincent R.
On Fri, 15 Jan 2010 11:19:27 +0100, Corinna Vinschen
corinna-cyg...@cygwin.com wrote:
 On Jan 15 11:07, Vincent R. wrote:
 
  On 14/01/2010 14:20, Reini Urban wrote:
 
  I have a working cygwin llvm and llvm-gcc,
  but had no time to produce a proper package yet.
  Attached are my cygport files and my local config.
  No patches were needed.
 
  But I haven't bothered to build clang yet,
  just the Clang llvmc plugin and llvm-gcc,
  which I thought is harder to build and gives us more gcc
 compatibility.
 
  Here's what I have so far for llvm/clang 2.6; the .cygport may be
  missing something, it's been a few weeks since I've looked at it.
 
  On the cygwin mailinglist we came to some required clang patches.
  http://cygwin.com/ml/cygwin/2010-01/msg00587.html
  Sorry, untested, as I got unrelated linker errors.
  
  The change to tools/CIndex/CIndexer.cpp looks fine if it works.  The
  change to tools/driver/driver.cpp isn't really right; the code really
  needs to be refactored.  The changes to the non-C++ include paths in
  lib/Frontend/InitHeaderSearch.cpp look a bit suspicious, but it's
okay
  anyway.  The change to lib/Headers/stddef.h is completely wrong; what
  is it supposed to fix?
 
 Still don't understand why cygwin doesn't implement dladdr, it would
 avoid
 some
 ugly ifdef...
 
 http://cygwin.com/acronyms/#SHTDI
 http://cygwin.com/acronyms/#PTC

It's not too difficult to add Dl_info definition (We will support only
retrieving path name):

typedef struct 
{
  const char*dli_fname[PATH_MAX];   /* Filename of defining object */
  void  *dli_fbase; /* NA */
  const char*dli_sname; /* NA */
  void  *dli_saddr; /* NA */
} Dl_info;


int dladdr(void *addr, Dl_info *info)
{
   // see
http://trac.enlightenment.org/e/browser/trunk/PROTO/evil/src/lib/dlfcn/dlfcn.c
   // for an implementation   
}

Regards

--
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



Re: [cfe-dev] cygwin updates (was: dladdr and Dl_info)

2010-01-15 Thread Corinna Vinschen
On Jan 15 11:40, Vincent R. wrote:
 It's not too difficult to add Dl_info definition (We will support only
 retrieving path name):
 
 typedef struct 
 {
   const char  *dli_fname[PATH_MAX];   /* Filename of defining object */
   void*dli_fbase; /* NA */
   const char  *dli_sname; /* NA */
   void*dli_saddr; /* NA */
 } Dl_info;
 
 
 int dladdr(void *addr, Dl_info *info)
 {
// see
 http://trac.enlightenment.org/e/browser/trunk/PROTO/evil/src/lib/dlfcn/dlfcn.c
// for an implementation   
 }

The implementation won't work on Cygwin for functions exported by the
Cygwin DLL itself.  At least not as you expect it to work.  Every such
symbol will return the application's pathname in dli_fname.  The reason
is the way the functions are exported from libcygwin.a.  You always get
the address of the function stub linked statically to the executable.
I fear this needs more work for Cygwin.


Corinna

-- 
Corinna Vinschen  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader  cygwin AT cygwin DOT com
Red Hat

--
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



Re: [cfe-dev] cygwin updates (was: dladdr and Dl_info)

2010-01-15 Thread Vincent R.
On Fri, 15 Jan 2010 15:18:28 +0100, Corinna Vinschen
 On Jan 15 11:40, Vincent R. wrote:
 It's not too difficult to add Dl_info definition (We will support only
 retrieving path name):
 
 typedef struct 
 {
   const char *dli_fname[PATH_MAX];   /* Filename of defining object 
 */
   void   *dli_fbase; /* NA */
   const char *dli_sname; /* NA */
   void   *dli_saddr; /* NA */
 } Dl_info;
 
 
 int dladdr(void *addr, Dl_info *info)
 {
// see

http://trac.enlightenment.org/e/browser/trunk/PROTO/evil/src/lib/dlfcn/dlfcn.c
// for an implementation   
 }
 
 The implementation won't work on Cygwin for functions exported by the
 Cygwin DLL itself.  At least not as you expect it to work.  Every such
 symbol will return the application's pathname in dli_fname.  The reason
 is the way the functions are exported from libcygwin.a.  You always get
 the address of the function stub linked statically to the executable.
 I fear this needs more work for Cygwin.
 

I understand but I suppose it would work for other dlls and it's not
important if
it doesn't work for cygwin dll itself because until now you didn't need
it.


--
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



Re: [cfe-dev] cygwin updates (was: dladdr and Dl_info)

2010-01-15 Thread Christopher Faylor
On Fri, Jan 15, 2010 at 11:19:27AM +0100, Corinna Vinschen wrote:
On Jan 15 11:07, Vincent R. wrote:
 
  On 14/01/2010 14:20, Reini Urban wrote:
 
  I have a working cygwin llvm and llvm-gcc,
  but had no time to produce a proper package yet.
  Attached are my cygport files and my local config.
  No patches were needed.
 
  But I haven't bothered to build clang yet,
  just the Clang llvmc plugin and llvm-gcc,
  which I thought is harder to build and gives us more gcc
 compatibility.
 
  Here's what I have so far for llvm/clang 2.6; the .cygport may be
  missing something, it's been a few weeks since I've looked at it.
 
  On the cygwin mailinglist we came to some required clang patches.
  http://cygwin.com/ml/cygwin/2010-01/msg00587.html
  Sorry, untested, as I got unrelated linker errors.
  
  The change to tools/CIndex/CIndexer.cpp looks fine if it works.  The
  change to tools/driver/driver.cpp isn't really right; the code really
  needs to be refactored.  The changes to the non-C++ include paths in
  lib/Frontend/InitHeaderSearch.cpp look a bit suspicious, but it's okay
  anyway.  The change to lib/Headers/stddef.h is completely wrong; what
  is it supposed to fix?
 
 Still don't understand why cygwin doesn't implement dladdr, it would avoid
 some
 ugly ifdef...

http://cygwin.com/acronyms/#SHTDI
http://cygwin.com/acronyms/#PTC

And most importantly:

http://cygwin.com/acronyms/#WJM

cgf

--
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



Re: [cfe-dev] cygwin updates (was: dladdr and Dl_info)

2010-01-15 Thread Vincent R.
On Fri, 15 Jan 2010 13:40:53 -0500, Christopher Faylor
cgf-use-tqsdqsdqsd...@cygwin.com wrote:
 On Fri, Jan 15, 2010 at 11:19:27AM +0100, Corinna Vinschen wrote:
On Jan 15 11:07, Vincent R. wrote:
 
  On 14/01/2010 14:20, Reini Urban wrote:
 
  I have a working cygwin llvm and llvm-gcc,
  but had no time to produce a proper package yet.
  Attached are my cygport files and my local config.
  No patches were needed.
 
  But I haven't bothered to build clang yet,
  just the Clang llvmc plugin and llvm-gcc,
  which I thought is harder to build and gives us more gcc
 compatibility.
 
  Here's what I have so far for llvm/clang 2.6; the .cygport may be
  missing something, it's been a few weeks since I've looked at it.
 
  On the cygwin mailinglist we came to some required clang patches.
  http://cygwin.com/ml/cygwin/2010-01/msg00587.html
  Sorry, untested, as I got unrelated linker errors.
  
  The change to tools/CIndex/CIndexer.cpp looks fine if it works.  The
  change to tools/driver/driver.cpp isn't really right; the code
really
  needs to be refactored.  The changes to the non-C++ include paths in
  lib/Frontend/InitHeaderSearch.cpp look a bit suspicious, but it's
okay
  anyway.  The change to lib/Headers/stddef.h is completely wrong;
what
  is it supposed to fix?
 
 Still don't understand why cygwin doesn't implement dladdr, it would
 avoid
 some
 ugly ifdef...

http://cygwin.com/acronyms/#SHTDI
http://cygwin.com/acronyms/#PTC
 
 And most importantly:
 
 http://cygwin.com/acronyms/#WJM
 


No sorry you should add this one : IRHA (I Really Hate Acronyms)



--
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



cygwin updates (was: dladdr and Dl_info)

2010-01-14 Thread Reini Urban

Yaakov (Cygwin/X) schrieb:

On 14/01/2010 14:20, Reini Urban wrote:


I have a working cygwin llvm and llvm-gcc,
but had no time to produce a proper package yet.
Attached are my cygport files and my local config.
No patches were needed.

But I haven't bothered to build clang yet,
just the Clang llvmc plugin and llvm-gcc,
which I thought is harder to build and gives us more gcc compatibility.


Here's what I have so far for llvm/clang 2.6; the .cygport may be
missing something, it's been a few weeks since I've looked at it.


On the cygwin mailinglist we came to some required clang patches.
http://cygwin.com/ml/cygwin/2010-01/msg00587.html
Sorry, untested, as I got unrelated linker errors.

2010-01-14 Reini Urban rur...@x-ray.at

* tools/CIndex/CIndexer.cpp: dlladdr workaround and path conversion
* lib/Frontend/InitHeaderSearch.cpp: refactored

2009-11-24 Yaakov Selkowitz yselkow...@users.sourceforge.net

* tools/driver/driver.cpp, lib/Frontend/InitHeaderSearch.cpp,
lib/Headers/stddef.h: various Cygwin gcc 4.3 updates
--
Reini Urban

2010-01-14 Reini Urban rur...@x-ray.at

	* tools/CIndex/CIndexer.cpp: dlladdr workaround and path conversion
	* lib/Frontend/InitHeaderSearch.cpp: refactored

2009-11-24 Yaakov Selkowitz yselkow...@users.sourceforge.net

	* tools/driver/driver.cpp, lib/Frontend/InitHeaderSearch.cpp, 
	lib/Headers/stddef.h: various Cygwin gcc 4.3 updates

Index: tools/CIndex/CIndexer.cpp
===
--- tools/CIndex/CIndexer.cpp	(revision 93449)
+++ tools/CIndex/CIndexer.cpp	(working copy)
@@ -31,8 +31,11 @@
 #include vector
 #include sstream
 
-#ifdef LLVM_ON_WIN32
+#if defined(LLVM_ON_WIN32) || defined(__CYGWIN__)
 #include windows.h
+# ifdef __CYGWIN__
+#  include sys/cygwin.h
+# endif
 #else
 #include dlfcn.h
 #endif
@@ -46,14 +49,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);
Index: tools/driver/driver.cpp
===
--- tools/driver/driver.cpp	(revision 93449)
+++ tools/driver/driver.cpp	(working copy)
@@ -214,7 +214,13 @@
 #endif
   Driver TheDriver(Path.getBasename(), Path.getDirname(),
llvm::sys::getHostTriple(),
-   a.out, IsProduction, Diags);
+#if defined(__CYGWIN__)
+   a.exe,
+#else
+   a.out,
+#endif
+		   IsProduction, 
+		   Diags);
 
   // Check for .*++ or .*++-[^-]* to determine if we are a C++
   // compiler. This matches things like c++, clang++, and clang++-1.1.
Index: lib/Frontend/InitHeaderSearch.cpp
===
--- lib/Frontend/InitHeaderSearch.cpp	(revision 93449)
+++ lib/Frontend/InitHeaderSearch.cpp	(working copy)
@@ -430,6 +430,18 @@
   case llvm::Triple::MinGW32:
 AddPath(c:/mingw/include, System, true, false, false);
 break;
+  case llvm::Triple::Cygwin:
+// Cygwin GCC version 4
+AddPath(/usr/lib/gcc/i686-pc-cygwin/4.3.4/include,
+   System, true, false, false);
+// Cygwin GCC version 4
+AddPath(/usr/local/include, System, false, false, false);
+AddPath(/usr/include, System, false, false, false);
+AddPath(/usr/include/w32api, System, false, false, false);
+// Cygwin GCC version 3.4
+AddPath(/lib/gcc/i686-pc-cygwin/3.4.4/include, 
+System, true, false, false);
+break;
   default:
 break;
   }
@@ -454,8 +466,14 @@
   // FIXME: temporary hack: hard-coded paths.
   switch (os) {
   case llvm::Triple::Cygwin:
-AddPath(/lib/gcc/i686-pc-cygwin/3.4.4/include,
-System, true, false, false);
+// Cygwin GCC version 4
+AddPath(/usr/lib/gcc/i686-pc-cygwin/4.3.4/include/c++,
+System, true, false, false);
+AddPath(/usr/lib/gcc/i686-pc-cygwin/4.3.4/include/c++/i686-pc-cygwin,
+System, true, false, false);
+AddPath(/usr/lib/gcc/i686-pc-cygwin/4.3.4/include/c++/backward,
+System, true, false, false);
+// Cygwin GCC version 3.4
 AddPath(/lib/gcc/i686-pc-cygwin/3.4.4/include/c++,
 System, true, false, false);
 break;
Index: lib/Headers/stddef.h
===
--- lib/Headers/stddef.h	(revision 93449)
+++ lib/Headers/stddef.h	(working copy)
@@ -30,6 +30,7 @@
 typedef 

Re: [cfe-dev] cygwin updates (was: dladdr and Dl_info)

2010-01-14 Thread Eli Friedman
On Thu, Jan 14, 2010 at 1:45 PM, Reini Urban rur...@x-ray.at wrote:
 Yaakov (Cygwin/X) schrieb:

 On 14/01/2010 14:20, Reini Urban wrote:

 I have a working cygwin llvm and llvm-gcc,
 but had no time to produce a proper package yet.
 Attached are my cygport files and my local config.
 No patches were needed.

 But I haven't bothered to build clang yet,
 just the Clang llvmc plugin and llvm-gcc,
 which I thought is harder to build and gives us more gcc compatibility.

 Here's what I have so far for llvm/clang 2.6; the .cygport may be
 missing something, it's been a few weeks since I've looked at it.

 On the cygwin mailinglist we came to some required clang patches.
 http://cygwin.com/ml/cygwin/2010-01/msg00587.html
 Sorry, untested, as I got unrelated linker errors.

The change to tools/CIndex/CIndexer.cpp looks fine if it works.  The
change to tools/driver/driver.cpp isn't really right; the code really
needs to be refactored.  The changes to the non-C++ include paths in
lib/Frontend/InitHeaderSearch.cpp look a bit suspicious, but it's okay
anyway.  The change to lib/Headers/stddef.h is completely wrong; what
is it supposed to fix?

-Eli

--
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