From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4250 invoked by alias); 18 Nov 2003 18:26:02 -0000 Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org Received: (qmail 4230 invoked from network); 18 Nov 2003 18:26:01 -0000 Received: from unknown (HELO mail-srv2.micron.com) (137.201.242.130) by sources.redhat.com with SMTP; 18 Nov 2003 18:26:01 -0000 Received: from mail-srv2.micron.com (localhost [127.0.0.1]) by mail-srv2.micron.com (8.12.9/8.12.2) with ESMTP id hAIIQ3fh023894 for ; Tue, 18 Nov 2003 11:26:04 -0700 (MST) Received: from ntxboimbx07.micron.com (ntxboimbx07.micron.com [137.201.80.94]) by mail-srv2.micron.com (8.12.9/8.12.2) with ESMTP id hAIIQ2xi023881; Tue, 18 Nov 2003 11:26:02 -0700 (MST) From: lrtaylor@micron.com X-MimeOLE: Produced By Microsoft Exchange V6.0.6487.1 content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: RE: ld -static option. Date: Tue, 18 Nov 2003 18:26:00 -0000 Message-ID: <363801FFD7B74240A329CEC3F7FE4CC40D340A@ntxboimbx07.micron.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: To: , X-Scanned-By: MIMEDefang 2.37 X-SW-Source: 2003-11/txt/msg00251.txt.bz2 -static tells the compiler to link all libraries following that option statically. If you don't tell the linker to link dynamically by default at some point after using this option (using -Bdynamic or something similar), then it will link _all_ libraries listed after -static statically, including libraries that normally get linked in by default, such as the C library, etc. Generally, if you only want a specify library linked in statically, you would do something like this: gcc -o a.out a.o -static -L. -lmylib -Wl,-Bdynamic The actual argument to use to tell the linker to link dynamically may be different depending on the platform you're building on. Cheers, Lyle -----Original Message----- From: gcc-help-owner@gcc.gnu.org [mailto:gcc-help-owner@gcc.gnu.org] On Behalf Of Bansidhar Arvind Deshpande - CTD, Chennai. Sent: Tuesday, November 18, 2003 4:05 AM To: gcc-help@gcc.gnu.org Subject: ld -static option. Hi all, I am using gcc 2.96. I am wondering the working of -static option given for ld. What is the exact functionality of this.=20 e.g=20 ld a.o -static -L./ -lmylib -o a.out In above example does the -static option apply only for mylib which is specified by -l or it is applied for all of the libraries to generated a.out. Generically=20 does -static controls only to the libraries specified by -l or all of the libraries taken by ld to generate the executable ?=20 I am also interested in hidden functionality of -static if exists.=20 Thanks, --Bansidhar