@@ -79,45 +79,9 @@ ObjectFile *ObjectFileXCOFF::CreateInstance(const lldb::ModuleSP &module_sp,
7979 if (!objfile_up)
8080 return nullptr ;
8181
82- // Cache xcoff binary.
83- if (!objfile_up->CreateBinary ())
84- return nullptr ;
85-
86- if (!objfile_up->ParseHeader ())
87- return nullptr ;
88-
8982 return objfile_up.release ();
9083}
9184
92- bool ObjectFileXCOFF::CreateBinary () {
93- if (m_binary)
94- return true ;
95-
96- Log *log = GetLog (LLDBLog::Object);
97-
98- auto binary = llvm::object::XCOFFObjectFile::createObjectFile (
99- llvm::MemoryBufferRef (toStringRef (m_data.GetData ()),
100- m_file.GetFilename ().GetStringRef ()),
101- file_magic::xcoff_object_64);
102- if (!binary) {
103- LLDB_LOG_ERROR (log, binary.takeError (),
104- " Failed to create binary for file ({1}): {0}" , m_file);
105- return false ;
106- }
107-
108- // Make sure we only handle XCOFF format.
109- m_binary =
110- llvm::unique_dyn_cast<llvm::object::XCOFFObjectFile>(std::move (*binary));
111- if (!m_binary)
112- return false ;
113-
114- LLDB_LOG (log, " this = {0}, module = {1} ({2}), file = {3}, binary = {4}" ,
115- this , GetModule ().get (), GetModule ()->GetSpecificationDescription (),
116- m_file.GetPath (), m_binary.get ());
117-
118- return true ;
119- }
120-
12185ObjectFile *ObjectFileXCOFF::CreateMemoryInstance (
12286 const lldb::ModuleSP &module_sp, WritableDataBufferSP data_sp,
12387 const lldb::ProcessSP &process_sp, lldb::addr_t header_addr) {
@@ -144,10 +108,9 @@ size_t ObjectFileXCOFF::GetModuleSpecifications(
144108
145109static uint32_t XCOFFHeaderSizeFromMagic (uint32_t magic) {
146110 switch (magic) {
147- /* TODO: 32bit not supported yet
148- case XCOFF::XCOFF32:
149- return sizeof(struct llvm::object::XCOFFFileHeader32);
150- */
111+ // TODO: 32bit not supported yet
112+ // case XCOFF::XCOFF32:
113+ // return sizeof(struct llvm::object::XCOFFFileHeader32);
151114
152115 case XCOFF::XCOFF64:
153116 return sizeof (struct llvm ::object::XCOFFFileHeader64);
@@ -172,27 +135,15 @@ bool ObjectFileXCOFF::MagicBytesMatch(DataBufferSP &data_sp,
172135 return XCOFFHeaderSizeFromMagic (magic) != 0 ;
173136}
174137
175- bool ObjectFileXCOFF::ParseHeader () {
176-
177- bool retVal = false ;
178- ModuleSP module_sp (GetModule ());
179- if (module_sp) {
180- // Only 64-bit is supported for now
181- if (m_binary->fileHeader64 ()->Magic == XCOFF::XCOFF64)
182- retVal = true ;
183- }
184-
185- return retVal;
186- }
138+ bool ObjectFileXCOFF::ParseHeader () { return false ; }
187139
188140ByteOrder ObjectFileXCOFF::GetByteOrder () const { return eByteOrderBig; }
189141
190142bool ObjectFileXCOFF::IsExecutable () const { return true ; }
191143
192144uint32_t ObjectFileXCOFF::GetAddressByteSize () const {
193145
194- /* TODO: Need to handle 32-bit support, until then
195- * return 8 for 64-bit XCOFF::XCOFF64 */
146+ // 32-bit not supprted. return 8 for 64-bit XCOFF::XCOFF64
196147 return 8 ;
197148}
198149
@@ -218,13 +169,7 @@ UUID ObjectFileXCOFF::GetUUID() { return UUID(); }
218169
219170uint32_t ObjectFileXCOFF::GetDependentModules (FileSpecList &files) { return 0 ; }
220171
221- ObjectFile::Type ObjectFileXCOFF::CalculateType () {
222- if (m_binary->fileHeader64 ()->Flags & XCOFF::F_EXEC)
223- return eTypeExecutable;
224- else if (m_binary->fileHeader64 ()->Flags & XCOFF::F_SHROBJ)
225- return eTypeSharedLibrary;
226- return eTypeUnknown;
227- }
172+ ObjectFile::Type ObjectFileXCOFF::CalculateType () { return eTypeExecutable; }
228173
229174ObjectFile::Strata ObjectFileXCOFF::CalculateStrata () { return eStrataUnknown; }
230175
0 commit comments