From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16348 invoked by alias); 26 Mar 2005 21:57:55 -0000 Mailing-List: contact binutils-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sources.redhat.com Received: (qmail 15890 invoked from network); 26 Mar 2005 21:57:51 -0000 Received: from unknown (HELO wproxy.gmail.com) (64.233.184.196) by sourceware.org with SMTP; 26 Mar 2005 21:57:51 -0000 Received: by wproxy.gmail.com with SMTP id 69so1804wri for ; Sat, 26 Mar 2005 13:57:49 -0800 (PST) Received: by 10.54.4.8 with SMTP id 8mr1181057wrd; Sat, 26 Mar 2005 13:46:45 -0800 (PST) Received: by 10.54.8.50 with HTTP; Sat, 26 Mar 2005 13:46:45 -0800 (PST) Message-ID: <7ac1e90c0503261346244d052f@mail.gmail.com> Date: Mon, 28 Mar 2005 02:08:00 -0000 From: Bahadir Balban Reply-To: Bahadir Balban To: binutils@sources.redhat.com Subject: what are weak external symbols? Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-SW-Source: 2005-03/txt/msg00801.txt.bz2 Hi, I'm reading the book "Linkers and Loaders" and weak external symbols are not so clearly explained (for me at least). In summary it says that weak external symbols is a concept to avoid linking with unused parts of a library. The printf example is given: floating-point routines (namely fcvt) are referred as weak references by printf, such that when printf is used in a routine that didn't use fcvt, reference to fcvt resolves to zero and no error is produced from this. Now the questions: 1) Is my summary above correct? 2) Is this a case such that, these fcvt routines are explicitly defined in printf as weak references? If so, how do you define it as such in C source? Or perhaps you use a linker flag when you create the library? I thought this question best fits the binutils list, sorry if I'm off-topic. Many thanks, Bahadir