[Lldb-commits] [PATCH] Use both OS and Architecture to choose correct ABI

Ed Maste emaste at freebsd.org
Fri Jun 5 09:00:34 PDT 2015


On 5 June 2015 at 10:42,  <abhishek.a.aggarwal at intel.com> wrote:
> From: Abhishek Aggarwal <abhishek.a.aggarwal at intel.com>
>
>    - In ABIMacOSX_i386.cpp:
>         -- Earlier, only Triple:Arch was used to choose ABI
>         -- Now, Triple:OS is also used along with Triple:Arch
>
>    - Resolves PR-23718
>
> Change-Id: Id8b1d86dda763241f9e594a1c71252555939af1e
> Signed-off-by: Abhishek Aggarwal <abhishek.a.aggarwal at intel.com>
> ---
>  source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.cpp | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.cpp b/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.cpp
> index 0853fe2..7639e95 100644
> --- a/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.cpp
> +++ b/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.cpp
> @@ -236,7 +236,8 @@ ABISP
>  ABIMacOSX_i386::CreateInstance (const ArchSpec &arch)
>  {
>      static ABISP g_abi_sp;
> -     if (arch.GetTriple().getArch() == llvm::Triple::x86)
> +     if ((arch.GetTriple().getArch() == llvm::Triple::x86) &&
> +          arch.GetTriple().isMacOSX())
>       {
>          if (!g_abi_sp)
>              g_abi_sp.reset (new ABIMacOSX_i386);

I believe a fix like this is necessary, although I think we should
also go through the other ABI plugins and make sure all of these are
consistent/correct.

For example, the arm64 ABI plugins use the vendor type instead of the OS:

    const llvm::Triple::ArchType arch_type = arch.GetTriple().getArch();
    const llvm::Triple::VendorType vendor_type = arch.GetTriple().getVendor();

    if (vendor_type == llvm::Triple::Apple)
    {
            if (arch_type == llvm::Triple::aarch64)
        {
            if (!g_abi_sp)
                g_abi_sp.reset (new ABIMacOSX_arm64);
            return g_abi_sp;
        }
    }

Perhaps isOSDarwin is actually what we want in all of these cases?



More information about the lldb-commits mailing list