From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9241 invoked by alias); 31 Jan 2011 07:17:45 -0000 Received: (qmail 9231 invoked by uid 22791); 31 Jan 2011 07:17:44 -0000 X-SWARE-Spam-Status: No, hits=-2.6 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from smtp-out.google.com (HELO smtp-out.google.com) (74.125.121.67) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 31 Jan 2011 07:17:38 +0000 Received: from wpaz13.hot.corp.google.com (wpaz13.hot.corp.google.com [172.24.198.77]) by smtp-out.google.com with ESMTP id p0V7HZlq005802 for ; Sun, 30 Jan 2011 23:17:35 -0800 Received: from iyb26 (iyb26.prod.google.com [10.241.49.90]) by wpaz13.hot.corp.google.com with ESMTP id p0V7HXG8003431 (version=TLSv1/SSLv3 cipher=RC4-MD5 bits=128 verify=NOT) for ; Sun, 30 Jan 2011 23:17:33 -0800 Received: by iyb26 with SMTP id 26so5154451iyb.35 for ; Sun, 30 Jan 2011 23:17:33 -0800 (PST) Received: by 10.231.192.73 with SMTP id dp9mr6077014ibb.20.1296458253109; Sun, 30 Jan 2011 23:17:33 -0800 (PST) Received: from coign.google.com (adsl-71-133-8-30.dsl.pltn13.pacbell.net [71.133.8.30]) by mx.google.com with ESMTPS id i16sm17659971ibl.18.2011.01.30.23.17.31 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sun, 30 Jan 2011 23:17:32 -0800 (PST) From: Ian Lance Taylor To: ali hagigat Cc: binutils@sourceware.org Subject: Re: why ld return with error? References: Date: Mon, 31 Jan 2011 07:17:00 -0000 In-Reply-To: (ali hagigat's message of "Mon, 31 Jan 2011 08:32:34 +0330") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-System-Of-Record: true X-IsSubscribed: yes Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org X-SW-Source: 2011-01/txt/msg00394.txt.bz2 ali hagigat writes: > I have the following files: > prog3.c > #include > main(){ > printf("uuuuuu\n"); > } > prog3.ld > ASSERT(1,"there is not an error"); > Then : > gcc -c prog3.c -o prog3.o > ld prog3.o prog3.ld -o prog3 > > ld: warning: cannot find entry symbol _start; defaulting to 0000000008048074 > prog3.o: In function `main': > prog3.c:(.text+0x11): undefined reference to `puts' > ------------------------------------------------------------------------ > I want to force gcc (or ld) to use its built-in functions as printf > and puts(not to use the standard library functions like libc.a or > libc.so). how can i do it? gcc by default optimizes printf of a string constant ending in a newline to call puts instead. To disable that, use -fno-builtin-printf when compiling. I don't understand what you mean when you say that you want gcc to use its built-in functions as printf rather than the standard library functions. gcc has no built-in printf function. Ian