Author: mohit.bhakkad Date: Wed Jun 1 05:39:18 2016 New Revision: 271379 URL: http://llvm.org/viewvc/llvm-project?rev=271379&view=rev Log: Merging r269181: ------------------------------------------------------------------------ r269181 | slthakur | 2016-05-11 18:38:29 +0530 (Wed, 11 May 2016) | 10 lines
[LLDB][MIPS] Setting appropriate ArchSpec::m_flags based on ABI Patch by Nitesh Jain. Summary: The ArchSpec::m_flags will be set based on ELF flag ABI. Reviewers: ovyalov, clayborg Subscribers: lldb-commits, mohit.bhakkad, sagar, jaydeep, bhushan Differential: D18858 ------------------------------------------------------------------------ Modified: lldb/branches/release_38/ (props changed) lldb/branches/release_38/include/lldb/Core/ArchSpec.h lldb/branches/release_38/source/Core/ArchSpec.cpp lldb/branches/release_38/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp Propchange: lldb/branches/release_38/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Wed Jun 1 05:39:18 2016 @@ -1,3 +1,3 @@ /lldb/branches/apple/python-GIL:156467-162159 /lldb/branches/iohandler:198360-200250 -/lldb/trunk:257691-257692,257926,258485,258621,258684-258685,258758,258761,258919,258967,259188,260072,260362,261206,262819,264030,265134 +/lldb/trunk:257691-257692,257926,258485,258621,258684-258685,258758,258761,258919,258967,259188,260072,260362,261206,262819,264030,265134,269181 Modified: lldb/branches/release_38/include/lldb/Core/ArchSpec.h URL: http://llvm.org/viewvc/llvm-project/lldb/branches/release_38/include/lldb/Core/ArchSpec.h?rev=271379&r1=271378&r2=271379&view=diff ============================================================================== --- lldb/branches/release_38/include/lldb/Core/ArchSpec.h (original) +++ lldb/branches/release_38/include/lldb/Core/ArchSpec.h Wed Jun 1 05:39:18 2016 @@ -69,6 +69,9 @@ public: eMIPSABI_O32 = 0x00002000, eMIPSABI_N32 = 0x00004000, eMIPSABI_N64 = 0x00008000, + eMIPSABI_O64 = 0x00020000, + eMIPSABI_EABI32 = 0x00040000, + eMIPSABI_EABI64 = 0x00080000, eMIPSABI_mask = 0x000ff000 }; @@ -280,6 +283,14 @@ public: const char * GetArchitectureName () const; + //----------------------------------------------------------------- + /// if MIPS architecture return true. + /// + /// @return a boolean value. + //----------------------------------------------------------------- + bool + IsMIPS() const; + //------------------------------------------------------------------ /// Returns a string representing current architecture as a target CPU /// for tools like compiler, disassembler etc. Modified: lldb/branches/release_38/source/Core/ArchSpec.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/branches/release_38/source/Core/ArchSpec.cpp?rev=271379&r1=271378&r2=271379&view=diff ============================================================================== --- lldb/branches/release_38/source/Core/ArchSpec.cpp (original) +++ lldb/branches/release_38/source/Core/ArchSpec.cpp Wed Jun 1 05:39:18 2016 @@ -511,6 +511,18 @@ ArchSpec::GetArchitectureName () const return "unknown"; } +bool +ArchSpec::IsMIPS() const +{ + const llvm::Triple::ArchType machine = GetMachine(); + if(machine == llvm::Triple::mips || + machine == llvm::Triple::mipsel || + machine == llvm::Triple::mips64 || + machine == llvm::Triple::mips64el) + return true; + return false; +} + std::string ArchSpec::GetClangTargetCPU () { Modified: lldb/branches/release_38/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/branches/release_38/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp?rev=271379&r1=271378&r2=271379&view=diff ============================================================================== --- lldb/branches/release_38/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp (original) +++ lldb/branches/release_38/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp Wed Jun 1 05:39:18 2016 @@ -1602,8 +1602,7 @@ ObjectFileELF::GetSectionHeaderInfo(Sect I->section_name = name; - if (arch_spec.GetMachine() == llvm::Triple::mips || arch_spec.GetMachine() == llvm::Triple::mipsel - || arch_spec.GetMachine() == llvm::Triple::mips64 || arch_spec.GetMachine() == llvm::Triple::mips64el) + if (arch_spec.IsMIPS()) { uint32_t arch_flags = arch_spec.GetFlags (); DataExtractor data; @@ -1617,13 +1616,27 @@ ObjectFileELF::GetSectionHeaderInfo(Sect } } // Settings appropriate ArchSpec ABI Flags - if (header.e_flags & llvm::ELF::EF_MIPS_ABI2) + switch(header.e_flags & llvm::ELF::EF_MIPS_ABI) { - arch_flags |= lldb_private::ArchSpec::eMIPSABI_N32; - } - else if (header.e_flags & llvm::ELF::EF_MIPS_ABI_O32) - { - arch_flags |= lldb_private::ArchSpec::eMIPSABI_O32; + case llvm::ELF::EF_MIPS_ABI_O32: + arch_flags |= lldb_private::ArchSpec::eMIPSABI_O32; + break; + case EF_MIPS_ABI_O64: + arch_flags |= lldb_private::ArchSpec::eMIPSABI_O64; + break; + case EF_MIPS_ABI_EABI32: + arch_flags |= lldb_private::ArchSpec::eMIPSABI_EABI32; + break; + case EF_MIPS_ABI_EABI64: + arch_flags |= lldb_private::ArchSpec::eMIPSABI_EABI64; + break; + default: + // ABI Mask doesn't cover N32 and N64 ABI. + if (header.e_ident[EI_CLASS] == llvm::ELF::ELFCLASS64) + arch_flags |= lldb_private::ArchSpec::eMIPSABI_N64; + else if (header.e_flags && llvm::ELF::EF_MIPS_ABI2) + arch_flags |= lldb_private::ArchSpec::eMIPSABI_N32; + break; } arch_spec.SetFlags (arch_flags); } _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits