From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23256 invoked by alias); 10 Aug 2009 09:29:21 -0000 Received: (qmail 23205 invoked by uid 22791); 10 Aug 2009 09:29:20 -0000 X-SWARE-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL,BAYES_00,J_CHICKENPOX_82,J_CHICKENPOX_92,SPF_PASS X-Spam-Check-By: sourceware.org Received: from smtp-out.google.com (HELO smtp-out.google.com) (216.239.45.13) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 10 Aug 2009 09:29:13 +0000 Received: from zps37.corp.google.com (zps37.corp.google.com [172.25.146.37]) by smtp-out.google.com with ESMTP id n7A9TBc3023692 for ; Mon, 10 Aug 2009 02:29:12 -0700 Received: from ewy17 (ewy17.prod.google.com [10.241.103.17]) by zps37.corp.google.com with ESMTP id n7A9T8Ts020701 for ; Mon, 10 Aug 2009 02:29:09 -0700 Received: by ewy17 with SMTP id 17so2978005ewy.26 for ; Mon, 10 Aug 2009 02:29:08 -0700 (PDT) Received: by 10.210.118.14 with SMTP id q14mr4867412ebc.74.1249896548538; Mon, 10 Aug 2009 02:29:08 -0700 (PDT) Received: from localhost.localdomain.google.com (dhcp-172-16-14-160.lon.corp.google.com [172.16.14.160]) by mx.google.com with ESMTPS id 7sm10697028eyg.35.2009.08.10.02.29.07 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 10 Aug 2009 02:29:07 -0700 (PDT) To: Andy Cc: gcc@gcc.gnu.org Subject: Re: How to link a static lib when build a shared lib ? References: <2cd8d8530908080504t30e938d7qeaba0af91de5af16@mail.gmail.com> From: Ian Lance Taylor Date: Mon, 10 Aug 2009 11:43:00 -0000 In-Reply-To: <2cd8d8530908080504t30e938d7qeaba0af91de5af16@mail.gmail.com> (Andy's message of "Sat\, 8 Aug 2009 20\:04\:41 +0800") Message-ID: User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-System-Of-Record: true X-IsSubscribed: yes Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org X-SW-Source: 2009-08/txt/msg00156.txt.bz2 Andy writes: > I got that, glibc can support SHA in crypt lib since v2.7. > > There is a requirement in my application to use SHA, but update the > whole glibc is too risky. So I want to build a specific crypt lib for > the module using crypt function in my application. > > Now the calling graph seems like this, from a simple view. > > crypt_user.c ----> call crypt() function in libcrypt.so > > myutil.c -----> call functions in crypt_user.c, and it will be build > to a shared lib, libmyutil.so > > Executable program : server -----> need to use libmyutil.so to work. > > Now I can ONLY use the latest static lib libcrypt.a from the new > glibc. How should I use it =EF=BC=9F Link it when build libmyutil.so or b= uild > server ? > > I tried to update my Makefile to link the libcrypt.a, but seems that > the called crypt function is not as I expected, it's still from the old g= libc. > > Could anybody give me a help with how to use the gcc option and write > a working Makefile ? This is the wrong mailing list. gcc@gcc.gnu.org is for discussion by gcc developers. You can try gcc-help@gcc.gnu.org. What you are trying to do is not supported. I would recommend simply finding source code for the SHA function--you should be able to find it on the web--and using that. Ian