#include "gtest/gtest.h"
#include "../../lib/ReaderWriter/MachO/MachONormalizedFile.h"
#include "llvm/Support/MachO.h"
-#include <assert.h>
-#include <vector>
using llvm::StringRef;
using llvm::MemoryBuffer;
EXPECT_TRUE(f->undefinedSymbols.empty());
}
-
TEST(BinaryReaderTest, empty_obj_x86) {
FILEBYTES = {
0xce, 0xfa, 0xed, 0xfe, 0x07, 0x00, 0x00, 0x00,
EXPECT_TRUE(f->undefinedSymbols.empty());
}
-
TEST(BinaryReaderTest, empty_obj_ppc) {
FILEBYTES = {
0xfe, 0xed, 0xfa, 0xce, 0x00, 0x00, 0x00, 0x12,
EXPECT_TRUE(f->undefinedSymbols.empty());
}
-
TEST(BinaryReaderTest, empty_obj_armv7) {
FILEBYTES = {
0xce, 0xfa, 0xed, 0xfe, 0x0c, 0x00, 0x00, 0x00,
EXPECT_EQ(printfLabel.scope, SymbolScope(N_EXT));
}
-
TEST(BinaryReaderTest, hello_obj_x86) {
FILEBYTES = {
0xCE, 0xFA, 0xED, 0xFE, 0x07, 0x00, 0x00, 0x00,
EXPECT_EQ(printfLabel.scope, SymbolScope(N_EXT));
}
-
TEST(BinaryReaderTest, hello_obj_armv7) {
FILEBYTES = {
0xCE, 0xFA, 0xED, 0xFE, 0x0C, 0x00, 0x00, 0x00,
EXPECT_EQ(printfLabel.scope, SymbolScope(N_EXT));
}
-
TEST(BinaryReaderTest, hello_obj_ppc) {
FILEBYTES = {
0xFE, 0xED, 0xFA, 0xCE, 0x00, 0x00, 0x00, 0x12,
EXPECT_EQ(printfLabel.scope, SymbolScope(N_EXT));
writeBinary(*f, "/tmp/foo.o");
-
}
#include "gtest/gtest.h"
#include "../../lib/ReaderWriter/MachO/MachONormalizedFile.h"
#include "llvm/Support/MachO.h"
-#include <assert.h>
-#include <vector>
using llvm::StringRef;
using llvm::MemoryBuffer;
using lld::mach_o::normalized::Section;
using lld::mach_o::normalized::Relocation;
-
static std::unique_ptr<NormalizedFile> fromYAML(StringRef str) {
std::unique_ptr<MemoryBuffer> mb(MemoryBuffer::getMemBuffer(str));
ErrorOr<std::unique_ptr<NormalizedFile>> r
EXPECT_TRUE(!ec);
}
-
// ppc is no longer supported, but it is here to test endianness handling.
TEST(ObjectFileYAML, empty_ppc) {
std::unique_ptr<NormalizedFile> f = fromYAML(
EXPECT_TRUE(f->undefinedSymbols.empty());
}
-
TEST(ObjectFileYAML, roundTrip) {
std::string intermediate;
{
}
}
-
TEST(ObjectFileYAML, oneSymbol) {
std::unique_ptr<NormalizedFile> f = fromYAML(
"---\n"
EXPECT_EQ((uint64_t)sym.value, 0x100ULL);
}
-
TEST(ObjectFileYAML, oneSection) {
std::unique_ptr<NormalizedFile> f = fromYAML(
"---\n"
EXPECT_EQ((int)(sect.content[1]), 0x90);
}
-
TEST(ObjectFileYAML, hello_x86_64) {
std::unique_ptr<NormalizedFile> f = fromYAML(
"---\n"
EXPECT_EQ((uint64_t)sym3.value, 0x0ULL);
}
-
TEST(ObjectFileYAML, hello_x86) {
std::unique_ptr<NormalizedFile> f = fromYAML(
"---\n"
EXPECT_EQ((uint64_t)sym2.value, 0x0ULL);
}
-
-
TEST(ObjectFileYAML, hello_armv7) {
std::unique_ptr<NormalizedFile> f = fromYAML(
"---\n"