]> git.saurik.com Git - apple/ld64.git/blobdiff - src/ld/parsers/libunwind/DwarfInstructions.hpp
ld64-242.tar.gz
[apple/ld64.git] / src / ld / parsers / libunwind / DwarfInstructions.hpp
index c67a2372bbb30c0b0f258a5d62817056bfcc03da..c14c38f871b596a00d12bb76491bd3ae1b6aba29 100644 (file)
@@ -51,6 +51,7 @@
 
 #define CFI_INVALID_ADDRESS ((pint_t)(-1))
 
+
 namespace libunwind {
 
 ///
@@ -95,7 +96,8 @@ public:
        typedef typename A::sint_t              sint_t; 
 
        static const char* parseCFIs(A& addressSpace, pint_t ehSectionStart, uint32_t sectionLength, 
-                            const pint_t cuStarts[], uint32_t cuCount, bool keepDwarfWhichHasCU, bool forceDwarfConversion,
+                            const pint_t cuStarts[], uint32_t cuCount, 
+                            bool keepDwarfWhichHasCU, bool forceDwarfConversion, bool neverConvertToCU,
                             CFI_Atom_Info<A>* infos, uint32_t& infosCount, void* ref, WarnFunc warn);
 
 
@@ -165,6 +167,14 @@ private:
                                                                                                const Registers_arm64&, const typename CFI_Parser<A>::PrologInfo& prolog,
                                                                                                char warningBuffer[1024]);
        
+  // arm specific variants
+       static bool   isReturnAddressRegister(int regNum, const Registers_arm&);
+       static pint_t getCFA(A& addressSpace, const typename CFI_Parser<A>::PrologInfo& prolog, const Registers_arm&);
+       static compact_unwind_encoding_t encodeToUseDwarf(const Registers_arm&);
+       static compact_unwind_encoding_t createCompactEncodingFromProlog(A& addressSpace, pint_t funcAddr,
+                                                                                               const Registers_arm&, const typename CFI_Parser<A>::PrologInfo& prolog,
+                                                                                               char warningBuffer[1024]);
+       
 };
 
 
@@ -172,7 +182,8 @@ private:
 
 template <typename A, typename R>
 const char* DwarfInstructions<A,R>::parseCFIs(A& addressSpace, pint_t ehSectionStart, uint32_t sectionLength, 
-                                      const pint_t cuStarts[], uint32_t cuCount,  bool keepDwarfWhichHasCU,  bool forceDwarfConversion,
+                                      const pint_t cuStarts[], uint32_t cuCount,  
+                                      bool keepDwarfWhichHasCU,  bool forceDwarfConversion, bool neverConvertToCU,
                                       CFI_Atom_Info<A>* infos, uint32_t& infosCount, void* ref, WarnFunc warn)
 {
        typename CFI_Parser<A>::CIE_Info cieInfo;
@@ -270,7 +281,7 @@ const char* DwarfInstructions<A,R>::parseCFIs(A& addressSpace, pint_t ehSectionS
                                        ++entry;
                        }
                        else {
-                               if ( (cuCount != 0) && !forceDwarfConversion ) {
+                               if ( neverConvertToCU || ((cuCount != 0) && !forceDwarfConversion) ) {
                                        // Have some compact unwind, so this is a new .o file, therefore anything without
                                        // compact unwind must be something not expressable in compact unwind.
                                        R dummy;
@@ -1958,6 +1969,30 @@ compact_unwind_encoding_t DwarfInstructions<A,R>::createCompactEncodingFromProlo
   return encoding;
 }
 
+
+
+
+//
+//     arm specific functions
+//
+
+template <typename A, typename R>
+compact_unwind_encoding_t DwarfInstructions<A,R>::encodeToUseDwarf(const Registers_arm&) 
+{
+       return UNWIND_ARM_MODE_DWARF;
+}
+
+
+template <typename A, typename R>
+compact_unwind_encoding_t DwarfInstructions<A,R>::createCompactEncodingFromProlog(A& addressSpace, pint_t funcAddr,
+                                                                                               const Registers_arm& r, const typename CFI_Parser<A>::PrologInfo& prolog,
+                                                                                               char warningBuffer[1024])
+{
+       warningBuffer[0] = '\0';
+       return UNWIND_ARM_MODE_DWARF;
+}
+
+
 } // namespace libunwind