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: 23418 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qe0-f71.google.com (mail-qe0-f71.google.com [209.85.128.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 6A965203C6 for ; Mon, 20 Jan 2014 21:22:21 +0000 (UTC) Received: by mail-qe0-f71.google.com with SMTP id 8sf12926152qea.10 for ; Mon, 20 Jan 2014 13:22:20 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=+zux0cfCazKet0qY7EVaUOFLLxd4AjUQxOfY2TOcgH0=; b=MxVFwFdAsNRxhY9pSupCx54tZeKAy33cXdJsyOo79NAM/cRDqDMrjduVBoXPtxFSi1 lJsb4MKBvSf+GiF9MYT/mm0hyov6dEO/MEZiT0XLKGWqe9Un+ys6hUMrdi36jF1GjXJE sg1Q9msqvg+UscVi9KXUtqck71OxlNYEw0HvgNinCyb4SHomGaxiCU+rQqzK12kbhrlm P5ll/DeiNu2Nyi2o/3+/CtY42GhGLBkMwUcjOQsWmkFyOLUxWbyifW3ZN7rKtdd1Tw5a VHdDdHJJ+BYdwKA9cSeCk/uVgb4PI/NcWz3MIpJij1Vr7zUQ3FiTWQ2fwDeJmFQKMLjr FqRA== X-Gm-Message-State: ALoCoQmzhdVZ8K/qBqNZz5/ii8vs8uNZv6fu4AwgNPyGo9hpCrGpbht3sEaUuCzgmNMSXjfJdf+z X-Received: by 10.58.156.42 with SMTP id wb10mr7525546veb.26.1390252940666; Mon, 20 Jan 2014 13:22:20 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.116.4 with SMTP id js4ls1770834qeb.41.gmail; Mon, 20 Jan 2014 13:22:20 -0800 (PST) X-Received: by 10.58.100.197 with SMTP id fa5mr1244881veb.24.1390252940546; Mon, 20 Jan 2014 13:22:20 -0800 (PST) Received: from mail-ve0-f171.google.com (mail-ve0-f171.google.com [209.85.128.171]) by mx.google.com with ESMTPS id qw5si799050vcb.48.2014.01.20.13.22.20 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 20 Jan 2014 13:22:20 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.171 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.171; Received: by mail-ve0-f171.google.com with SMTP id pa12so1178872veb.30 for ; Mon, 20 Jan 2014 13:22:20 -0800 (PST) X-Received: by 10.58.255.233 with SMTP id at9mr2974033ved.20.1390252940471; Mon, 20 Jan 2014 13:22:20 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp77094vcz; Mon, 20 Jan 2014 13:22:19 -0800 (PST) X-Received: by 10.15.101.78 with SMTP id bo54mr2048721eeb.30.1390252939560; Mon, 20 Jan 2014 13:22:19 -0800 (PST) Received: from mail-ea0-f172.google.com (mail-ea0-f172.google.com [209.85.215.172]) by mx.google.com with ESMTPS id e2si4628023eeg.177.2014.01.20.13.22.19 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 20 Jan 2014 13:22:19 -0800 (PST) Received-SPF: neutral (google.com: 209.85.215.172 is neither permitted nor denied by best guess record for domain of jean.pihet@linaro.org) client-ip=209.85.215.172; Received: by mail-ea0-f172.google.com with SMTP id g15so2792296eak.17 for ; Mon, 20 Jan 2014 13:22:19 -0800 (PST) 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 Cc: Will Deacon , Jiri Olsa , patches@linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Jean Pihet 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-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: jean.pihet@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.171 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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;