summaryrefslogtreecommitdiffstats
path: root/lld/lib/ReaderWriter/MachO
diff options
context:
space:
mode:
Diffstat (limited to 'lld/lib/ReaderWriter/MachO')
-rw-r--r--lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryReader.cpp17
-rw-r--r--lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp7
2 files changed, 13 insertions, 11 deletions
diff --git a/lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryReader.cpp b/lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryReader.cpp
index 284c7d7ec53..2ca3442a5fd 100644
--- a/lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryReader.cpp
+++ b/lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryReader.cpp
@@ -31,6 +31,7 @@
#include "llvm/ADT/StringSwitch.h"
#include "llvm/ADT/Twine.h"
#include "llvm/Support/Casting.h"
+#include "llvm/Support/Errc.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/FileOutputBuffer.h"
#include "llvm/Support/Host.h"
@@ -61,7 +62,7 @@ static std::error_code forEachLoadCommand(
slc = &lcCopy;
}
if ( (p + slc->cmdsize) > lcRange.end() )
- return std::make_error_code(std::errc::executable_format_error);
+ return make_error_code(llvm::errc::executable_format_error);
if (func(slc->cmd, slc->cmdsize, p))
return std::error_code();
@@ -76,7 +77,7 @@ static std::error_code appendRelocations(Relocations &relocs, StringRef buffer,
bool swap, bool bigEndian,
uint32_t reloff, uint32_t nreloc) {
if ((reloff + nreloc*8) > buffer.size())
- return std::make_error_code(std::errc::executable_format_error);
+ return make_error_code(llvm::errc::executable_format_error);
const any_relocation_info* relocsArray =
reinterpret_cast<const any_relocation_info*>(buffer.begin()+reloff);
@@ -91,9 +92,9 @@ appendIndirectSymbols(IndirectSymbols &isyms, StringRef buffer, bool swap,
bool bigEndian, uint32_t istOffset, uint32_t istCount,
uint32_t startIndex, uint32_t count) {
if ((istOffset + istCount*4) > buffer.size())
- return std::make_error_code(std::errc::executable_format_error);
+ return make_error_code(llvm::errc::executable_format_error);
if (startIndex+count > istCount)
- return std::make_error_code(std::errc::executable_format_error);
+ return make_error_code(llvm::errc::executable_format_error);
const uint32_t *indirectSymbolArray =
reinterpret_cast<const uint32_t*>(buffer.begin()+istOffset);
@@ -141,12 +142,12 @@ readBinary(std::unique_ptr<MemoryBuffer> &mb,
fa++;
}
if (!foundArch) {
- return std::make_error_code(std::errc::executable_format_error);
+ return make_error_code(llvm::errc::executable_format_error);
}
objSize = readBigEndian(fa->size);
uint32_t offset = readBigEndian(fa->offset);
if ((offset + objSize) > mb->getBufferSize())
- return std::make_error_code(std::errc::executable_format_error);
+ return make_error_code(llvm::errc::executable_format_error);
start += offset;
mh = reinterpret_cast<const mach_header *>(start);
}
@@ -170,7 +171,7 @@ readBinary(std::unique_ptr<MemoryBuffer> &mb,
swap = true;
break;
default:
- return std::make_error_code(std::errc::executable_format_error);
+ return make_error_code(llvm::errc::executable_format_error);
}
// Endian swap header, if needed.
@@ -188,7 +189,7 @@ readBinary(std::unique_ptr<MemoryBuffer> &mb,
start + (is64 ? sizeof(mach_header_64) : sizeof(mach_header));
StringRef lcRange(lcStart, smh->sizeofcmds);
if (lcRange.end() > (start + objSize))
- return std::make_error_code(std::errc::executable_format_error);
+ return make_error_code(llvm::errc::executable_format_error);
// Normalize architecture
f->arch = MachOLinkingContext::archFromCpuType(smh->cputype, smh->cpusubtype);
diff --git a/lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp b/lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp
index 2ccd9e81693..f96a9f29a2c 100644
--- a/lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp
+++ b/lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp
@@ -29,6 +29,7 @@
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/Casting.h"
+#include "llvm/Support/Errc.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/FileOutputBuffer.h"
@@ -376,7 +377,7 @@ void MachOFileLayout::buildFileOffsets() {
if (&sg1 == &sg2)
continue;
if (overlaps(sg1,sg2)) {
- _ec = std::make_error_code(std::errc::executable_format_error);
+ _ec = make_error_code(llvm::errc::executable_format_error);
return;
}
}
@@ -388,7 +389,7 @@ void MachOFileLayout::buildFileOffsets() {
if (&s1 == &s2)
continue;
if (overlaps(s1,s2)) {
- _ec = std::make_error_code(std::errc::executable_format_error);
+ _ec = make_error_code(llvm::errc::executable_format_error);
return;
}
}
@@ -409,7 +410,7 @@ void MachOFileLayout::buildFileOffsets() {
if ((s.address >= sg.address)
&& (s.address+s.content.size() <= sg.address+sg.size)) {
if (!sg.name.equals(s.segmentName)) {
- _ec = std::make_error_code(std::errc::executable_format_error);
+ _ec = make_error_code(llvm::errc::executable_format_error);
return;
}
_segInfo[&sg].sections.push_back(&s);
OpenPOWER on IntegriCloud