Skip to content

Commit b16372c

Browse files
committed
[PowerPC][MC] Set 'future' as default CPU type of XCOFF
For Power on Linux (both LE and BE), ELFObjectFile returns 'future' as default CPU type if mcpu is not specified, so that all necessary features will be enabled in MC. While for XCOFF, the default CPU type is always null, which makes tools like llvm-objdump not able to recognize prefixed instructions, unless specifying --mcpu=pwr10 or --mattr=+prefix-instrs manually. Reviewed By: nemanjai Differential Revision: https://reviews.llvm.org/D155089
1 parent a4d1259 commit b16372c

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

llvm/include/llvm/Object/XCOFFObjectFile.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -715,6 +715,8 @@ class XCOFFObjectFile : public ObjectFile {
715715
uint32_t Distance);
716716

717717
static bool classof(const Binary *B) { return B->isXCOFF(); }
718+
719+
std::optional<StringRef> tryGetCPUName() const override;
718720
}; // XCOFFObjectFile
719721

720722
typedef struct {

llvm/lib/Object/XCOFFObjectFile.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1217,6 +1217,10 @@ ObjectFile::createXCOFFObjectFile(MemoryBufferRef MemBufRef,
12171217
return XCOFFObjectFile::create(FileType, MemBufRef);
12181218
}
12191219

1220+
std::optional<StringRef> XCOFFObjectFile::tryGetCPUName() const {
1221+
return StringRef("future");
1222+
}
1223+
12201224
bool XCOFFSymbolRef::isFunction() const {
12211225
if (!isCsectSymbol())
12221226
return false;

0 commit comments

Comments
 (0)