This is the mail archive of the cygwin-xfree@cygwin.com mailing list for the Cygwin XFree86 project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: Xrandr


On Wed, 1 Aug 2001, Alexander Gottwald wrote:

> On Wed, 1 Aug 2001, Suhaib Siddiqi wrote:
> 
> 
> The problems seem to come from the C++ objects. I now filter everything that
> has a "(" or ":" in the name and the typeinfos. It works for libGLU. 
> I also checked against the orignal libname-def.cpp to see if something was
> missing or added.
> 
> Some export defines use the syntax "name @ number". What does this mean. 
> Also some librarynames changed from lower to uppercase and the libraryname
> for libX11 changed from libX11 to X11.
> 

I tested a bit and found that 
nm --demangle --defined-only *.o | sed -n 's/^.* T //p' is not enough. Some
exports are in other sections. I found two ways to get the exports to the def
file. First is the filter all demangled C++ and type names, which is very 
insecure since I could only fix the strings I already found in the current 
export nm-list. Maybe a newer version of binutils will change the names and
the filter is broken again. The second way is to not use --demangle and fix
the leading underscore with a sed script. This is less insecure, but is still
bad since a change in the binary names will break the script again.

1. nm --demangle --defined-only *.o | sed -n 's/^.* [A-Z] //p' | \
        sed '/^typeinfo name\|^typeinfo for\|^vtable for\|^constrution \
        vtable for\|^VTT\|:\|)/ d'
2.  nm --defined-only *.o | sed -n 's/^.* [A-Z] _//p'

the [A-Z] names all exported sections eg. code, bss, common, data and much
more (see info binutils for the exact meanings)

I added the first to the patch. This time a checked that lib and programs 
compile but have not completely checked runtime of all binaries.

bye
    ago
-- 
Alexander.Gottwald@s1999.tu-chemnitz.de
http://www.gotti.org
phone: +49 3725 3498080     mobile: +49 172 7854017
Index: cygwin.rules
===================================================================
RCS file: /cvs/xc/config/cf/cygwin.rules,v
retrieving revision 3.12
diff -U3 -r3.12 cygwin.rules
--- cygwin.rules	2001/06/25 11:02:26	3.12
+++ cygwin.rules	2001/08/01 05:19:44
@@ -51,7 +52,25 @@
 #ifndef UseExportLists
 #define UseExportLists YES
 #endif
+#ifndef UseAutomaticExportLists
+#define UseAutomaticExportLists YES
+#endif
+
+
+/*
+ * SharedLibraryExportDef 
+ * Generates the libname-def.cpp
+ */	
 
+#if UseAutomaticExportLists
+#  define SharedLibraryExportDef(libname,solist,rev)        @@\
+libname-cyg.cpp: solist                                     @@\
+	( echo "LIBRARY libname" ; echo "VERSION LIBRARY_VERSION" ; echo "EXPORTS"; $(NM) --defined-only solist | sed -n 's/^.* [A-Z] _//p' ) > libname-cyg.cpp                          @@\
+	CppFileTarget(libname.def,libname-cyg.cpp,-DLIBRARY_VERSION=rev,$(ICONFIGFILES))
+#else
+#  define SharedLibraryExportDef(libname,solist,rev)        @@\
+	CppFileTarget(libname.def,libname-def.cpp,-DLIBRARY_VERSION=rev,$(ICONFIGFILES))
+#endif
 
 /*
  * SharedDepLibraryTarget - generate rules to create a shared library.
@@ -69,17 +88,14 @@
 #  endif
 # endif /* UseInstalled */
 
-
 /*
  * SharedDepLibraryTarget
  */
 
 #define SharedDepLibraryTarget(libname,rev,deplist,solist,down,up)	@@\
 AllTarget(Concat3(lib,libname,.dll))                                    @@\
-									@@\
-CppFileTarget(libname.def,libname-def.cpp,-DLIBRARY_VERSION=rev,$(ICONFIGFILES)) @@\
 									@@\
-                                                                        @@\
+SharedLibraryExportDef(libname,solist,rev)      			@@\
 									@@\
 junk.c:									@@\
 	echo "#include <cygwin/cygwin_dll.h>"		>junk.c		@@\
@@ -151,7 +167,6 @@
 	export IMAGE_BASE=`cat $(BASE_COUNTER)`; \			@@\
 	printf 0x%x `expr \`printf %u $$IMAGE_BASE\` + $$IMAGE_LENGTH` > $(BASE_COUNTER)
 
-
 /*
  * SharedLibraryTarget
  */
@@ -159,7 +174,7 @@
 #define SharedLibraryTarget(libname,rev,solist,down,up)                 @@\
 AllTarget(Concat3(lib,libname,.dll))                                    @@\
 									@@\
-CppFileTarget(libname.def,libname-def.cpp,-DLIBRARY_VERSION=rev,$(ICONFIGFILES)) @@\
+SharedLibraryExportDef(libname,solist,rev)			        @@\
 									@@\
                                                                         @@\
 junk.c:                                                                 @@\
Index: cygwin.tmpl
===================================================================
RCS file: /cvs/xc/config/cf/cygwin.tmpl,v
retrieving revision 3.6
diff -U3 -r3.6 cygwin.tmpl
--- cygwin.tmpl	2001/06/25 08:12:30	3.6
+++ cygwin.tmpl	2001/08/01 05:19:44
@@ -58,6 +59,10 @@
 #define ObjdumpCmd objdump
 #endif
 
+#ifndef NmCmd
+#define NmCmd nm
+#endif
+	
 #ifndef DllBaseCounter
 # if CrossCompiling
 # define DllBaseCounter ~/DLL_BASE_COUNTER /* So you don't have to be root */
@@ -74,4 +79,5 @@
           DLLTOOL = DlltoolCmd
           OBJDUMP = ObjdumpCmd
      BASE_COUNTER = DllBaseCounter
+               NM = NmCmd 
 

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]