mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 20:51:52 +01:00
Move getPlatformFlags to ELFObjectFileBase and simplify.
This removes a few std::error_code results that were ignored on every call. llvm-svn: 323674
This commit is contained in:
parent
5109f541bb
commit
93d0baac6c
@ -67,6 +67,9 @@ public:
|
|||||||
|
|
||||||
virtual elf_symbol_iterator_range getDynamicSymbolIterators() const = 0;
|
virtual elf_symbol_iterator_range getDynamicSymbolIterators() const = 0;
|
||||||
|
|
||||||
|
/// Returns platform-specific object flags, if any.
|
||||||
|
virtual unsigned getPlatformFlags() const = 0;
|
||||||
|
|
||||||
elf_symbol_iterator_range symbols() const;
|
elf_symbol_iterator_range symbols() const;
|
||||||
|
|
||||||
static bool classof(const Binary *v) { return v->isELF(); }
|
static bool classof(const Binary *v) { return v->isELF(); }
|
||||||
@ -364,10 +367,7 @@ public:
|
|||||||
StringRef getFileFormatName() const override;
|
StringRef getFileFormatName() const override;
|
||||||
Triple::ArchType getArch() const override;
|
Triple::ArchType getArch() const override;
|
||||||
|
|
||||||
std::error_code getPlatformFlags(unsigned &Result) const override {
|
unsigned getPlatformFlags() const override { return EF.getHeader()->e_flags; }
|
||||||
Result = EF.getHeader()->e_flags;
|
|
||||||
return std::error_code();
|
|
||||||
}
|
|
||||||
|
|
||||||
std::error_code getBuildAttributes(ARMAttributeParser &Attributes) const override {
|
std::error_code getBuildAttributes(ARMAttributeParser &Attributes) const override {
|
||||||
auto SectionsOrErr = EF.sections();
|
auto SectionsOrErr = EF.sections();
|
||||||
|
@ -287,12 +287,6 @@ public:
|
|||||||
/// @brief Create a triple from the data in this object file.
|
/// @brief Create a triple from the data in this object file.
|
||||||
Triple makeTriple() const;
|
Triple makeTriple() const;
|
||||||
|
|
||||||
/// Returns platform-specific object flags, if any.
|
|
||||||
virtual std::error_code getPlatformFlags(unsigned &Result) const {
|
|
||||||
Result = 0;
|
|
||||||
return object_error::invalid_file_type;
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual std::error_code
|
virtual std::error_code
|
||||||
getBuildAttributes(ARMAttributeParser &Attributes) const {
|
getBuildAttributes(ARMAttributeParser &Attributes) const {
|
||||||
return std::error_code();
|
return std::error_code();
|
||||||
|
@ -529,10 +529,11 @@ void RuntimeDyldELF::setMipsABI(const ObjectFile &Obj) {
|
|||||||
IsMipsN64ABI = false;
|
IsMipsN64ABI = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
unsigned AbiVariant;
|
if (auto *E = dyn_cast<ELFObjectFileBase>(&Obj)) {
|
||||||
Obj.getPlatformFlags(AbiVariant);
|
unsigned AbiVariant = E->getPlatformFlags();
|
||||||
IsMipsO32ABI = AbiVariant & ELF::EF_MIPS_ABI_O32;
|
IsMipsO32ABI = AbiVariant & ELF::EF_MIPS_ABI_O32;
|
||||||
IsMipsN32ABI = AbiVariant & ELF::EF_MIPS_ABI2;
|
IsMipsN32ABI = AbiVariant & ELF::EF_MIPS_ABI2;
|
||||||
|
}
|
||||||
IsMipsN64ABI = Obj.getFileFormatName().equals("ELF64-mips");
|
IsMipsN64ABI = Obj.getFileFormatName().equals("ELF64-mips");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1261,8 +1262,7 @@ RuntimeDyldELF::processRelocationRef(
|
|||||||
DEBUG(dbgs() << " Create a new stub function\n");
|
DEBUG(dbgs() << " Create a new stub function\n");
|
||||||
Stubs[Value] = Section.getStubOffset();
|
Stubs[Value] = Section.getStubOffset();
|
||||||
|
|
||||||
unsigned AbiVariant;
|
unsigned AbiVariant = Obj.getPlatformFlags();
|
||||||
O.getPlatformFlags(AbiVariant);
|
|
||||||
|
|
||||||
uint8_t *StubTargetAddr = createStubFunction(
|
uint8_t *StubTargetAddr = createStubFunction(
|
||||||
Section.getAddressWithOffset(Section.getStubOffset()), AbiVariant);
|
Section.getAddressWithOffset(Section.getStubOffset()), AbiVariant);
|
||||||
@ -1357,8 +1357,7 @@ RuntimeDyldELF::processRelocationRef(
|
|||||||
DEBUG(dbgs() << " Create a new stub function\n");
|
DEBUG(dbgs() << " Create a new stub function\n");
|
||||||
Stubs[Value] = Section.getStubOffset();
|
Stubs[Value] = Section.getStubOffset();
|
||||||
|
|
||||||
unsigned AbiVariant;
|
unsigned AbiVariant = Obj.getPlatformFlags();
|
||||||
O.getPlatformFlags(AbiVariant);
|
|
||||||
|
|
||||||
uint8_t *StubTargetAddr = createStubFunction(
|
uint8_t *StubTargetAddr = createStubFunction(
|
||||||
Section.getAddressWithOffset(Section.getStubOffset()), AbiVariant);
|
Section.getAddressWithOffset(Section.getStubOffset()), AbiVariant);
|
||||||
@ -1415,8 +1414,7 @@ RuntimeDyldELF::processRelocationRef(
|
|||||||
} else if (Arch == Triple::ppc64 || Arch == Triple::ppc64le) {
|
} else if (Arch == Triple::ppc64 || Arch == Triple::ppc64le) {
|
||||||
if (RelType == ELF::R_PPC64_REL24) {
|
if (RelType == ELF::R_PPC64_REL24) {
|
||||||
// Determine ABI variant in use for this object.
|
// Determine ABI variant in use for this object.
|
||||||
unsigned AbiVariant;
|
unsigned AbiVariant = Obj.getPlatformFlags();
|
||||||
Obj.getPlatformFlags(AbiVariant);
|
|
||||||
AbiVariant &= ELF::EF_PPC64_ABI;
|
AbiVariant &= ELF::EF_PPC64_ABI;
|
||||||
// A PPC branch relocation will need a stub function if the target is
|
// A PPC branch relocation will need a stub function if the target is
|
||||||
// an external symbol (either Value.SymbolName is set, or SymType is
|
// an external symbol (either Value.SymbolName is set, or SymType is
|
||||||
|
@ -76,8 +76,7 @@ ObjectFile::createELFObjectFile(MemoryBufferRef Obj) {
|
|||||||
|
|
||||||
SubtargetFeatures ELFObjectFileBase::getMIPSFeatures() const {
|
SubtargetFeatures ELFObjectFileBase::getMIPSFeatures() const {
|
||||||
SubtargetFeatures Features;
|
SubtargetFeatures Features;
|
||||||
unsigned PlatformFlags;
|
unsigned PlatformFlags = getPlatformFlags();
|
||||||
getPlatformFlags(PlatformFlags);
|
|
||||||
|
|
||||||
switch (PlatformFlags & ELF::EF_MIPS_ARCH) {
|
switch (PlatformFlags & ELF::EF_MIPS_ARCH) {
|
||||||
case ELF::EF_MIPS_ARCH_1:
|
case ELF::EF_MIPS_ARCH_1:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user