From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17778 invoked by alias); 7 Dec 2007 16:05:32 -0000 Received: (qmail 17769 invoked by uid 22791); 7 Dec 2007 16:05:31 -0000 X-Spam-Check-By: sourceware.org Received: from py-out-1112.google.com (HELO py-out-1112.google.com) (64.233.166.180) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 07 Dec 2007 16:05:23 +0000 Received: by py-out-1112.google.com with SMTP id d32so3135840pye for ; Fri, 07 Dec 2007 08:05:19 -0800 (PST) Received: by 10.35.106.15 with SMTP id i15mr3589709pym.1197043519663; Fri, 07 Dec 2007 08:05:19 -0800 (PST) Received: from ?172.16.11.24? ( [211.7.4.194]) by mx.google.com with ESMTPS id y78sm1847530pyg.2007.12.07.08.05.15 (version=SSLv3 cipher=RC4-MD5); Fri, 07 Dec 2007 08:05:16 -0800 (PST) Subject: [objcopy] relocation sections From: robertsong To: binutils@sourceware.org Content-Type: text/plain Date: Fri, 07 Dec 2007 16:05:00 -0000 Message-Id: <1197043514.6875.25.camel@robertsong-laptop> Mime-Version: 1.0 X-Mailer: Evolution 2.10.1 Content-Transfer-Encoding: 7bit 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: 2007-12/txt/msg00034.txt.bz2 Hello, everyone. I want to use objcopy to remove the useless sections from the object file in order the shrink the library. But I can not realize it. Now I am using libpng for example. I add -ffunction-sections and -fdata-sections to CFLAGS of the Makefile as to put every function into its own function. But when I ran: $objcopy -R .text.png_read_info pngread.o BFD: stXXXXYNYHix: symbol `png_read_info' required but not present objcopy: stXXXXYNYHix: No symbols $objcopy -N png_read_info pngread.o BFD: stXXXX8m8Nnh: symbol `png_read_info' required but not present objcopy: stXXXX8m8Nnh: No symbols the comment of the error in bdf/elf.c is as bellow: /* This case can occur when using --strip-symbol on a symbol which is used in a relocation entry. */ So when I used --strip-all to remove all the symbols and relcation informations of the object file. This time the useless sections can be deleted. But I don't want to remove all the symbols info, and I have no idea what to do. Any suggestions will be appreciated. Thank you very much.