@@ -3661,10 +3661,6 @@ struct class_ro32_t {
36613661#define RO_ROOT (1 << 1 )
36623662#define RO_HAS_CXX_STRUCTORS (1 << 2 )
36633663
3664- /* Values for method_list{64,32}_t->entsize */
3665- #define ML_HAS_RELATIVE_PTRS (1 << 31 )
3666- #define ML_ENTSIZE_MASK 0xFFFF
3667-
36683664struct method_list64_t {
36693665 uint32_t entsize;
36703666 uint32_t count;
@@ -3689,12 +3685,6 @@ struct method32_t {
36893685 uint32_t imp; /* IMP (32-bit pointer) */
36903686};
36913687
3692- struct method_relative_t {
3693- int32_t name; /* SEL (32-bit relative) */
3694- int32_t types; /* const char * (32-bit relative) */
3695- int32_t imp; /* IMP (32-bit relative) */
3696- };
3697-
36983688struct protocol_list64_t {
36993689 uint64_t count; /* uintptr_t (a 64-bit value) */
37003690 /* struct protocol64_t * list[0]; These pointers follow inline */
@@ -3996,12 +3986,6 @@ inline void swapStruct(struct method32_t &m) {
39963986 sys::swapByteOrder (m.imp );
39973987}
39983988
3999- inline void swapStruct (struct method_relative_t &m) {
4000- sys::swapByteOrder (m.name );
4001- sys::swapByteOrder (m.types );
4002- sys::swapByteOrder (m.imp );
4003- }
4004-
40053989inline void swapStruct (struct protocol_list64_t &pl) {
40063990 sys::swapByteOrder (pl.count );
40073991}
@@ -4456,84 +4440,6 @@ static void print_layout_map32(uint32_t p, struct DisassembleInfo *info) {
44564440 print_layout_map (layout_map, left);
44574441}
44584442
4459- static void print_relative_method_list (uint32_t structSizeAndFlags,
4460- uint32_t structCount, uint64_t p,
4461- struct DisassembleInfo *info,
4462- const char *indent,
4463- uint32_t pointerBits) {
4464- struct method_relative_t m;
4465- const char *r, *name;
4466- uint32_t offset, xoffset, left, i;
4467- SectionRef S, xS;
4468-
4469- assert (((structSizeAndFlags & ML_HAS_RELATIVE_PTRS) != 0 ) &&
4470- " expected structSizeAndFlags to have ML_HAS_RELATIVE_PTRS flag" );
4471-
4472- outs () << indent << " \t\t entsize "
4473- << (structSizeAndFlags & ML_ENTSIZE_MASK) << " (relative) \n " ;
4474- outs () << indent << " \t\t count " << structCount << " \n " ;
4475-
4476- for (i = 0 ; i < structCount; i++) {
4477- r = get_pointer_64 (p, offset, left, S, info);
4478- memset (&m, ' \0 ' , sizeof (struct method_relative_t ));
4479- if (left < sizeof (struct method_relative_t )) {
4480- memcpy (&m, r, left);
4481- outs () << indent << " (method_t extends past the end of the section)\n " ;
4482- } else
4483- memcpy (&m, r, sizeof (struct method_relative_t ));
4484- if (info->O ->isLittleEndian () != sys::IsLittleEndianHost)
4485- swapStruct (m);
4486-
4487- outs () << indent << " \t\t name " << format (" 0x%" PRIx32, m.name );
4488- uint64_t relNameRefVA = p + offsetof (struct method_relative_t , name);
4489- uint64_t absNameRefVA = relNameRefVA + m.name ;
4490- outs () << " (" << format (" 0x%" PRIx32, absNameRefVA) << " )" ;
4491-
4492- // since this is a relative list, absNameRefVA is the address of the
4493- // __objc_selrefs entry, so a pointer, not the actual name
4494- const char *nameRefPtr =
4495- get_pointer_64 (absNameRefVA, xoffset, left, xS, info);
4496- if (nameRefPtr) {
4497- uint32_t pointerSize = pointerBits / CHAR_BIT;
4498- if (left < pointerSize)
4499- outs () << indent << " (nameRefPtr extends past the end of the section)" ;
4500- else {
4501- if (pointerSize == 64 ) {
4502- name = get_pointer_64 (*reinterpret_cast <const uint64_t *>(nameRefPtr),
4503- xoffset, left, xS, info);
4504- } else {
4505- name = get_pointer_32 (*reinterpret_cast <const uint32_t *>(nameRefPtr),
4506- xoffset, left, xS, info);
4507- }
4508- if (name != nullptr )
4509- outs () << format (" %.*s" , left, name);
4510- }
4511- }
4512- outs () << " \n " ;
4513-
4514- outs () << indent << " \t\t types " << format (" 0x%" PRIx32, m.types );
4515- uint64_t relTypesVA = p + offsetof (struct method_relative_t , types);
4516- uint64_t absTypesVA = relTypesVA + m.types ;
4517- outs () << " (" << format (" 0x%" PRIx32, absTypesVA) << " )" ;
4518- name = get_pointer_32 (absTypesVA, xoffset, left, xS, info);
4519- if (name != nullptr )
4520- outs () << format (" %.*s" , left, name);
4521- outs () << " \n " ;
4522-
4523- outs () << indent << " \t\t imp " << format (" 0x%" PRIx32, m.imp );
4524- uint64_t relImpVA = p + offsetof (struct method_relative_t , imp);
4525- uint64_t absImpVA = relImpVA + m.imp ;
4526- outs () << " (" << format (" 0x%" PRIx32, absImpVA) << " )" ;
4527- name = GuessSymbolName (absImpVA, info->AddrMap );
4528- if (name != nullptr )
4529- outs () << " " << name;
4530- outs () << " \n " ;
4531-
4532- p += sizeof (struct method_relative_t );
4533- offset += sizeof (struct method_relative_t );
4534- }
4535- }
4536-
45374443static void print_method_list64_t (uint64_t p, struct DisassembleInfo *info,
45384444 const char *indent) {
45394445 struct method_list64_t ml;
@@ -4555,17 +4461,10 @@ static void print_method_list64_t(uint64_t p, struct DisassembleInfo *info,
45554461 memcpy (&ml, r, sizeof (struct method_list64_t ));
45564462 if (info->O ->isLittleEndian () != sys::IsLittleEndianHost)
45574463 swapStruct (ml);
4558- p += sizeof (struct method_list64_t );
4559-
4560- if ((ml.entsize & ML_HAS_RELATIVE_PTRS) != 0 ) {
4561- print_relative_method_list (ml.entsize , ml.count , p, info, indent,
4562- /* pointerBits=*/ 64 );
4563- return ;
4564- }
4565-
45664464 outs () << indent << " \t\t entsize " << ml.entsize << " \n " ;
45674465 outs () << indent << " \t\t count " << ml.count << " \n " ;
45684466
4467+ p += sizeof (struct method_list64_t );
45694468 offset += sizeof (struct method_list64_t );
45704469 for (i = 0 ; i < ml.count ; i++) {
45714470 r = get_pointer_64 (p, offset, left, S, info);
@@ -4653,17 +4552,10 @@ static void print_method_list32_t(uint64_t p, struct DisassembleInfo *info,
46534552 memcpy (&ml, r, sizeof (struct method_list32_t ));
46544553 if (info->O ->isLittleEndian () != sys::IsLittleEndianHost)
46554554 swapStruct (ml);
4656- p += sizeof (struct method_list32_t );
4657-
4658- if ((ml.entsize & ML_HAS_RELATIVE_PTRS) != 0 ) {
4659- print_relative_method_list (ml.entsize , ml.count , p, info, indent,
4660- /* pointerBits=*/ 32 );
4661- return ;
4662- }
4663-
46644555 outs () << indent << " \t\t entsize " << ml.entsize << " \n " ;
46654556 outs () << indent << " \t\t count " << ml.count << " \n " ;
46664557
4558+ p += sizeof (struct method_list32_t );
46674559 offset += sizeof (struct method_list32_t );
46684560 for (i = 0 ; i < ml.count ; i++) {
46694561 r = get_pointer_32 (p, offset, left, S, info);
0 commit comments