From patchwork Mon Jan 20 21:22:00 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean Pihet X-Patchwork-Id: 3514541 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 8ACE4C02DC for ; Mon, 20 Jan 2014 21:23:42 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6C04B20142 for ; Mon, 20 Jan 2014 21:23:41 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5332E2013D for ; Mon, 20 Jan 2014 21:23:40 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1W5MJH-000080-39; Mon, 20 Jan 2014 21:23:07 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1W5MJ7-0004Bq-DF; Mon, 20 Jan 2014 21:22:57 +0000 Received: from mail-ea0-f182.google.com ([209.85.215.182]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1W5MIq-00048J-MW for linux-arm-kernel@lists.infradead.org; Mon, 20 Jan 2014 21:22:41 +0000 Received: by mail-ea0-f182.google.com with SMTP id r15so2543375ead.13 for ; Mon, 20 Jan 2014 13:22:19 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=+zux0cfCazKet0qY7EVaUOFLLxd4AjUQxOfY2TOcgH0=; b=lGg7mX4kYQwhLRvkvl95I0x/wKFTkRkpm2CrwUGPIWc1WLo57yxLY76feTH748aFqK WYL9NMF/f1gPP+LJ4J7yNysBQivjjV3P6EsGrfXGqlD31cKC5yJanlOVRBabjvx+iJbE YpTDYlHg1c01Y1/V2w8e1kTs3gpu7qQ3dDpyXGd/MNx0JFPLLDhWP4IZ028VkOxJH7Bh UO8vAtakVCGw+gacCX1zziB53uRU/LFsEM7DvcPGqc+NfXc7Vyft43b0S2weCCW/GQcD b55gB4Yh87AzfSij4tyxNYWMMd998Pa6q+U3fsvWb6kdNvVx5izeMuQT7BbdNCTqigpH HXAw== X-Gm-Message-State: ALoCoQlymEQJTrl0DtQciSyA6ZJY57+f/mzMKEJ0DYc67t/MP/IkfiGCvJU88KnNLpYDy5dsrYJk X-Received: by 10.15.75.68 with SMTP id k44mr19963236eey.57.1390252939061; Mon, 20 Jan 2014 13:22:19 -0800 (PST) Received: from localhost.localdomain (222.28-245-81.adsl-dyn.isp.belgacom.be. [81.245.28.222]) by mx.google.com with ESMTPSA id w4sm7306209eef.20.2014.01.20.13.22.17 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 20 Jan 2014 13:22:18 -0800 (PST) From: Jean Pihet To: libunwind-devel Subject: [PATCH 1/3] Add support for different binary target address sizes Date: Mon, 20 Jan 2014 22:22:00 +0100 Message-Id: <1390252922-25889-2-git-send-email-jean.pihet@linaro.org> X-Mailer: git-send-email 1.7.11.7 In-Reply-To: <1390252922-25889-1-git-send-email-jean.pihet@linaro.org> References: <1390252922-25889-1-git-send-email-jean.pihet@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140120_162240_921618_D2D9D192 X-CRM114-Status: GOOD ( 14.84 ) X-Spam-Score: -2.6 (--) Cc: patches@linaro.org, Will Deacon , linux-kernel@vger.kernel.org, Jean Pihet , Jiri Olsa , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.8 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In the case of unwinding the debug info from a binary that has a different address size than the current native platform, it is needed to record it in the address space struct, in order to correctly parse the debug info later. This mode is known as compat mode. This is the case on e.g. profiling an ARMv7 binary that runs on an ARMv8 (aka AARCH64) platform. Add the target_addr_size field in the unw_addr_space struct and provide the 32 and 64 bit macros for use in the code. Signed-off-by: Jean Pihet --- include/libunwind_i.h | 7 +++++++ include/tdep-aarch64/libunwind_i.h | 1 + include/tdep-arm/libunwind_i.h | 1 + include/tdep-hppa/libunwind_i.h | 1 + include/tdep-ia64/libunwind_i.h | 1 + include/tdep-mips/libunwind_i.h | 1 + include/tdep-ppc32/libunwind_i.h | 1 + include/tdep-ppc64/libunwind_i.h | 1 + include/tdep-sh/libunwind_i.h | 1 + include/tdep-x86/libunwind_i.h | 1 + include/tdep-x86_64/libunwind_i.h | 1 + 11 files changed, 17 insertions(+) diff --git a/include/libunwind_i.h b/include/libunwind_i.h index 0be551f..859ae03 100644 --- a/include/libunwind_i.h +++ b/include/libunwind_i.h @@ -345,6 +345,13 @@ static inline void invalidate_edi (struct elf_dyn_info *edi) # define PT_ARM_EXIDX 0x70000001 /* ARM unwind segment */ #endif /* !PT_ARM_EXIDX */ +/* Define binary target address size */ +enum { + TARGET_ADDR_SIZE_DEFAULT, + TARGET_ADDR_SIZE_32, + TARGET_ADDR_SIZE_64 +}; + #include "tdep/libunwind_i.h" #ifndef tdep_get_func_addr diff --git a/include/tdep-aarch64/libunwind_i.h b/include/tdep-aarch64/libunwind_i.h index b162271..5341118 100644 --- a/include/tdep-aarch64/libunwind_i.h +++ b/include/tdep-aarch64/libunwind_i.h @@ -61,6 +61,7 @@ struct unw_addr_space { struct unw_accessors acc; int big_endian; + int target_addr_size; /* target binary: 32/64 bit */ unw_caching_policy_t caching_policy; #ifdef HAVE_ATOMIC_OPS_H AO_t cache_generation; diff --git a/include/tdep-arm/libunwind_i.h b/include/tdep-arm/libunwind_i.h index 291b101..7353f82 100644 --- a/include/tdep-arm/libunwind_i.h +++ b/include/tdep-arm/libunwind_i.h @@ -46,6 +46,7 @@ struct unw_addr_space { struct unw_accessors acc; int big_endian; + int target_addr_size; /* target binary: 32/64 bit */ unw_caching_policy_t caching_policy; #ifdef HAVE_ATOMIC_OPS_H AO_t cache_generation; diff --git a/include/tdep-hppa/libunwind_i.h b/include/tdep-hppa/libunwind_i.h index b5bbcec..7e2ebd7 100644 --- a/include/tdep-hppa/libunwind_i.h +++ b/include/tdep-hppa/libunwind_i.h @@ -45,6 +45,7 @@ unw_tdep_frame_t; struct unw_addr_space { struct unw_accessors acc; + int target_addr_size; /* target binary: 32/64 bit */ unw_caching_policy_t caching_policy; #ifdef HAVE_ATOMIC_OPS_H AO_t cache_generation; diff --git a/include/tdep-ia64/libunwind_i.h b/include/tdep-ia64/libunwind_i.h index 2bea830..20dd999 100644 --- a/include/tdep-ia64/libunwind_i.h +++ b/include/tdep-ia64/libunwind_i.h @@ -96,6 +96,7 @@ struct unw_addr_space struct unw_accessors acc; int big_endian; int abi; /* abi < 0 => unknown, 0 => SysV, 1 => HP-UX, 2 => Windows */ + int target_addr_size; /* target binary: 32/64 bit */ unw_caching_policy_t caching_policy; #ifdef HAVE_ATOMIC_OPS_H AO_t cache_generation; diff --git a/include/tdep-mips/libunwind_i.h b/include/tdep-mips/libunwind_i.h index 3ef1cef..c7a0c16 100644 --- a/include/tdep-mips/libunwind_i.h +++ b/include/tdep-mips/libunwind_i.h @@ -52,6 +52,7 @@ struct unw_addr_space int big_endian; mips_abi_t abi; unsigned int addr_size; + int target_addr_size; /* target binary: 32/64 bit */ unw_caching_policy_t caching_policy; #ifdef HAVE_ATOMIC_OPS_H diff --git a/include/tdep-ppc32/libunwind_i.h b/include/tdep-ppc32/libunwind_i.h index 06c0023..3c67454 100644 --- a/include/tdep-ppc32/libunwind_i.h +++ b/include/tdep-ppc32/libunwind_i.h @@ -51,6 +51,7 @@ unw_tdep_frame_t; struct unw_addr_space { struct unw_accessors acc; + int target_addr_size; /* target binary: 32/64 bit */ unw_caching_policy_t caching_policy; #ifdef HAVE_ATOMIC_OPS_H AO_t cache_generation; diff --git a/include/tdep-ppc64/libunwind_i.h b/include/tdep-ppc64/libunwind_i.h index 6024455..faf6483 100644 --- a/include/tdep-ppc64/libunwind_i.h +++ b/include/tdep-ppc64/libunwind_i.h @@ -53,6 +53,7 @@ struct unw_addr_space struct unw_accessors acc; int big_endian; ppc64_abi_t abi; + int target_addr_size; /* target binary: 32/64 bit */ unw_caching_policy_t caching_policy; #ifdef HAVE_ATOMIC_OPS_H AO_t cache_generation; diff --git a/include/tdep-sh/libunwind_i.h b/include/tdep-sh/libunwind_i.h index 51234d1..c731001 100644 --- a/include/tdep-sh/libunwind_i.h +++ b/include/tdep-sh/libunwind_i.h @@ -46,6 +46,7 @@ struct unw_addr_space { struct unw_accessors acc; int big_endian; + int target_addr_size; /* target binary: 32/64 bit */ unw_caching_policy_t caching_policy; #ifdef HAVE_ATOMIC_OPS_H AO_t cache_generation; diff --git a/include/tdep-x86/libunwind_i.h b/include/tdep-x86/libunwind_i.h index f59a3cf..7f5be18 100644 --- a/include/tdep-x86/libunwind_i.h +++ b/include/tdep-x86/libunwind_i.h @@ -45,6 +45,7 @@ unw_tdep_frame_t; struct unw_addr_space { struct unw_accessors acc; + int target_addr_size; /* target binary: 32/64 bit */ unw_caching_policy_t caching_policy; #ifdef HAVE_ATOMIC_OPS_H AO_t cache_generation; diff --git a/include/tdep-x86_64/libunwind_i.h b/include/tdep-x86_64/libunwind_i.h index 8c9cd05..623416b 100644 --- a/include/tdep-x86_64/libunwind_i.h +++ b/include/tdep-x86_64/libunwind_i.h @@ -62,6 +62,7 @@ unw_tdep_frame_t; struct unw_addr_space { struct unw_accessors acc; + int target_addr_size; /* target binary: 32/64 bit */ unw_caching_policy_t caching_policy; #ifdef HAVE_ATOMIC_OPS_H AO_t cache_generation;