Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com From: "Ralf Habacker" To: "Cygwin" Subject: RE: duplicate regexec/regcomp functions detected Date: Tue, 1 Jan 2002 15:24:49 +0100 Message-ID: <001101c192d0$11e99c60$865c07d5@BRAMSCHE> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook 8.5, Build 4.71.2173.0 In-Reply-To: <01df01c19259$1cbb8300$0200a8c0@lifelesswks> X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 Importance: Normal > From: "Ralf Habacker" > > > > No, only the symbols, which are defined in pthread.o, called the > "reflib" in speclib. > > That will be an incomplete list of symbols then, as I've been removing > them from pthread.o - there is (a minor) performance hit with the > redirection, and the pthread functions tend to be part of the critical > performance path when they are used. > No I'm recognized, that we are speaking about two different things. May be that I have doesn't told clearly enough, so I like to resume. At first I'm stumbled about the curious link line with the multiple defined main in the qt lib, chris and I have spoken over. After thinking about this problem a while I had an idea how to solve such problems instead of using simple links from libcygwin.a to libpthread.a and other. The idea was to use the cygwin1.dll as used currently, but to build only several import libs (!) for special libs like libpthread and may me libm and libc. The advantage of doing this is, this allows a very flexible way of using. Someone could use the libcygwin.a for all needs functions regardless if they original belongs to libc libm or libpthread. Someone how like to use libpthread, libm, libc and may be other can use the belonging import libraries (remember not the function or vars, the functions are located in cygwin1.dll) and can link. A second advantage of this concept is, that if there is a future need to split some functions from cygwin1.dll to a seperate dll or static lib, the import libraries, which the users are link to, are the same as now. Only the backend was changed. This simplificates further development of the whole emulation layer without and noticable changes to the user (except an new compiling) So the concept has a two level structure. The top level are the import libraries, the bottom level are one or more dll's and perhaps static lib. The task for doing so (for libpthread) is to look which functions of the pthread library are exported (decribed in pthread.h and relating headers, but I think it is only the one). This is done by scanning pthread.o with nm for every exported symbol. (The consequence for this is, that only this symbols are has to be exported) Then search cygdll.a after those symbols and extract only the relevant d000xxx.o from cygdll.a to a newly created import library named libpthread.a or other revelant name. Doing like this (extraxting d000xxx-files from cygdll) has an extra advantage relating to the auto-import feature. If cygwin1.dll perhaps contains auto-imported vars, than using the d0000xxx files extract the import thunks too and there is no need to change this concept. The patch I have supplied, does exactly this and seems to me ready with the on exception of locating file dirs (identifiable on "$PWD.."), i have told about. speclib ----------------------------------------------------------------------------- #!/bin/sh # # create specific link library for libpthread using symbols from libcygwin.a # inlib=$1; shift # cygdll.a reflib=$1; shift # pthread.o outlib=$1; shift # libpthread.a nm=$1; shift ar=$1; shift ranlib=$1; shift tmpdir=slibtmp.dir # collect needed symbols SYMBOLS=`nm $reflib | grep "[TD] _" | gawk '{ print $3 }'` # build awk script to extract d000xxx files SCRIPT='$1 ~ /^d00/ { file = $1; gsub(":","",file); }' for i in $SYMBOLS; do SCRIPT="$SCRIPT \$3 ~ /^$i/ { print file; }" done # remove previous link library rm -f $outlib # collect all d000xxx files from $inlib (cygdll.a) FILES=`$nm $PWD/$inlib | gawk "$SCRIPT"` # extract related object files mkdir $tmpdir cd $tmpdir $ar x $PWD/$inlib $FILES cd .. # create new link library for pthread $ar cru $PWD/$outlib $tmpdir/*.o $ranlib $PWD/$outlib # remove temporay files rm -fr $tmpdir ----------------------------------------------------------------------------- I hope I have written clearly enough and I'm sorry for an confusion, I'm responsible. So if there an questions, please let me know. BTW: I wish you all a happy new year. Regards Ralf -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/