From patchwork Tue Jun 5 19:35:24 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas De Schampheleire X-Patchwork-Id: 163158 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from fraxinus.osuosl.org (fraxinus.osuosl.org [140.211.166.137]) by ozlabs.org (Postfix) with ESMTP id 6BEF0B6F62 for ; Wed, 6 Jun 2012 05:36:43 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 6156810034B; Tue, 5 Jun 2012 19:36:42 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 4FBbx7XIM+iP; Tue, 5 Jun 2012 19:36:35 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by fraxinus.osuosl.org (Postfix) with ESMTP id 930F41001A7; Tue, 5 Jun 2012 19:36:28 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from whitealder.osuosl.org (whitealder.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id CE4438F753 for ; Tue, 5 Jun 2012 19:36:24 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id BA55B8C9C0 for ; Tue, 5 Jun 2012 19:36:24 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id A1yRZoNieX2f for ; Tue, 5 Jun 2012 19:36:23 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-ee0-f43.google.com (mail-ee0-f43.google.com [74.125.83.43]) by whitealder.osuosl.org (Postfix) with ESMTPS id 278598CA39 for ; Tue, 5 Jun 2012 19:36:22 +0000 (UTC) Received: by mail-ee0-f43.google.com with SMTP id e50so3172932eek.16 for ; Tue, 05 Jun 2012 12:36:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:content-type:mime-version:content-transfer-encoding:subject :x-mercurial-node:message-id:in-reply-to:references:user-agent:date :from:to:cc; bh=CMpIemsoA9RJnTVPNfniktNI9yzd7DBK+LWTnn4/GwU=; b=iinQjGH5dGGuyn2ZcwFG3GZ4dU51D3T7hyNuAHGnJe0u1CchtJDRrihJ5OLRPOzsxT 9raWiyehxLB7iKRTI68Z2gEHa9Ejry/Asn1Dya+/DP8L65fREz55hswhY8B3+ax2jnrh yB7HhnnRqP6Tgm92fYxt5XudkrdhV7y8Rza1nRVbdFFrQI6Mx8SJb+nUKrnqkKIed0/A pBMJQ55cqpz4/2RPyLyvlK1pk/FFfYOVre7zmVN3Zb3xrzBKdbmhshLbJ06sDy5NlFI/ C8uvdfnl96U5f4hcwwlLC3FUCTJOtvne+Kb0Ubo8QA5zMzBM4KFWLfouFlT5MjoNftNa Q72w== Received: by 10.14.96.8 with SMTP id q8mr7074453eef.203.1338924982710; Tue, 05 Jun 2012 12:36:22 -0700 (PDT) Received: from [127.0.1.1] (d54C62A5A.access.telenet.be. [84.198.42.90]) by mx.google.com with ESMTPS id p41sm9422207eef.5.2012.06.05.12.36.21 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 05 Jun 2012 12:36:21 -0700 (PDT) MIME-Version: 1.0 X-Mercurial-Node: ede6e8b24d6f06f26b683517c29dba91b87279c8 Message-Id: In-Reply-To: References: User-Agent: Mercurial-patchbomb/2.0.2 Date: Tue, 05 Jun 2012 21:35:24 +0200 From: Thomas De Schampheleire To: buildroot@busybox.net Subject: [Buildroot] [PATCH 2 of 2 v5-resend] build: add option to exclude executables/dirs from being stripped X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: buildroot-bounces@busybox.net Sender: buildroot-bounces@busybox.net Sometimes it may be desirable to keep debug symbols for some binaries and libraries on the target. This commit introduces the config option BR2_STRIP_EXCLUDE_FILES, which is interpreted as a list of such binaries and libraries, and the option BR2_STRIP_EXCLUDE_DIRS, which indicates directories excluded from stripping entirely. These exclusions are passed to the find command in the target-finalize step. Signed-off-by: Sven Neumann Signed-off-by: Thomas De Schampheleire Acked-by: Arnout Vandecappelle (Essensium/Mind) --- v5: line up with latest git v4: whitespace changes v3: merge with redundant patch 'stripping: use findfileclauses utility function' v2: add the possibility to exclude entire directories Config.in | 19 +++++++++++++++++++ Makefile | 10 ++++++++-- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/Config.in b/Config.in --- a/Config.in +++ b/Config.in @@ -283,6 +283,25 @@ config BR2_STRIP_none filesystem. endchoice +config BR2_STRIP_EXCLUDE_FILES + string "executables that should not be stripped" + depends on !BR2_STRIP_none + default "" + help + You may specify a space-separated list of binaries and libraries + here that should not be stripped on the target. + +config BR2_STRIP_EXCLUDE_DIRS + string "directories that should be skipped when stripping" + depends on !BR2_STRIP_none + default "" + help + You may specify a space-separated list of directories that should + be skipped when stripping. Binaries and libraries in these + directories will not be touched. + The directories should be specified relative to the target directory, + without leading slash. + choice prompt "gcc optimization level" default BR2_OPTIMIZE_S diff --git a/Makefile b/Makefile --- a/Makefile +++ b/Makefile @@ -386,6 +386,13 @@ endif $(TARGET_DIR): $(BUILD_DIR)/.root +STRIP_FIND_CMD = find $(TARGET_DIR) +ifneq (,$(call qstrip,$(BR2_STRIP_EXCLUDE_DIRS))) +STRIP_FIND_CMD += \( $(call finddirclauses,$(TARGET_DIR),$(call qstrip,$(BR2_STRIP_EXCLUDE_DIRS))) \) -prune -o +endif +STRIP_FIND_CMD += -type f -perm +111 +STRIP_FIND_CMD += -not \( $(call findfileclauses,libthread_db*.so* $(call qstrip,$(BR2_STRIP_EXCLUDE_FILES))) \) -print + target-finalize: ifeq ($(BR2_HAVE_DEVFILES),y) ( support/scripts/copy.sh $(STAGING_DIR) $(TARGET_DIR) ) @@ -410,8 +417,7 @@ endif ifeq ($(BR2_PACKAGE_PYTHON_PYC_ONLY),y) find $(TARGET_DIR)/usr/lib/ -name '*.py' -print0 | xargs -0 rm -f endif - find $(TARGET_DIR) -type f -perm +111 '!' -name 'libthread_db*.so*' | \ - xargs $(STRIPCMD) 2>/dev/null || true + $(STRIP_FIND_CMD) | xargs $(STRIPCMD) 2>/dev/null || true find $(TARGET_DIR)/lib/modules -type f -name '*.ko' | \ xargs -r $(KSTRIPCMD) || true